Skip to content

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Oct 16, 2025

🎉 New feature

Summary

This is necessary for use with the SetState API. This API is commonly used to create a local version of the servers ECM that is periodically synchronized. However, without exposing this function into our public API additions and removals of entities or components are not reflected in the local ECM.

Currently, we use friend relationships for the GuiRunner class to allow it to run these functions, but this is not feasible for external code that wants to use SetState.

// Make runners friends so that they can manage entity creation and
// removal. This should be safe since runners are internal
// to Gazebo.
friend class GuiRunner;
friend class SimulationRunner;

gz-sim/src/gui/GuiRunner.cc

Lines 316 to 318 in 5ce62a8

this->dataPtr->ecm.ClearRemovedComponents();
this->dataPtr->ecm.ClearNewlyCreatedEntities();
this->dataPtr->ecm.ProcessRemoveEntityRequests();

This is needed for gazebosim/ros_gz#790 to be able to get the updated state of the world, for example, when requested for the list of entities in the world after an entity has been removed.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by and Generated-by messages.


This is an automatic backport of pull request #3002 done by Mergify.

@github-project-automation github-project-automation bot moved this from Inbox to In review in Core development Oct 16, 2025
@azeey azeey enabled auto-merge (rebase) October 16, 2025 15:57
Copy link

codecov bot commented Oct 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.09%. Comparing base (e7ef48e) to head (25c4aef).
⚠️ Report is 1 commits behind head on gz-sim9.

Additional details and impacted files
@@             Coverage Diff             @@
##           gz-sim9    #3126      +/-   ##
===========================================
+ Coverage    69.07%   69.09%   +0.01%     
===========================================
  Files          347      347              
  Lines        34038    34037       -1     
===========================================
+ Hits         23512    23518       +6     
+ Misses       10526    10519       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@azeey
Copy link
Contributor

azeey commented Oct 16, 2025

@Mergifyio rebase

…d removal (#3002)

This is necessary for use with the `SetState` API. This API is commonly
used to create a local version of the servers ECM that is periodically
synchronized. However, without exposing this function into our public API
additions and removals of entities or components are not reflected in the
local ECM.

Currently, we use `friend` relationships for the `GuiRunner` class to
allow it to run these functions, but this is not feasible for external
code that wants to use `SetState`.

https://github.com/gazebosim/gz-sim/blob/5ce62a8826b930078fae940288ac9677aae9ec7b/include/gz/sim/EntityComponentManager.hh#L834,
https://github.com/gazebosim/gz-sim/blob/5ce62a8826b930078fae940288ac9677aae9ec7b/src/gui/GuiRunner.cc#L316-L318

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
(cherry picked from commit b2f3c82)
Copy link
Contributor Author

mergify bot commented Oct 16, 2025

rebase

✅ Branch has been successfully rebased

@azeey azeey force-pushed the mergify/bp/gz-sim9/pr-3002 branch from 25c4aef to 7c76bf0 Compare October 16, 2025 17:39
@azeey azeey disabled auto-merge October 17, 2025 14:23
@azeey azeey merged commit dd12e91 into gz-sim9 Oct 17, 2025
13 of 14 checks passed
@azeey azeey deleted the mergify/bp/gz-sim9/pr-3002 branch October 17, 2025 14:23
@github-project-automation github-project-automation bot moved this from In review to Done in Core development Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏛️ ionic Gazebo Ionic

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant