I am curious as to whether it would be possible to make the per-motor calibration procedure used by the SkyViper accessible to normal users. I have looked through the code and seen that this calibration is enabled in motor_test.cpp where motor_test_throttle_type is set to MOTOR_TEST_COMPASS_CAL, but I can’t seem to find the declaration of this enum in the mavlink docs. If I understand correctly, what I would have to do to initiate this calibration is send a mavlink command mavlink_motor_test_start() with the throttle_type uint_8 set to the right value and it will perform the test, saving the updated per-motor compass corrections.
Is this accurate?
Will this functionality be added to Mission Planner any time soon?
Thanks! I was actually able to find the enum I was looking for in Mavlink 2.3. I was able to initiate the calibration by connecting through mavproxy and running:
motortest 1 3 40 5 4
This spins up each motor in sequence per the MAV_CMD_DO_MOTOR_TEST definition.
It would be helpful to add this to the wiki though. Let me know if I can help by adding it.
@tridge I was reading through AP_Compass_Backend.cpp and wanted to confirm that the intended functionality is to prefer use of per-motor calibration over compass-motor calibration. If that is true, performing a compass-mot calibration is pointless if one is has enabled the per-motor compass calibration.
The comment also says “only valid for first compass.” I would like to use my external compass with the per-motor calibration. How would I go about configuring this compass to be used with per-motor calibration?
Hi I’ll share here some things I had to guess to use this nice functionality, with MAVProxy it’s quite simple.
The drone needs to be secured like for compass motor with props able to spin.
To start a per motor calibration in the mavproxy command line you can type (this will immediately arm the motors in sequence):
motortest 1 3 10 5 4
The parameters to keep an eye on are the 3rd and the 4th which are throttle % and sampling time in seconds (the above will run the motors at 10% for 5 seconds each).
If you have more than 4 motors you can change the last parameter, but I don’t know if it’s supported because I can only see parameters for 4 motors.
In my case it worked to just run it at 100% throttle for 10 seconds.
When the procedure ends it automatically saves the offsets per motor in COMPASS_PMOT*_* parameters and enables this calibration with COMPASS_PMOT_EN = 1 (which disables standard compass mot offsets).
Another parameter to set manually is COMPASS_PMOT_EXP which defaults to 0.65 and is not set by the motor test procedure.
This exp is used in this formula to map the correction of each motor on its thrust (from 0 to 1):
To calculate this expo I sampled each motor at various throttle percentages (25% - 50% - 75% - 100%) and then I tried to fit an exponential curve to those samples (in particular to the Z axis ones, starting from the motor with the biggest offset).