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

What is the convention for topic name parameterization?

asked 2011-04-29 10:58:54 -0600

updated 2011-09-03 15:29:05 -0600

kwc gravatar image

Is there a convention or "best practice" for making topic names configurable?

I can think of two obvious ways to do it, but would like to use the "standard".

  1. Name the topics statically and force people to remap as they see fit.

  2. Make the topic names ROS parameters

While the difference may seem trivial, developing consistent conventions eases and speeds development, and I'd like to go with the convention if there is one.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2011-04-30 01:18:51 -0600

fergs gravatar image

Topic names can be remapped when you start a node, there is no need for a parameter to be explicitly declared in your program. For instance, if my node subscribes to "my_topic" , and you have a node that publishes "your_topic", you could still use my code by remapping the name:

 rosrun my_package my_node my_topic:=your_topic

More information on namespaces and remapping can be found on the wiki: http://www.ros.org/wiki/Remapping%20Arguments

You can also remap topics using launch files using roslaunch's "remap" tag (http://www.ros.org/wiki/roslaunch/XML/remap).

edit flag offensive delete link more

Comments

@fergs can we do the other way round? i.e. can the publisher change its published topic name? if so can you please show the code like above? thanks

ChickenSoup gravatar image ChickenSoup  ( 2012-08-27 21:27:12 -0600 )edit

Question Tools

Stats

Asked: 2011-04-29 10:58:54 -0600

Seen: 1,696 times

Last updated: Apr 30 '11