Skip to content

Conversation

azeey
Copy link
Contributor

@azeey azeey commented Jul 26, 2025

🎉 New feature

Summary

System for assigning semantics to entities, such as models, by classifying them into categories and assigning them tags.

Reference:
https://github.com/ros-simulation/simulation_interfaces/blob/1.0.0/msg/EntityCategory.msg,
https://github.com/ros-simulation/simulation_interfaces/blob/1.0.0/msg/TagsFilter.msg

This system is meant to be attached to a <world>, but it parses parameters
found in entities such as models.

Example:

<model name="robot1">
  <gz:semantics>
    <category>ROBOT</category>
    <tag>mobile</tag>
    <tag>diff_drive</tag>
  </gz:semantics>
</model>

This is a nice to have for gazebosim/ros_gz#790 in order to implement the GetEntityInfo service as well as to allow filtering based on categories and tags in GetEntities

Test it

bin/INTEGRATION_entity_semantics_system 

Future work:

  • Service to set categories dynamically. This would be used to implement SetEntityInfo
  • Potentially consolidate this and the Label system which is used to add semantic labels to visuals for segmentation.

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.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@azeey azeey requested a review from mjcarroll as a code owner July 26, 2025 04:52
@github-actions github-actions bot added the 🪵 jetty Gazebo Jetty label Jul 26, 2025
@github-project-automation github-project-automation bot moved this from Inbox to In review in Core development Jul 28, 2025
@azeey azeey added this to the Jetty Release milestone Jul 28, 2025
azeey added 2 commits July 31, 2025 13:57
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
azeey added 7 commits July 31, 2025 19:43
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@azeey azeey requested a review from arjo129 as a code owner August 18, 2025 20:18
…d removal (gazebosim#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>
@azeey azeey requested review from ahcorde and iche033 August 19, 2025 23:39
Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

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

This patch updates the bazel build to include the new entity_semantics system. We can include it here or submit another PR for this.

bazel.patch
diff --git a/BUILD.bazel b/BUILD.bazel
index 5fbd1714d..a09fe2810 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -701,6 +701,26 @@ gz_sim_system_libraries(
 #     ],
 # )
 
+gz_sim_system_libraries(
+    srcs = glob(
+        [
+            "src/systems/entity_semantics/**/*.cc",
+            "src/systems/entity_semantics/**/*.hh",
+        ],
+    ),
+    so_lib_name = "gz-sim-entity-semantics-system.so",
+    static_lib_name = "gz-sim-entity-semantics-system-static",
+    visibility = ["//visibility:public"],
+    deps = [
+        ":gz-sim",
+        "@gz-common",
+        "@gz-common//profiler",
+        "@gz-plugin//:register",
+        "@gz-transport",
+        "@sdformat",
+    ],
+)
+
 gz_sim_system_libraries(
     srcs = glob(
         [

namespace gz::sim::systems
{
//////////////////////////////////////////////////
void EntitySemantics::PreUpdate(const UpdateInfo &,
Copy link
Contributor

Choose a reason for hiding this comment

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

windows CI picked up a warning here:

C:\J\workspace\gz_sim-pr-cnlwin\ws\src\gz-sim\src\systems\entity_semantics\EntitySemantics.cc(70,6): error C2653: 'EntitySemantics': is not a class or namespace name [C:\J\workspace\gz_sim-pr-cnlwin\ws\build\gz-sim\src\systems\entity_semantics\gz-sim-entity-semantics-system.vcxproj]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hopefully fixed by 6cc2ac6

azeey and others added 2 commits August 20, 2025 22:54
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Co-authored-by: Ian Chen <ichen@openrobotics.org>
@azeey
Copy link
Contributor Author

azeey commented Aug 21, 2025

Thanks for the Bazel patch: 9097a00

azeey added 2 commits August 21, 2025 12:28
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@iche033
Copy link
Contributor

iche033 commented Aug 21, 2025

The EntityComponentManagerRepeat and UtilTest.ResolveSdfWorldFile homebrew test failures started popping up recently and are happening in other builds, e.g. #3003, so I think they are unrelated to this PR.

@azeey azeey dismissed ahcorde’s stale review August 23, 2025 03:14

Comments addressed.

@azeey azeey merged commit a503633 into gazebosim:main Aug 23, 2025
14 of 15 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Core development Aug 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪵 jetty Gazebo Jetty
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants