0
$\begingroup$

Rosanswers logo

I would like publish a continuous flow messages on a topic from the terminal. In order to do that I use the --rate argument of the rostopic tool. However my message type contains a header field that I would like to fill automatically.

The ros documentation says that you can fill the header stamp automatically (ref) in this way:

$ rostopic pub my_topic my_msgs/StampedMsg '{header: auto}'

However, it looks that the timestamp field does not update when it is used with the --rate parameter. Instead it remains constant with the stamp of the first message of the flow.

$ rostopic pub my_topic my_msgs/StampedMsg '{header: auto}' --rate 5

Is there any way to use rostopic so that the stamp field is automatically filled and dynamically updated?


Originally posted by Pablo Iñigo Blasco on ROS Answers with karma: 2982 on 2016-04-26

Post score: 3

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

In the link 'ros_comm#55' of the post of Martin, there is the solution.

Add -s option in the rostopic pub command line.

rostopic pub my_topic my_msgs/StampedMsg '{header: auto}' --rate 5 -s

Originally posted by bigbellmercy with karma: 86 on 2019-02-27

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$
0
$\begingroup$

Rosanswers logo

Yes, that's a bug in rostopic that I reported about 5 years ago: ros_comm#55. So the best workaround is probably to just write a 5-line python script that does the publishing.


Originally posted by Martin Günther with karma: 11816 on 2016-04-27

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.