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

roslaunch rostopic pub file find package

asked 2020-08-29 23:21:54 -0500

noob_ros gravatar image

How do I publish a message from a file, found with rospack find, using rostopic pub -f from a launch file?

<node pkg="rostopic" type="rostopic" name="arbitrary_node_name" args="pub topic_name msg_type -l -f $(find package_name)/message_details.yaml" output="screen" />

doesn't publish anything.

edit retag flag offensive close merge delete

Comments

Correction: message is published but only partially (message_details specifies several ros messages separated by '---' but only first message is published)

noob_ros gravatar image noob_ros  ( 2020-08-31 19:14:14 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-09-01 02:27:20 -0500

gvdhoorn gravatar image

updated 2020-09-01 02:28:09 -0500

message is published but only partially (message_details specifies several ros messages separated by '---' but only first message is published)

it seems things are actually working as they should.

According to the wiki page (emphasis mine):

-f FILE

Read message fields from YAML file. YAML syntax is equivalent to output of rostopic echo. Messages are separated using YAML document separator ---. To use only the first message in a file, use the --latch option.

(this is the same info you'd get when running rostopic pub --help btw)

Note how it mentions the latch option and how that causes rostopic pub to only publish "the first message".

You have the -l command line option in your args attribute in the .launch file you show:

<node pkg="rostopic" type="rostopic" name="arbitrary_node_name" args="pub topic_name msg_type -l -f $(find package_name)/message_details.yaml" output="screen" />

That would be the short version of --latch.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-08-29 23:21:54 -0500

Seen: 349 times

Last updated: Sep 01 '20