Open diegoferigo opened 4 years ago
Thank you for ticketing this!
Since this PR we already have a message interface to reset simulation time, for example:
ign service -s /world/shapes/control --reqtype ignition.msgs.WorldControl --reptype ignition.msgs.Boolean --timeout 5000 --req 'reset: {all: true}'
The way systems can react to this is by looking at UpdateInfo
(not a callback or components though).
From the PR:
Systems can detect rewinds by checking:
if (_info.simTime == std::chrono::steady_clock::duration::zero())
if (_info.dt < std::chrono::steady_clock::duration::zero())
To detect pause:
if (_info.paused)
To detect time jump while paused (dt is zero during regular pause):
if (_info.paused && _info.dt != std::chrono::steady_clock::duration::zero())
So I think the main missing pieces are:
WorldControl
ign-gui
plugin.Great, thanks for providing these details! If I understood well, there's already the initial support for something similar than Ctrl+R, actually more advanced since it allows selecting t=t_k
instead of t=0
by default. However, so far there's no System yet (including Physics) that use this feature.
Few comments:
World::Reset
and Model::Reset
are quite useful.so far there's no System yet (including Physics) that use this feature.
That's true for live simulations, but the LogPlayback
system supports it when playing back log files.
a C++ API is still missing
That's a valid point. Since time management happens outside of the ECM, I think a component approach would be tough to implement though. Probably an event like we have for pause would be more appropriate:
rolling back time (by issuing negative time steps) and resetting the state of the physics engine + aligning the ECM are two very different approaches that could be implemented separately
Fully agreed. The message interface already keeps those separate, with reset / rewind separate from seek.
I see a lot of new GUI-related issues to track new features, and that's great! There's one feature, though, that in Gazebo Classic was used extensively by pretty much all the people I know that's still missing: resetting a world with
Ctrl + R
.Gazebo Classic had the following APIs:
gazebo::physics::Model::Reset
gazebo::physics::World::Reset
I never had a look at how it was implemented previously, what I want to add to this issue as a reminder is that it would be nice having a sort of callback that world and model plugins could use to reset their state.
A simple alternative would be adding a new reset component and ask plugin developers to always check if this component is present and take action. Both would equally work, at first thought I don't see major limitations of any of them. Maybe the callback would propagate better and more clearly.
Partially related to #113.