ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

I'd suggest you change topology.

Why not having a single thread manage all the ROS messaging and then dispatching relevant information to the relevant processing thread?

As to say:

  • Thread A: ros spin, subscribing, callbacks, dispatcher
  • Thread B: laser, gets data from relevant dispatcher in thread A
  • Thread C: kinect, gets data from relevant dispatcher in thread A
  • Thread D: motion planner, gets data from all of the above and publishes cmd_vel

You should already be faced with the problem of how to pass data from your actual threads A and B to C (motion planner needs to know about legs and humans from A and B right?), so adding to this doesn't really over-complicate it.

I suggest you have a look at the ZeroMQ messaging library. It will allow you to easily shuffle messages back and forth from your threads, and make the program a little easier to both code and maintain.