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

rostopic pub and echo in launch file

asked 2019-10-29 07:26:55 -0500

v.leto gravatar image

Hi I would like to test a node publishing things and seeing if they are arrived. What is the structure the launch file should have? I would like to modify the arguments as I want.

edit retag flag offensive close merge delete

Comments

Is #q216036 what you are looking for ?

Delb gravatar image Delb  ( 2019-10-29 07:53:54 -0500 )edit

I have read this answer but I don't understand what I should put in args=" /pkg_topic pkg_executable_file/message". My topic is /GPS/Data, my message type is wmcs_lib/GPSData with fields: float64 UTCTime wmcs_lib/LLD Position uint8 Fix float32 HDOP. I would like to print on one of these fileds.

v.leto gravatar image v.leto  ( 2019-10-29 08:05:33 -0500 )edit

how i can put multi or many publisher in the same file launch, this tuto explain only on waya https://www.youtube.com/watch?v=K3hQe...

thanks

Siphax gravatar image Siphax  ( 2021-11-25 20:16:36 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-10-29 08:26:13 -0500

Delb gravatar image

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
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-10-29 07:26:55 -0500

Seen: 1,915 times

Last updated: Nov 25 '21