-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
play - publish /clock topic #99
Comments
Sorry for being so late on replying here. The concept of simulating time for rosbag2 is not yet realized. Therefore, there is currently no I am going ahead and close this issue. If there is a follow up to this topic, please feel free to re-open it and continue the conversation. |
Follow-on - @Karsten1987 & @jacobperron - playing back a From a practical standpoint, I am running a high frequency system-clock-publishing-node publishing |
Can't agree more @IanTheEngineer. With --clock publishing msg in current time should be a core feature in ros2bag since the nodes are using current system time. For instance, the robot_localization pkg cannot output correct prediction with "ros2 bag play" bagfile data. |
@scoopySHI +1 |
there is a solution from @scoopySHI which uses the ros2 message introspection to memcopy the "proper" ros time (message time propagated into current time) into the serialized message buffer. This "feature" is obviously guarded by a --clock flag in the ros2bag python interface Fork + branch: Relevant Section in source file: This is a little buggy atm because we do not understand the message member offsets involved ... these structs define their offsets in a way which is not really consistent at first glance (because we do not properly understand the underlying dds implementation?). We will test it further tomorrow, but a little hint could help :) |
see #299 for further details |
our proposed solution did not work out in a way that was feasible. There is now a drive to implement the
@scoopySHI and I will probably come back to this one at some point. |
note: I rewrote the issue description at the top to add some details about how this should be implemented |
Any chances this can make to the Foxy release? |
PRs are welcome - I don't know of anybody that has time to work on it right now. I believe we're cutting the beta version of the package today for testing - @Karsten1987 does the beta count as a feature freeze or should we only freeze features at the release candidate phase? |
I does not count for a feature freeze. I a feature like this one can be implemented in a somewhat straightforward way and we have still enough time to test that I am all up for it. I would just hold back from any major disruptive change across the code base at this point. |
Just to add my tuppence-worth, with code like:
This does not tick at all! I playback my v1 bagfile with:
However, if I use the
It works! This is a showstopper for us. At the simplistic level, if the |
It's a functionality that exists in |
I've looked at the code, and yes, I can see one way to do it, and perhaps the Play/Pause functionality should be added too. I'm not sure about a PR, though, as I'd have to get work's legal etc involved... |
That PR unfortunately did not implement the desired feature. It was an attempt to re-stamp messages to current system time before publishing, rather than publishing to |
I just wanted to post here a workaround for this issue that we are using in one large AD project: https://github.com/mitsudome-r/clock_publisher. This is JUST a workaround, the proper solution should be implemented as part of the ROS 2 G roadmap: https://index.ros.org/doc/ros2/Roadmap/#id2. |
Fixes #99 Design: #675 Depends on #689 Depends on #693 to expose to the CLI Add a `rosgraph_msgs/Clock` publisher to the `Player` - that uses `PlayerClock::now()` to publish current time. Signed-off-by: Emerson Knapp <[email protected]>
Fixes #99 Design: #675 Depends on #689 Depends on #693 to expose to the CLI Add a `rosgraph_msgs/Clock` publisher to the `Player` - that uses `PlayerClock::now()` to publish current time. Signed-off-by: Emerson Knapp <[email protected]>
sooo did this ever made to Foxy ? |
No - there is currently no plan to backport this to Foxy due to the difficulty of maintaining API/ABI stability while doing so. It is available in Galactic and Rolling distributions. To use it in Foxy you might have some luck patching the https://github.com/ros2/rosbag2/tree/foxy-future branch and building from source, but no promises |
Thanks for the clarification ! |
This issue has been mentioned on ROS Discourse. There might be relevant details there: https://discourse.ros.org/t/fast-accurate-robust-replay-in-ros2/30406/2 |
Description
Feature request: Provide the
--clock
option so that rosbag2 publishes to the/clock
topic alongside its messages.Implementation Suggestion
Using
starting_time
of the bag and the stored (received) timestamp with every message, we can start a publisher for the /clock topic on playback and run it at a fixed rate, publishing messages when the next clock message is past their publishing time.This requires no introspection or modification of the message contents themselves.
Note that
player.cpp
is already using message timestamps to sleep in between publishing, to approximate the original rates. In this loop (play_messages_until_queue_empty
) we could potentially insert the clock publisher there.Another option would be to put the clock publisher on a timer, and have it publish the last-published message time.
Original Ticket
From ros 1 I'm used to the
--clock
option in order that the topics have time stamps as If the system would run right now. I couldn't find this option in the documentation of rosbag2. How can I activate simulated time with rosbag2?The text was updated successfully, but these errors were encountered: