Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Apr 28, 2025

🦟 Bug fix

Fixes gazebosim/gz-rendering#1122

Summary

Light visuals (green lines) were always created, even on server side where sensors are enabled. Looks like a regression introduced in #1818. This PR adds the if (!this->dataPtr->enableSensors) check back to make sure we only create light visuals if sensors are not enabled.

This was causing segmentation camera to crash if the light visual is in its view (see gazebosim/gz-rendering#1122).

To Test:

Apply this diff below to segmentation_camera.sdf to position the directional light in the view of the segmentation camera. With the changes in this PR, gz sim should no longer crash.

diff --git a/examples/worlds/segmentation_camera.sdf b/examples/worlds/segmentation_camera.sdf
index c5f4df7de..10cf19963 100644
--- a/examples/worlds/segmentation_camera.sdf
+++ b/examples/worlds/segmentation_camera.sdf
@@ -158,7 +158,8 @@
 
     <light type="directional" name="sun">
       <cast_shadows>true</cast_shadows>
-      <pose>0 0 10 0 0 0</pose>
+      <visualize>true</visualize>
+      <pose>0 0 2 0 0 0</pose>
       <diffuse>0.8 0.8 0.8 1</diffuse>
       <specular>0.2 0.2 0.2 1</specular>

Checklist

  • Signed all commits for DCO
  • Added tests
  • 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

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


This is an automatic backport of pull request #2888 done by [Mergify](https://mergify.com).

Signed-off-by: Ian Chen <ichen@openrobotics.org>
(cherry picked from commit 6444e71)
@mergify mergify bot requested a review from iche033 as a code owner April 28, 2025 23:02
@github-actions github-actions bot added the 🏛️ ionic Gazebo Ionic label Apr 28, 2025
@iche033 iche033 merged commit 6bbf503 into gz-sim9 Apr 29, 2025
10 of 11 checks passed
@iche033 iche033 deleted the mergify/bp/gz-sim9/pr-2888 branch April 29, 2025 00:59
@github-project-automation github-project-automation bot moved this from Inbox to Done in Core development Apr 29, 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.

Segmentation camera breaks the sim when pointing at a light source

1 participant