gazebosim / gz-sim

Open source robotics simulator. The latest version of Gazebo.
https://gazebosim.org
Apache License 2.0
621 stars 251 forks source link

Add magnetometer plugin parameter to publish units as tesla #2336

Open gilborty opened 3 months ago

gilborty commented 3 months ago

🦟 Bug fix

Fixes #2312

Summary

As mentioned in #2312, the magnetic field message is incorrectly using Gauss as the units for the field strength, rather than the SI unit of teslas.

This PR adds a flag, use_tesla_for_magnetic_field, to the MagnetometerSystem to enable this fix as to not break any existing functionality that assumes Gauss. It also adds the Configure step to the MagnetometerSystem.

While I was here, I noticed that the integration test doesn't actually update the MagnetometerSystem because the SphericalCoorindates are not set. I think this might be an oversight. I did not change that existing test in case it was like that on purpose.

Checklist

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.

gilborty commented 3 months ago

Thank you for the review @ahcorde, I think I updated everything you asked for. Thank you for the helper function point out as well!

gilborty commented 3 months ago

Are the INTEGRATION_triggered_publisher tests failing on CI for anyone else? Mine are passing locally, I don't think it is related to this commit.

[       OK ] TriggeredPublisherTest.StringMsgReqBooleanRep (1053 ms)
[----------] 23 tests from TriggeredPublisherTest (13137 ms total)

[----------] Global test environment tear-down
[==========] 23 tests from 1 test suite ran. (13137 ms total)
[  PASSED  ] 23 tests.