[ROS2 foxy] ros2 topic pub - with current timestamp
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?
Asked by anastasiaPan on 2021-02-16 09:22:43 UTC
Answers
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'}}
Asked by ijnek on 2022-12-14 08:30:36 UTC
Comments
did you find how to do it? I couldn't find any resources about that
Asked by charlie92 on 2021-04-27 15:45:31 UTC
No I haven't
Asked by anastasiaPan on 2021-05-05 10:07:39 UTC