Skip to content

Fix set_simulation_state STOPPED timeout - #950

Open
nekomario28 wants to merge 4 commits into
gazebosim:ros2from
nekomario28:fix/919-upstream-final
Open

Fix set_simulation_state STOPPED timeout#950
nekomario28 wants to merge 4 commits into
gazebosim:ros2from
nekomario28:fix/919-upstream-final

Conversation

@nekomario28

@nekomario28 nekomario28 commented Aug 21, 2026

Copy link
Copy Markdown

Fixes #919

Summary

Fix SetSimulationState(STOPPED) reporting a timeout even when Gazebo has already reset the simulation.

The reset completion detector is armed before issuing the asynchronous reset request, so completion cannot be lost before the wait begins.

The STOPPED transition is handled in phases:

  1. Pause the simulation and observe the paused state.
  2. Arm reset detection.
  3. Issue the reset while preserving pause.
  4. Wait for reset completion.
  5. Verify semantic STOPPED (paused with iteration zero).

The pause-preservation compatibility handling for released gz-sim versions is intentionally retained.

Test coverage

  • Public-interface PLAYING -> STOPPED regression.
  • Public get_simulation_state is used as the semantic oracle.
  • The test restores PLAYING afterward so STOPPED does not leak into later tests.

Backport policy

I am not sure; maintainer guidance is welcome.

Assisted-by: ChatGPT (GPT-5.6 Sol)

Signed-off-by: Yuu <206304251+nekomario28@users.noreply.github.com>
Assisted-by: ChatGPT (GPT-5.6 Sol)
Exercise PLAYING and PAUSED transitions to STOPPED and repeated STOPPED requests through the public simulation interfaces.

Signed-off-by: Yuu <206304251+nekomario28@users.noreply.github.com>
Assisted-by: ChatGPT (GPT-5.6 Sol)
The expanded regression tried to classify PAUSED immediately after a STOPPED reset, but GetSimulationState intentionally reports paused iteration-zero worlds as STOPPED. Restore the previously validated PLAYING -> STOPPED regression instead of encoding an invalid state transition assumption.

Signed-off-by: Yuu <206304251+nekomario28@users.noreply.github.com>
Assisted-by: ChatGPT (GPT-5.6 Sol)
Bring the branch ancestry up to upstream ros2 at 2ee8a5c without rewriting the existing fix history. The merge tree matches the clean merge computed for upstream PR gazebosim#950.

Signed-off-by: Yuu <206304251+nekomario28@users.noreply.github.com>
Assisted-by: ChatGPT (GPT-5.6 Sol)
@nekomario28

Copy link
Copy Markdown
Author

@ahcorde The upstream ROS2 CI is still action_required on the current head 2e830dd2. The branch is based on the current ros2 base 2ee8a5c7, and the fork ROS2 CI run for this same head/base completed successfully. Could you please approve the upstream workflow and review the PR when convenient? Thanks.

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

Labels

None yet

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

Simulation interface - set simulation to stop gives timeout

2 participants