Closed osrf-migration closed 7 years ago
Original comment by Shane Loretz (Bitbucket: Shane Loretz, GitHub: sloretz).
When not paused Manager::UpdateSystems()
adds the time step to the current simulation time and updates the systems. When paused Manager::UpdateSystems()
updates the systems, but the current simulation time is unchanged. A convenience method bool Manager::IsPaused()
could be added for systems to check. This allows GUI / rendering / movement systems to update when paused, while systems like the physics system should check if the simulation is paused and skip the update.
Original comment by Shane Loretz (Bitbucket: Shane Loretz, GitHub: sloretz).
Passing on this in favor pull request #19. Related to #8
Original report (archived issue) by Shane Loretz (Bitbucket: Shane Loretz, GitHub: sloretz).
An important feature of Gazebo is pausing a simulation and allowing the world to be changed. Currently the change in simulation time must be passed into
Manager::UpdateSystems()
. ECSystems are given a single variabledt
which is the change in simulation time since the system was last called. This has it's own issues (see #8). This is a proposal to make the Manager class be the authority for simulation time.Add
ignition::common::Time Manager::SimulationTime()
returns the current sim timePauseLock Manager::Pause()
Simulation time is paused until allPauseLock
s are destructedignition::common::Duration
class to hold a change in timevoid Manager::SimulationTimeStep(ignition::common::Duration)
sets the time step for simulationChange
void Manager::UpdateSystems(double _dt)
tovoid Manager::UpdateSystems()
The
PauseLock
increases a reference counter on construction and decreases it on destruction. It's purpose is to prevent systems running at the same time from pausing/unpausing and conflicting with each other. This solves an issue observed recently where someone wanted to synchronize gazebo with an external process by pausing it, but some unknown part of gazebo kept unpausing the simulation. This way the simulation only proceeds when all PauseLocks cease to exist.The
Duration
would be an enhancement to ignition-common. It would probably be based on the ROS 1 roscpp Duration and methods would be added toignition::common::Time
to support adding and subtracting durations.