Skip to content

Conversation

arjo129
Copy link
Contributor

@arjo129 arjo129 commented Jun 25, 2025

🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸

🎉 New feature

Closes #

Summary

Depends on: gazebosim/gz-math#685

This PR adds a system which exports occupancy grids. Currently its a work in progress. The BFS algorithm takes a fair deal of time to converge, hence writing a unit test may not make sense. We should also make a nice UI for it.

Test it

Follow the instructions in the example sdf.

The occupancy grid will be published as an image on the /scan_image topic.

To start the exploration, run the following command in a new terminal:

  gz topic -t /start_exploration -m gz.msgs.Boolean -p 'data: true'
reduced_Screencast.From.2025-08-22.13-24-20.mp4

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.)

Generated-by: Gemini-2.5-Pro

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 PR adds a system which exports occupancy grids. Currently its a
work in progress. The BFS algorithm seems to not identify when there
cannot be any progress made.

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@github-project-automation github-project-automation bot moved this from Inbox to In review in Core development Jun 25, 2025
arjo129 added 5 commits June 30, 2025 08:52
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
This commit pushes an initial version of the code.

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@azeey azeey added this to the Jetty Release milestone Jul 28, 2025
@arjo129 arjo129 moved this from In review to In progress in Core development Aug 7, 2025
arjo129 and others added 2 commits August 15, 2025 07:18
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@iche033
Copy link
Contributor

iche033 commented Aug 21, 2025

Here's a patch to add the free_space_explorer system to bazel build. Can you add this?

bazel.patch
diff --git a/BUILD.bazel b/BUILD.bazel
index 9d6d2d9bb..01bc304ad 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -801,6 +801,26 @@ gz_sim_system_libraries(
     ],
 )
 
+gz_sim_system_libraries(
+    srcs = glob(
+        [
+            "src/systems/free_space_explorer/**/*.cc",
+            "src/systems/free_space_explorer/**/*.hh",
+        ],
+    ),
+    so_lib_name = "gz-sim-free-space_explorer--system.so",
+    static_lib_name = "gz-sim-free-space-explorer-system-static",
+    visibility = ["//visibility:public"],
+    deps = [
+        ":gz-sim",
+        "@gz-common//graphics",
+        "@gz-math",
+        "@gz-msgs//:gzmsgs_cc_proto",
+        "@gz-plugin//:register",
+        "@gz-transport",
+    ],
+)
+
 gz_sim_system_libraries(
     srcs = glob(
         [

After removing Get prefix from function names and fixing enum names, I was able to get this to build in bazel.

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
…m/gz-sim into arjo/feat/export_occupancy_grid
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@arjo129 arjo129 changed the title [WIP] Adds a system which enables exporting occupancy grids. Adds a system which enables exporting occupancy grids. Aug 22, 2025
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@arjo129 arjo129 marked this pull request as ready for review August 22, 2025 09:33
@arjo129 arjo129 added the needs upstream release Blocked by a release of an upstream library label Aug 22, 2025
Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

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

The overall feature looks great! I have some concerns about where the computation is being done. In most of our plugins, we have the pattern where we only do trivail things in message callbacks and defer expensive computation to Pre/PostUpdate calls. There also a number of style issues.

@github-project-automation github-project-automation bot moved this from In progress to In review in Core development Aug 23, 2025
AI was used to migrate the logic in OnLaserScanCallback.

Generated-by: Gemini-2.5-Pro

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
…m/gz-sim into arjo/feat/export_occupancy_grid
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Since we are accessing the occupancy grid on the main simulation loop
only now, we dont need a mutex to protect it.

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@arjo129 arjo129 requested review from ahcorde and azeey August 23, 2025 14:32
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for making all those changes.

Let's merge as is, but I'd ask if you can follow this up with an integration test.

@azeey azeey dismissed ahcorde’s stale review August 23, 2025 21:43

Review comments have been addressed

@azeey azeey merged commit b692ae2 into main Aug 23, 2025
13 checks passed
@azeey azeey deleted the arjo/feat/export_occupancy_grid branch August 23, 2025 21:44
@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 needs upstream release Blocked by a release of an upstream library

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants