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

Add support for custom sensors #652

Merged
merged 4 commits into from
Aug 10, 2021
Merged

Add support for custom sensors #652

merged 4 commits into from
Aug 10, 2021

Conversation

chapulina
Copy link
Contributor

@chapulina chapulina commented Aug 3, 2021

🎉 New feature

Part of gazebosim/gz-sensors#9

Summary

Creating custom sensors that aren't officially part of the spec shouldn't be disallowed. This PR provides a simple way for users to tell SDF that they're loading a custom sensor, so it's not an error if SDF doesn't recognize the sensor type. Note that this is different from a sensor with NONE type, which is an error.

Users are encouraged to use Custom SDF Elements to pass configuration to their custom sensors, like the ignition:custom_sensor element below:

        <sensor name="custom_sensor" type="custom" ignition:type="custom_sensor">
          <always_on>1</always_on>
          <update_rate>30</update_rate>
          <visualize>true</visualize>
          <topic>custom</topic>
          <ignition:custom_sensor>
            <noise type="gaussian">
              <mean>0.2</mean>
              <stddev>0.1</stddev>
            </noise>
          </ignition:custom_sensor>
        </sensor>

This is an initial proposal, I'm open to other ideas for supporting custom sensors.

Test it

I'm making use of this on these WIP PRs, you can try them out:

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial (downstream)
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • 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

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

Signed-off-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: Louise Poubel <louise@openrobotics.org>
@github-actions github-actions bot added the 🏯 fortress Ignition Fortress label Aug 3, 2021
@codecov-commenter
Copy link

codecov-commenter commented Aug 3, 2021

Codecov Report

Merging #652 (84b5009) into main (22a968e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #652   +/-   ##
=======================================
  Coverage   87.94%   87.94%           
=======================================
  Files          72       72           
  Lines       10891    10893    +2     
=======================================
+ Hits         9578     9580    +2     
  Misses       1313     1313           
Impacted Files Coverage Δ
src/Sensor.cc 80.35% <100.00%> (+0.17%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 22a968e...84b5009. Read the comment docs.

Copy link
Contributor

@caguero caguero left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@chapulina chapulina merged commit afdf3a5 into main Aug 10, 2021
@chapulina chapulina deleted the chapulina/12/custom_sensor branch August 10, 2021 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏯 fortress Ignition Fortress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants