ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
To expand on the answer of #q216036 : you can use rostopic
in your launch file exactly like you are using it in command line. You just need to set the attributes pkg
and type
to rostopic
, then you can use the attribute args
to pub/echo/info/list etc..with the propper arguments corresponding.
For example you can do :
<node pkg="rostopic" type="rostopic" name="name" args="list" output="screen"/>
This will simply output the result of rostopic list
.
If you want to echo
a topic, the template would be :
<arg name="topic_name" default="A_TOPIC_NAME"/>
<node pkg="rostopic" type="rostopic" name="name"
args="echo $(arg topic_name)" output="screen"/>
Like that you can call your launch file and specify the topic in command line :
roslaunch YOUR_PACKAGE YOUR_LAUNCH_FILE topic_name:=YOUR_TOPIC