0
$\begingroup$

Rosanswers logo

I'm building a robot with multiple nodes which publish cmd_vel to perform different functions. Examples are joystick, nav stack, and a node which follows walls to perform mapping. What I would "like" is to have an executive node which controls which sources are publishing cmd_vel so that while I may have multiple source nodes running, in case I need them, only one is publishing at a time.
I suspect that I can't do this. How is this kind of problem handled in ROS?


Originally posted by Alex Brown on ROS Answers with karma: 176 on 2012-06-12

Post score: 0


Original comments

Comment by Alex Brown on 2012-06-13:
Yes, that will work. It just seems a little unesthetic from an efficiency point of view. My base controller node would have to subscribe to all possible sources of cmd_vel. Choosing between them would be easy, but it just seems messy to have all the unused messages running around. Maybe the inefficiency is negligible though. I haven't tried to measure it. Ultimately, I would like to be able to control the "unused" node sources so that they don't eat up throughput when I'm not using them. Perhaps it is possible to launch and close nodes programatically, but I haven't seen this anywhere. If it's not possible, it would be nice to have a control signal to each node that has been launched so that you could put it in a standby mode when it's cmd_vel output is not needed. Whoops, I missed Lorenz's comment just off my screen. That is what I could include in my "executive" node that I refer to. It does add more latency to the signal though. I'll probably do something like this though.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The easiest way to solve your problem would be to publish cmd_vel on different topics, for instance

/joystick/cmd_vel
/navigation/cmd_vel
/wall_follower/cmd_vel

You can then write a node that takes in a list of topics, and publishes the appropriate topic on /cmd_vel.


Originally posted by piyushk with karma: 2871 on 2012-06-12

This answer was ACCEPTED on the original site

Post score: 5


Original comments

Comment by Lorenz on 2012-06-12:
One node that provides a service interfaces for selecting which topic should be re-published is http://ros.org/wiki/topic_tools/mux

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.