Skip to content

Add start_paused option to GzServer#872

Open
Cnoobmaster69 wants to merge 3 commits into
gazebosim:jazzyfrom
Cnoobmaster69:issue-800-start-paused-v118
Open

Add start_paused option to GzServer#872
Cnoobmaster69 wants to merge 3 commits into
gazebosim:jazzyfrom
Cnoobmaster69:issue-800-start-paused-v118

Conversation

@Cnoobmaster69

Copy link
Copy Markdown

Summary

Adds a new start_paused option to GzServer so simulations can start in a paused state.

This wires the option through the launch and action layers so it can be used from both Python and XML launch flows, and passed down to gzserver execution via Server::Run(..., paused).

Closes #800

Changes

  1. Added a new start_paused option in GzServer
  • Added ROS parameter handling in ros_gz_sim/src/gzserver.cpp.
  • Replaced the hardcoded paused=false behavior with the new start_paused parameter.
  1. Launch/action plumbing (Python + XML)
    Exposed and propagated start_paused through:
  • ros_gz_sim/launch/gz_server.launch.py
  • ros_gz_sim/launch/gz_server.launch
  • ros_gz_sim/launch/ros_gz_sim.launch.py
  • ros_gz_sim/launch/ros_gz_sim.launch
  • ros_gz_sim/ros_gz_sim/actions/gzserver.py
  1. Pause-state consistency fix in simulation interface sync
    In ros_gz_sim/src/gz_simulation_interfaces/gazebo_proxy.cpp:
  • update cached world stats from incoming SerializedStepMap::stats
  • preserve current paused state when sending control/state during canonical-link state synchronization.

This keeps pause behavior consistent during startup/synchronization flows.

Motivation

Currently, GzServer does not expose a straightforward way to start the simulation in a paused state, even though this can be useful for workflows such as:

  • preparing a screen recording before starting the simulation
  • spawning / configuring entities before unpausing
  • headless or scripted startup flows that need deterministic initialization

This PR adds that missing option while keeping the existing default behavior unchanged unless start_paused is explicitly enabled.

Manual validation

Tested on the jazzy branch.

Validated the following flow manually:

  1. launch gz_server with start_paused:=true

  2. verify the simulation starts paused through:

    • /stats
    • /gzserver/get_simulation_state
  3. unpause through /world/<world>/control

  4. verify that simulation resumes and behaves normally afterward (included additional entities)

I also verified that the default behavior remains unchanged when start_paused is not set.

Notes

I have not added automated tests yet.
I’d appreciate guidance on the preferred integration / launch test location in ros_gz_sim for this behavior.

Signed-off-by: CarlosCortes <carlos.eduardo.cortes.cecc@gmail.com>
Signed-off-by: Carlos Cortes <110703826+Cnoobmaster69@users.noreply.github.com>
Signed-off-by: Carlos Cortes <110703826+Cnoobmaster69@users.noreply.github.com>

@ahcorde ahcorde left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test ?

do you mind target rolling ? then we can backport this feature to older distros

@github-project-automation github-project-automation Bot moved this from Inbox to In review in Core development Mar 30, 2026
@Cnoobmaster69

Copy link
Copy Markdown
Author

can you add a test ?

do you mind target rolling ? then we can backport this feature to older distros

Thanks @ahcorde.

I’ll retarget this to rolling and add a basic test in ros_gz_sim before updating the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

3 participants