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

[ROS2 foxy] ros2 topic pub - with current timestamp

asked 2021-02-16 08:22:43 -0500

anastasiaPan gravatar image

I want to publish a message with ros2 topic pub but use current time as a timestamp If I do not publish anything to the stamp or header fields then they are 0. I remember in ros1 you could publish with header:auto or stamp:now. Is there an equivalent for ros2?

edit retag flag offensive close merge delete

Comments

did you find how to do it? I couldn't find any resources about that

charlie92 gravatar image charlie92  ( 2021-04-27 15:45:31 -0500 )edit

No I haven't

anastasiaPan gravatar image anastasiaPan  ( 2021-05-05 10:07:39 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-12-14 07:30:36 -0500

ijnek gravatar image

This functionality was added to ros2cli recently in https://github.com/ros2/ros2cli/pull/749, and is available in ROS 2 Humble onwards!

You can do either:

{'header': 'auto'}

or:

{'header': {'stamp': 'now'}}
edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2021-02-16 08:22:43 -0500

Seen: 1,971 times

Last updated: Dec 14 '22