Skip to content

Added LedPlugin system for simulating LEDs/Indicators#3353

Open
jasmeet0915 wants to merge 18 commits intogazebosim:gz-sim10from
jasmeet0915:jasmeet/led_plugin_v2
Open

Added LedPlugin system for simulating LEDs/Indicators#3353
jasmeet0915 wants to merge 18 commits intogazebosim:gz-sim10from
jasmeet0915:jasmeet/led_plugin_v2

Conversation

@jasmeet0915
Copy link
Contributor

🎉 New feature

Closes #3245

Summary

gazebo_led_plugin_demo_final-2025-12-28_23.24.45.mp4
  • The plugins allows a user to define an LED using a visual, a light, or both via the <led> element (see example snippet below). Internally the plugin uses the names from the <visual_name> and <light_name> elements with the entitiesFromScopedName() function to get their respective entities
  <!-- LED Descriptions -->
  <led name="emergency_led">
    <visual_name>lamp_red::lamp_red_visual</visual_name> <!-- scoped name of the visual -->
    <light_name>lamp_red::emergency_light</light_name> <!-- scoped name of the visual -->
    <default_state>
      <color>0.3 0.0 0.0 1</color>
      <intensity>0.0</intensity>
    </default_state>
  </led>
  • The plugin allows a user to describe different named <mode> in the SDF each of which can contain a bunch of <step> that describes the state of the mode's <active_leds> during that step in terms of <color>, <on_time> and <intensity>. The plugin applies the different steps of a mode sequentially to the required LEDs in PreUpdate():
  <mode name="ready">
    <active_leds>
      <led>ready_led</led>
    </active_leds>
    <step always_on="false">
      <color>0.0 1.0 0.0 1</color>
      <intensity>2.0</intensity>
      <on_time>1.0</on_time>
    </step>
    <step always_on="false">
      <color>0.0 0.3 0.0 1</color>
      <intensity>0.0</intensity>
      <on_time>1.0</on_time>
    </step>
  </mode>
  • A change_mode service is advertised by the plugin namespaced with the <led_group_name> or the model name if no LED group name is provided. This service can be requested to trigger a mode change by passing the string name of the required mode.
  • The plugin uses the VisualCmd and LightCmd components of the associated visual and light entities of the defined LEDs to set the required color and intensity (intensity is only for light).

Test it

The plugin can be tested with the example world added with this PR (video attached above):

gz sim examples/worlds/led_plugin.sdf

Checklist

  • Signed all commits for DCO
  • Added a screen capture or video to the PR description that demonstrates the feature
  • 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)
  • Updated Bazel files (if adding new files). Created an issue otherwise.
  • 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.

Backports: If this is a backport, please use Rebase and Merge instead.

Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
…vice

Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
…ponent

Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
…xample world robot

Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🪵 jetty Gazebo Jetty

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

A plugin to simulate LEDs or Indicators

1 participant