Learn how to detect the message type and create multiple input message type functions: https://answers.ros.org/question/60281/how-to-get-massage-type-in-rospy/
Q:How to get massage type in rospy?
A:The cleanest way is to use: `msg._type`
Here I leave an example of two susbcribers in ros using the same callback. The callback called **common_callback** will process the messages differently depending on their type. In this case it processes type LaserScan or Odometry, but this can be used for anything really because the output of the `msg._type` is `sensor_msgs/LaserScan`or `nav_msgs/Odometry`. So its easy too work with that.
example code in this the ROSAnswer: https://answers.ros.org/question/60281/how-to-get-massage-type-in-rospy/
Hope this helps ;).
0 Comments