Custom yaw rotation of extrernal magnetometer

due to hardware issues on our aircraft, we must have external magnetometer mounted in “non-standard” rotation. PX4 board is orientated in flight direction. Is there some possibility to change the rotation only of external magnetometer?

I have found the parameter SENS_BOARD_Z but it is the rotation of autopilot board.

The internal magnetometer is unusable for us because we have a strong magnet near to autopilot.

Thank you!

You need to find out what the ID of the mag is in PX4. Once you know if it is 0 or 1 you should be able to change the orientation with the param CAL_MAG0_ROT or CAL_MAG1_ROT.

1 Like

Thanks for answer @JulianOes. And sorry for my late answer. I wasn’t able to check if it is usable solution for us until yesterday.

And it isn’t. We need to set YAW rotation of external magnetometr in degrees. Because our magnetometr board is (due to technical issues) rotated 30 degrees away from the X axis of aircraft.

And parameter CAL_MAG1_ROT supports some index values with describes preset angles.

Ok, I guess you need to make your own changes to support this then. You could just jump into the driver for your mag and see where the rotation gets applied and replace it with what you need.