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

publishers priority

asked 2013-03-26 22:23:32 -0500

camilla gravatar image

Hi everyone! Is there the possibility to give different priorities to publishers which publish on the same topic? For example I want to teleoperate my robot, so there is a node for teleoperation that send messages on the /cmd_vel topic on the basis of what I click on the keyboard, but I also want to have a node that checks if there are obstacles on my way and in that case stops my robot, so it should publish with a higher priority on /cmd_vel a message that sets the velocities to 0. Is something like this possible? Thanks

edit retag flag offensive close merge delete

Comments

You can add the module before you are going to publish the cmd_vel. Maybe you can have a obstacle avoidance module which subscribe to tele_op and publish cmd_vel.

tianb03 gravatar image tianb03  ( 2013-03-26 22:40:04 -0500 )edit

This is surely working, but I'm interested in the question in general not only on this particulare case, that is to say that I'd like to know if there is a way to set publishers priority

camilla gravatar image camilla  ( 2013-03-26 22:45:41 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
3

answered 2013-03-27 00:33:20 -0500

Ben_S gravatar image

No, there is no such concept in ROS. Even if there was, that would be highly problematic, because the messages with the different priorities are not synchronized in any way, so if one of them fails due to network problems or a program crash, you wouldn't be able to decide, which message to follow. The last higher priority one, that could be x seconds old or the newer low priority ones flodding in at 10Hz. This would be full of race conditions and not very reliable.

So whenever you have such situation, with stages of different priority, chain them up according to the priorities. That way you are making sure, that no low priority message may bypass any security/sanity checks and lead to potentially dangerous situations. The last part of any such chain should also include some kind of dead-man-switch, that stops all activity if no messages were received in the last 1-3 seconds (or whatever is safe for your robot to run unsupervised).

edit flag offensive delete link more
0

answered 2022-09-21 03:49:11 -0500

kosmastsk gravatar image

Twist mux (http://wiki.ros.org/twist_mux) is the package that implements exactly this functionality.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-03-26 22:23:32 -0500

Seen: 3,234 times

Last updated: Sep 21 '22