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

Magnetometer not taking into account the initial global heading #425

Open
5p00kk opened this issue Apr 9, 2024 · 1 comment
Open

Magnetometer not taking into account the initial global heading #425

5p00kk opened this issue Apr 9, 2024 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@5p00kk
Copy link

5p00kk commented Apr 9, 2024

The magnetometer sensor/system ignores the initial heading set from spherical coordinates.

As seen in the lines below the world frame magnetic field vector is rotated from the world frame into local frame, however the spherical coordinates also hold information about the heading of the world coordinate system in regards to NED/ENU. The initial heading is not taken into account:

https://github.com/gazebosim/gz-sensors/blob/27239b4ac9877d87273a18010a307172899dd7a6/src/MagnetometerSensor.cc#L162C3-L166C1

This is incorrect and not consistent with the approach taken for the IMU sensor, where the system checks the initial heading and passes it to the sensor to take it into account. The issue makes it impossible to sync align and magnetometer sensors if the world coordinate heading is non-zero:
https://github.com/gazebosim/gz-sim/blob/c158287d6f8556112d86d6e4188c39784364bd40/src/systems/imu/Imu.cc#L228C2-L248C4

It seems like an issue that would require changes in both: gz-sim (system) and gz-sensor (sensor) side if following the approach taken for the IMU sensor.

@5p00kk 5p00kk added the bug Something isn't working label Apr 9, 2024
@azeey azeey added the help wanted Extra attention is needed label Jul 15, 2024
@azeey
Copy link
Contributor

azeey commented Jul 15, 2024

Thanks @5p00kk. I've added the "help wanted" tag on this. Let me know if you'd like to work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants