# Starling 2 - Mag Alignment

Source: https://forum.modalai.com/topic/5346/starling-2-mag-alignment
Category: General Questions (https://forum.modalai.com/category/2/general-questions)
Posted: 2026-07-24 20:18:05 UTC by rozner88
Replies: 3 · Views: 133

## rozner88 · 2026-07-24 20:18:05 UTC

Every time I restart px4 on the Starling v2, my heading is off by 90 degrees.  To troubleshoot, I turned off External Vision in PX4 parameters, and use mag for heading.  This did not fix the heading issue.  I can manually fly in Position control without any "toilet bowling" or control issues, but during Auto Missions the vehicle initially doesn't fly as expected.  I planned a Mission with a takeoff, two waypoints, and landing.  On takeoff and initial transit to the first waypoint the vehicle drifts around a lot. I see resetQuatStateYaw warnings in flight and then it starts to fly better.  In flight the heading adjusts to point the correct direction.  I've tried doing mag calibrations, and that didn't help.  After rebooting PX4, the heading starts off by 90 degrees again.

Here is an example log
https://review.px4.io/plot_app?log=2a1c9b0e-6b82-456e-8808-fe8a18a9dde8

Is Mag0 ROT = 0 correct?  Should it be rotated 90?  I know there are documented GPS issues, and the Mag/GPS are mounted together.  Is this a related issue?

## Reply by Eric Katzfey (ModalAI staff) · 2026-07-24 21:58:14 UTC

What is CAL_MAG0_ROT set to, 0? You can try to set it to 2 (yaw 90) or 6 (yaw 270) and see if that helps the situation.

## Reply by rozner88 · 2026-07-27 15:22:59 UTC (in reply to Eric Katzfey)

@Eric-Katzfey CAL_MAG0_ROT yaw 90 worked.  Why isn't that the default parameter on the starling?  Are some of the GPS/mag boards different?

## Reply by Eric Katzfey (ModalAI staff) · 2026-07-27 15:33:44 UTC

That'a a calibration parameter that is set automatically by the mag calibration procedure. Normally it should properly detect the orientation / rotation and set it. I'm not sure why that wasn't happening for you when you calibrated the mag.
