Ask Your Question
0

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

Could you please mark the question as answered by ticking the checkmark (✓) to the left of the answer if you feel it has been answered? Thanks.

gvdhoorn gravatar image gvdhoorn  ( 2020-09-02 01:54:57 -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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 92 times

Last updated: Sep 01 '20