-
Notifications
You must be signed in to change notification settings - Fork 255
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
Rosbag2 play --clock option ignores delay #1858
Comments
this problem can be reproducible with |
rosbag2/rosbag2_transport/src/rosbag2_transport/player.cpp Lines 1072 to 1075 in b5098ef
To solve this issue I think it should be set in the rosbag2/rosbag2_transport/src/rosbag2_transport/player.cpp Lines 487 to 491 in b5098ef
I have tested this locally and it behaves correctly.
This is a problem I have also encountered in #1836.
I would start the clock in a paused state and then resume it after the delay period. @fujitatomoya I can open a PR to solve these two problems if these fixes are ok. |
That also does the job.
sounds good to me.
appreciate your effort, i am happy to review this. thanks! @MichaelOrlov please chime in if you have other thoughts on this. |
Ah yes, I see the autostart feature was added last year. |
@fujitatomoya @hayato-m126 As regards:
As more I see issues like this, I more regret that we allowed merging the "delay" option for the Rosbag2 player back in the day. I honestly would prefer to get rid of it at all rather than trying to fix the consequences and overcomplicated logic that we currently have with it.
|
@MichaelOrlov thanks for your comments.
i get what you mean, but i am not sure about the history of
agree on this. just a minor question is |
Thank you for your comment.
I have no objection. If |
@fujitatomoya @hayato-m126 Thank you for your comments.
Currently |
I have never used loop.
However, if I were to use it, it would be as quoted. |
My understanding through the discussion so far is that bag play's playback status should be managed externally through the service. I figured that if |
The problem with the delay is that it introduces uncertainty and non-determinism in the playback workflow. The compromise solution would be to keep delay, but move it out of the loop. |
delay: non-determinism Delay at loop is unnecessary because the nodes are already up and running. If you really want to have a delay before play, I thought it would be better to put a sleep and create a delay outside of bag play. sleep 5; ros2 bag play bag_file --clock 200 # launch.py
bag_player = ExecuteProcess(cmd=["ros2", "bag", "play", "bag_file" "--clock", "200"])
delay_player = ExecuteProcess(cmd=["sleep", 5], on_exit=[bag_player]) |
In the case of a regular ExecuteProcess(cmd=..), yes, you can insert a sleep. However, in the case of node composition, there is no sleep option as far as I am aware. Please see example from the https://github.com/ros2/rosbag2?tab=readme-ov-file#using-with-composition |
@MichaelOrlov Are you saying that in an application where the player is put into component container for intra-process communication, there could be a case for using In other words, are you saying that doing as quoted below is a practical solution?
|
Yes. This is the case when a delay CLI parameter would be needed if someone decided to use delay before playback with composable player node. |
this makes sense to me, which is now implemented in #1861. |
Description
Even if delay option is specified, clock option ignores delay and publishes
/clock
.Also, after the time of delay elapses, clock time returns to the start time of bag.
Expected Behavior
/clock
is published after the delay time as well as the topic in the bag.Actual Behavior
/clock
is published ignoring delayTo Reproduce
/clock
--clock
and--delay
/clock
before delay time elapsesdemo
clock_ignores_delay.mp4
demo bag start Apr 5 2022 15:07:31.594430720 (1649138851.594430720)
clock 1649138851 -> 1649138861 -> 1649138851(start time)
clock_reverse_after_10sec.txt
System (please complete the following information)
Additional context
** Add any other context about the problem here **
The text was updated successfully, but these errors were encountered: