Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LogicalCamera plugin to detect nested models #2788

Merged

Conversation

Dyst-0
Copy link
Contributor

@Dyst-0 Dyst-0 commented Feb 20, 2025

🎉 New feature

Closes #2786

Summary

Logical camera now detects nested models instead of top level models only.

Test it

1 - Nest a model inside box in logical_camera_sensor.sdf

Nested model example
<model name="nested_model">
  <pose>1 1 -0.25 0 0 0</pose>
  <link name="nested_model_link">
    <inertial>
      <inertia>
        <ixx>1</ixx>
        <ixy>0</ixy>
        <ixz>0</ixz>
        <iyy>1</iyy>
        <iyz>0</iyz>
        <izz>1</izz>
      </inertia>
      <mass>1.0</mass>
    </inertial>
    <collision name="nested_model_collision">
      <geometry>
        <box>
          <size>0.5 0.5 0.5</size>
        </box>
      </geometry>
    </collision>

    <visual name="nested_model_visual">
      <geometry>
        <box>
          <size>0.5 0.5 0.5</size>
        </box>
      </geometry>
      <material>
        <ambient>1 0 0 1</ambient>
        <diffuse>1 0 0 1</diffuse>
        <specular>1 0 0 1</specular>
      </material>
    </visual>
  </link>
</model>

2 - Build and source if needed
3 - Run gz sim logical_camera_sensor.sdf
4 - Run gz topic -e -t /logical_camera

The output should show information about nested_model and the top level model box

Example output
header {
  stamp {
    sec: 7
    nsec: 400000000
  }
  data {
    key: "frame_id"
    value: "logical_camera::logical_camera_link::logical_camera"
  }
  data {
    key: "seq"
    value: "74"
  }
}
pose {
  position {
    x: 0.05
    y: 0.05
    z: 0.55
  }
  orientation {
    w: 1
  }
}
model {
  name: "box"
  pose {
    position {
      x: 0.95
      y: -0.05
      z: -0.042601271917138139
    }
    orientation {
      x: -1.1646185111097245e-18
      y: 1.154466086086657e-18
      z: 4.9495694579132863e-21
      w: 1
    }
  }
}
model {
  name: "nested_model"
  pose {
    position {
      x: 1.95
      y: 0.95
      z: -0.2926012039375952
    }
    orientation {
      x: 8.2961203174114e-19
      y: 1.3937209219279395e-18
      z: -2.2681468773043784e-20
      w: 1
    }
  }
}

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

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.

Signed-off-by: Dyst-0 <69257845+Dyst-0@users.noreply.github.com>
@Dyst-0 Dyst-0 requested a review from mjcarroll as a code owner February 20, 2025 00:38
@github-actions github-actions bot added the 🏛️ ionic Gazebo Ionic label Feb 20, 2025
@iche033 iche033 enabled auto-merge (squash) February 21, 2025 23:09
@iche033 iche033 merged commit 036515f into gazebosim:gz-sim9 Feb 22, 2025
11 checks passed
@Dyst-0
Copy link
Contributor Author

Dyst-0 commented Feb 23, 2025

@iche033 Can we backport this to gz-sim8?

@Dyst-0 Dyst-0 deleted the logical-camera-detect-nested-models-feature branch February 24, 2025 17:15
@iche033
Copy link
Contributor

iche033 commented Feb 27, 2025

@Mergifyio backport gz-sim9

Copy link
Contributor

mergify bot commented Feb 27, 2025

backport gz-sim9

✅ Backports have been created

  • Backport to branch gz-sim9 not needed, change already in branch gz-sim9

@iche033
Copy link
Contributor

iche033 commented Feb 27, 2025

@Mergifyio backport gz-sim8

Copy link
Contributor

mergify bot commented Feb 27, 2025

backport gz-sim8

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Feb 27, 2025
Signed-off-by: Dyst-0 <69257845+Dyst-0@users.noreply.github.com>
Signed-off-by: Ian Chen <ichen@openrobotics.org>
Co-authored-by: Ian Chen <ichen@openrobotics.org>
(cherry picked from commit 036515f)
ahcorde pushed a commit that referenced this pull request Feb 27, 2025
Signed-off-by: Dyst-0 <69257845+Dyst-0@users.noreply.github.com>
Signed-off-by: Ian Chen <ichen@openrobotics.org>
Co-authored-by: Ian Chen <ichen@openrobotics.org>
(cherry picked from commit 036515f)

Co-authored-by: Dyst-0 <69257845+Dyst-0@users.noreply.github.com>
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.

LogicalCamera plugin to detect nested models
2 participants