I know this is a strange way to mount the compass (the unit behind/to the right of the battery in the photo - Walksnail GPS/Compass), but I’m trying it for now until I potentially move it to the front of the copter. I have seen things about manually defining parameters for how the compass is oriented, but am confused by those options and repeatedly get errors like Mag(0) bad orientation: 6/36 1.0 when trying to auto-configure/calibrate the compass the typical way through Mission Planner. Should I use the COMPASS_ORIENT or CUST_ROT_ENABLE params to allow me to mount the compass this way? Are these values in reference to the front of the copter? All I’ve found so far in the wiki is a section here that seems like it might be applicable. Advanced Compass Setup — Copter documentation Am I missing something important? Thanks in advance!
I also have an angled Walksnail M181 GPS similar to your setup on a Rekon 5. Here is what I did with good results and I was able to replicate.
First, I mounted GPS as I wanted it on the frame and set COMPASS_ORIENT to 0. Then I did the calibration in Setup > Compass > Onboard Mag Calibration. Mission Planner then set my COMPASS_ORIENT to 6 (Yaw270). Did a full power cycle of the FC. It was still not locking onto the correct bearings.
Then I set COMPASS_ORIENT to 101 (Custom 1). I’m using ArduCopter v4.5.7. To determine the angle of my GPS, I went into the Data screen and in the HUD, angled my frame until the GPS antenna plane was parallel to the ground. This helped me find the angle of the GPS mount (mine is 35 degrees down pitch). I then subtracted that from 360 degrees pitch, giving me 325 degrees. In the CUST_ROT1_PITCH value, I entered 325 as the value. The rest of the CUST_ROT1* values are all 0 degrees. Power cycled FC again. Still the wrong bearings.
Finally I enabled COMPASS_LEARN and set it to 3. Now it was locked onto the right bearings regardless of pitch. Long story short, I think the COMPASS_LEARN parameter is what did it for me, as putting COMPASS_ORIENT back to YAW270 had no negative effect. I haven’t done enough test scenarios or haven’t flown it yet, so take care when trying this yourself.
Try to mount it horizontally. Onboard Mag Calibration has a problem if it does not align with the IMU. MagFit Tool can work with orientations of 45deg.
I run that M181 on a ZOHD Drift and after removing the hatch magnets it did calibrate without problems to yaw90. Couple of MagFits later error is 30-40mGaus, not sure if that’s a good value but I had no issues with it.
I was dedicated to getting this working and after 3D printing a flat GPS mount, I am no longer having compass issues. I would guess that Ardupilot has issues with ~45 degree angle differences from the FC’s IMU. This seemed to be implied in the Orientation section here: Advanced Compass Setup — Copter documentation
For me the fix is to use a GPS mount with a parallel plane to the FC as @menshel suggests. Good luck.
You’re welcome. I’d be interested in the gps performance, I get 16-20 sats on a clear day in central europe after 10min of flight, even more after 20-30min.