Hi, we’d like to develop our own python-based standalone sensor calibration routine like the qGroundcontrol sensor calibrations used for the Blue Rov vehicle initializations. Can anyone point me to the relevant source code in the qGroundcontrol github repo? I’ve been through the code here but can’t find the parts pertaining to the sensor calibration routine.
The code you’ve linked to is quite old (it’s for QGC v3.2.4, we currently recommend using 4.0.5, or up to 4.1.3 if you’re building it yourself). It also has at the top of the README:
This fork is for Blue Robotics internal use only.
To look for code used in QGC it’s generally suggested to use the base qgroundcontrol repo.
In finding the relevant code, here’s the logic and steps I followed:
ArduSub is part of the ArduPilot family, so it uses the APM AutoPilot plugin (the repo folder which “is used to provide the user interface for Vehicle Setup”)
Sensor calibration will likely have files that include the word “Sensor”, so I used the ‘Go to File’ button at the top right of the github page, which takes you to the repo’s find page, and typed /APM/Sensor after qgroundcontrol to find the APM section and then find files with ‘Sensor’ in their name within that.
Looking through the options at the top, ‘Controller’ seemed like it was the most likely to be actually running commands, and since header (.h) files usually just declare functions it seemed more relevant to look at the implementation in the .cc file
I used CTRL+F to search for ‘calib’, and tabbed through those results until I found a mavlink message being sent to the autopilot board
From there you can look at how the setup is done, or potentially just look at the relevant mavlink messages. I tried searching the mavlink common message set and it seems like the relevant messages aren’t there (makes sense, since this calibration is ArduPilot specific), so I looked for ArduSub mavlink commands and couldn’t find anything specific to ArduSub, so searched for ArduPilot more generally and found the ArduPilot mavlink page, which links to the ardupilot mavlink message set, which seems to contain the messages you’re after.
Thanks for the quick responses Eliot. I’ll take a look at these messages. Also, I was hoping to find the actual source code for the routines used in the qGroundcontrol sensor calibration tabs in order to understand precisely how the sensors are being calibrated and not simply the mavlink messages being sent.
I did actually mention that file in step 3. and link you to a specific part of it in step 4., although rereading the wording now I can see why it wasn’t clear that link was to the QGC file.
If I’m understanding the QGC code correctly I think QGC sends a command to the autopilot board to run a calibration, and then the actual calibration is done by ArduSub, so the mavlink messages may end up being all you need.