I am having an issue getting the Compass to Calibrate on version 4 when I am the copter a message appears on the ground station telling me the compass is not calibrated. The Copter is running on a Pixhawk 4 and Here GPS.
I have tried several version versions of the Developer edition and could never get the compass to calibrate. Each time I do the calibration the values are almost the same. When I load the previous version of copter everything works fine.
My guess is that the the automatic orientation detection may not be able to determine which direction the compass is pointing. Can you try setting COMPASS_AUTO_ROT = 0?
You’ve probably heard it before but a dataflash log would help figure out the cause.
I also having issues with compass calibration I had to set the lower settings to pass.
Set COMPASS_AUTO_ROT = 0 and Recalibrated the Accelerometer and Compass and still get the compass calibtation error.
One thing I did notice is the compass is moving around at random
You can find a log file at
It looks like this flight controller only has internal compasses so it might be important to ensure there is enough clearance from other metal bits including power wires and ESCs. There is a persistent little wobble in the X and Y axis readings which could be external interference.
Changing these parameters may help:
COMPASS_CAL_FIT = 32 or even 64 (was 16)
COMPASS_OFFS_MAX = 1800 (was 850)
By the way, when you do an upgrade are you backing up and then copying-over the parameter values? If “yes” then in general this is not required and can be counter productive if we modify the defaults for parameters which is what we’ve done for the COMPASS_OFFS_MAX.
The copter has an external compass (Here GPS) which I thought was configured to use the external Compass.
I do take backups of everthing before doing an update incase I want to roll back, in the case of this update just loaded the frimware and calibrated the compass
I also swapped the compass to a new HERE 2 CAN which I switch over to use Serial and I2C did a compass calibtation the copter is now flying with no issues.
Param File from a Month back for reference
2019-10-28 09-20-34.log.param (19.2 KB)
Original GPS with Copter 4 firmware (Here GPS)
2019-10-28 09-28-11.log.param (19.2 KB)
New GPS with copter 4 firmware (Here 2 GPS CAN)
2019-10-29 10-06-06.log (Here 2 CAN).param (19.2 KB)
Log file from Here 2 GPS CAN
Is there any particular reason/problem why you don’t use Here2 on CAN bus?
4.0 supports canbus auto id assignment so it should really be easy to use.
The CAN GPS is not mine just borrowed
Edit: I misunderstood and fully agree with Randy
@quadsours, taking a backup of the params is a good idea, but then blindly applying that old parameter file after an upgrade is not necessary and is not a good idea. As mentioned above, we take great care to ensure that parameters are upgraded as part of the firmware upgrade process. Sometimes we make changes to a parameter’s default value but if the user then uploads an entire old parameter file that change is reverted to the old value.
Ok got it i must of not understood what you were saying, in the old days we call this Vanilla starting new.
I backup but never copy a old config on a vanilla one. sorry for the confusion.
With the original compass back on the copter, Compass calibration performed and the parameters adjusted I am still getting the Compass Calibration error.
On your screenshot you show the graph for Mag2 on my setup I am using Mag1 as the external compass. On the cube is Mag1 not the external compass
Enclosed is a link to the log file and parameter file.
Is there a list of default parameters for version 4 so as you could do a compare within mission planner
Re comparing with the default parameters, we don’t have an easily accessible list of parameter defaults partially because the parameters are different for different boards and vehicle types. I suppose we could do it but it wouldn’t be one list but many. The way I do a comparison is use the simulator built into mission planner and make sure the “wipe” checkbox is checked. Then go to the full param screen and push the “compare params” button and select the real vehicle’s parameter list.
You could try relaxing the calibration limits a bit more as well to see if it helps:
COMPASS_CAL_FIT = 64
COMPASS_OFFS_MAX = 3000
It might also be good to remove the compass and flight controller and calibrate the compasses separately to see if that works. If it does then there’s some kind of interference from the frame.
After changing the COMPASS_CAL_FIT and COMPASS_OFFS_MAX as suggested by @rmackay9 while doing a test using the last suggested values I noted the vehicle was always pointing North when booted.and connected to mission planner.
I have access to 2 other compasses and did 2 test flights with each one
Test 1 Vehicle booted pointing South
Test 2 Vehicle booted pointing North
Compass was calibrated after each change and the vehicle was booted in the same location.
Compass 1 Here GPS
Compass 2 Here GPS
Compass 3 Here2 GPS
Compass 1 and the Vehicle pointing south it would not arm saying the Compass was not calibrated. On mission planner the vehicle is shown pointing north.
Compass 1 and the Vehicle pointing north it booted and armed correctly
The following test with Compass 2 and 3 all worked as expected. With mission planner showing the vehicle pointing in the correct direction
The only difference i know between the 2 Here GPS units was compass 1 was purchased from 3DXR in the UK when they where first released ,Compass 2 was purchased about a year later and Compass 3 was purchased in July of this year.
Below is a link to all the test logs
If the heading is appearing north but the vehicle is not actually pointing north then this means that the compass is not working at all.
I’ve had a look at the logs especially at the COMPASS_DEV_IDx parameters which show which compasses have been detected. Mission Planner displays these in a somewhat user friendly manner on the Initial Setup / Mandatory Hardware/ HW ID page so you can also check these yourself in real-time.
In the Compass1/Test1 log, compass1 is an HMC compass. It’s missing from Test2 though which I think means there is a hardware issue, perhaps the cable or connector is bad or something else.
COMPASS_DEV_ID,466441 <- HMC compass
In the Compass2 logs only the internal compasses appear so again I think there’s a hardware issue:
In the Compass3 logs we reliably see an AK09916 so this one appears to be working OK.
COMPASS_DEV_ID,592905 <-- AK09916 compass
So I think there’s a hardware problem with Compass1 and 2. I’m not aware of anything that we would have changed in the software to make these less reliable but you could try going back to Copter-3.6.11 and see if there’s any difference in which COMPASS_DEV_IDx values appear. When testing it might be good to check at least a couple of times because if it is a connector or wire problem it might work some times but not others.
Compass Calibration Update
Following an offline discussion with @rmackay9 over the last few days we concluded the compass issue was caused by a timing issue where the flight controller was booting faster than the compass. The solution was to set a BRD_BOOT_DELAY of 1000 in my case this works for a Cube black with a non edison carrier board but takes a delay of 2000ms for the edison carrier board.
some of the Symptoms are
Vehicle worked correctly when running version 3.6.11 or below.
Flight controller boots and the compass is pointing North even if the vehicle is not.
Compass Calibration errors when arming the vehicle.
Compass looks correct on the bench when plugged into USB.
COMPASS_DEV_ID is incorrect.
I have exactly the same problem (here plus gps module, cube black)
set BRD_BOOT_DELAY to 400, 1000, 2000, even 5000 do not solve this problem
I have to set COMPASS_TYPEMASK to 33 to disable HMC5883 and adjust COMPASS_PRIOx_ID
Do the COMPASS_PRIOx params help with the compass bootup detection for Here2s? A BRD_BOOT_DELAY of 5000 isn’t working consistently for us either unfortunately.
In my case. COMPASS_DEV_ID 466441 (HMC5883) is not working. So I adjust COMPASS_PRIOx_ID to avoid use it. In my understanding. COMPASS_PRIOx_ID choose which 3 compass to use in COMPASS_USEx