Closed hamishwillee closed 4 months ago
During the mag calibration, the autopilot attempts to find the orientation of the external magnetometer using the internal one. The algorithm can only find rotations that are multiples of 45 degrees (e.g.: if the real orientation is yaw = 22.5deg, the algorithm will either converge on 0 or 45 degrees). The user should ideally verify the detected rotation.
If the rotation is not part of the "standard set", one can set CAL_MAGx_ROLL/PITCH/YAW
to a custom value (using yaw-pitch-roll intrinsic Euler angles). When doing this, CAL_MAGx_ROT
is automatically set to "custom euler angle".
No flaws found
Thanks @bresch @sfuhrer - this has been updated appropriately (and I am happy with it). But happy for a follow on review from you guys :-)
Note that I checked that setting a custom rotation does NOT disable the auto mag detection. It probably should. My reasoning is that if you set the values then compass calibrate, presumably the values will be reset to (incorrect) 45C multiple angles.
This removes a note from the compass mounting docs stating that you have to use the supported orientations.
The orientations can now be tuned by setting
CAL_MAGn_ROT
to the "Custom Euler Angle" option and then setting the orientation usingCAL_MAGn_ROLL
,CAL_MAGn_PITCH
,CAL_MAGn_YAW
to set the actual orientation.This is draft because it is not clear WHEN you would need to do this. Specifically compass tuning will automatically select the right "standard"
CAL_MAGn_ROT
during calibration, but it isn't clear whether it will recognise that the standard setting is wrong, and try setCAL_MAGn_ROT
to the "Custom Euler Angle" and the other values for you?It might be that if you know the values are not right you have to set them yourself. Or that you set to the closest normal rotation and then tune.
Can you confirm the right process @bresch or @sfuhrer ?
EDIT NOte, I see that @sfuhrer has partially answered in https://github.com/PX4/PX4-user_guide/pull/3068#discussion_r1515759817 :
So that indicates, but does not "confirm" that if you want a custom euler angle you need to set it explicitly - right?