Ask Your Question
1

rostopic pub - {stamp:now} vs --rate

asked 2016-04-26 16:31:37 -0600

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?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2016-04-27 07:39:48 -0600

updated 2016-04-27 07:41:52 -0600

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.

edit flag offensive delete link more
1

answered 2019-02-27 13:04:18 -0600

bigbellmercy gravatar image

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

Add -s option in the rostopic pub command line.

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

2 followers

Stats

Asked: 2016-04-26 16:31:37 -0600

Seen: 6,709 times

Last updated: Feb 27 '19