3.1.3 Compassmot Pixhawk works?

Or still the Nan issue?

I’d like to run compassmot but don’t want the Nan values issue. The issue was closed / fixed a while ago in Master. Is the fix implemented in 3.1.3 (Says nothing about it on changelog).


Yes, would be good to know!

I had a response to one of my postings indicating that compassmot on pixhawk was fixed in “master”. So I rebuilt the firmware from the “master” repository on github and loaded the compiled firmware to my pixhawk. However, when I enter the terminal area it indicates “arducopter 3.1.2 dev” as the version and when I go to the setup menu, compassmot is not a recognized command.

Looking at the code in master, I can see the fix in the AP_Compass_PX4.cpp on line 95:

    // avoid division by zero if we haven't received any mag reports
    if (_count[i] == 0) continue;

but when I check the arducopter 3.1.2 github repository, the AP_Compass_PX4.cpp is vastly different and does not contain any reference to the division by zero fix.

Perhaps someone can chime in here to let us know what it means when someone has closed this issue by “pushing the fix to master”… and how do we rebuild the current release but with the (which?) updated AP_Compass_PX4.cpp to fix the division by zero nan compassmot issue?

I realize that we could simply wait until it makes its way into the next release but since the fix was “completed” before 3.1.3 came out, and it didn’t make it in that release, perhaps its not in the main branch and needs to be addressed.

Hopefully the gurus out there can chime in on this…


Hi, on git master, a number of CLI features have been disabled so that the thing will fit on APM. We’re eliminating the CLI in favor of mavlink commands. Latest MP should be able to send the mavlink command, but I use mavproxy so I don’t know.

Randy made the decision to release 3.1.3 with my bug fix only. I’ve already asked him to include the compassmot fix in 3.1.4 if there is a 3.1.4.

Additionally, I am working on learning the compassmot compensation on the fly. I have a very simple algorithm that works quite well.

Thanks Jonathan, I’ll try building git master again and use the MP mavlink command to run it.

…on-the-fly compassmot would be awesome - maybe add it to the autotune routine!


I’m thinking the algorithm would be robust enough to always run. In this way, it would learn shifts in the wiring and such (which happens every time you change a battery, really).

I’ve just upgraded to the 3.1.4 - but i’m scared to do another compossmot as the last one messed my artificial horizon. I had to do a erase eeprom and then load all my params again.

Did the 3.1.4 fix the compassmot error ?

kind regards,

I tried compassmot on 3.1.4 and it has same problem:
“Nan” values and crazy HUD.

Ciao - Giuseppe

taa daa…

APMcopter 3.1.5 rc1 (compassmot should works now)

github.com/diydrones/ardupilot/ … eNotes.txt

Ciao - Giuseppe

My first compassmot on Pixhawk with 3.1.5 rc1 version:

Ciao - Giuseppe