-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compass Per-Motor Calibration #7619
Compass Per-Motor Calibration #7619
Conversation
the biggest disadvantage is that this calibration is not done in flight, but on the ground... and keeping the quadcopter on the ground with the propellers connected is quite dangerous, the lay user can get hurt with the calibration process |
This feature only works with quadcopters. Not functional with frames with more than 4 engines or fixed-wing aircraft |
It is not 'disadvantage' but absolutely 'stopper'. |
This type of calibration is done on the ArduPilot, and it's basically the same way, revving the engines and keeping the UAV stuck somewhere to avoid climbing. My part was done, now if it will be merged I don't know, but the PR is there for discussion. |
I completely agree with @erstec. Having the props spinning at high throttle on the bench to do this is pretty dangerous. Just because its how ArduPilot does it, doesn’t mean its right. |
I actually think a procedure such as this one is fine as long as there are clear warnings of the potential danger. The only question for me is if it actually works. If it does then this adds a lot of flexibility in choosing where to mount the magnetometer. @MrD-RC didn't we once discuss adding your current calibration procedure to the configurator? That also requires spinning up the motor(s). |
It should be VERY clear warning, I hope, with need to accept it (press some buton) at least twice. And very clear explanation of what will happens :) |
Sure. But with fixed wing the motor is much further away, and you have more places to hold the plane pretty tightly. It’s not quite the same with multi-rotors. If the current calibration is performed on a multi-rotor. I’d always recommend swapping the props to the other side, and turn them upside down. Then the motors are pulling the quad to the desk. |
why not just calibrating "inflight" and allow this only to do in manual mode? |
ok, two good suggestions made. 1 - It will be more safe to monitor Z-axis acceleration and turn all motors off if it passes some threshold(@erstec). 2 - Flying straight into one direction for 10 seconds at almost full throttle should be doable(@brainbubblersbest). I believe that this PR will not be approved, but I will leave it noted |
What about Auto calibration? |
Why somehow hold the quad if you can just put the propellers upside down and it will press itself to the ground? |
Unfortunately physics not work like that, unless quad is very heavy. Inconsistency in airflows of every motor/prop or just some kind of vibration will lead quad to try make overturn. |
This. With dshot the need for wrong mounting would be obsolete by fire all 4 Motors in reverse Direction. So my thought here would be still to Do it inflight. Cant be easier from a User Perspektive. Every Smartphone These Days does that when its in motion. |
I've already submitted a PR for "infligth mag calibration". It is waiting to merge: #9411 |
This PR of mine is closed, and the proposal here was different from what you proposed in your PR. The proposal here was to add a feature to tune the compass based on the noise caused by the motors' current consumption. But, some things are difficult to take forward in INAV... |
I understand that the proposal is different, but the effect should be very similar: calibrating the mag in flight, of course, take in cosideration the ESC current too. |
Calibration requires all engines to reach Full Throttle at the same time, this will not be possible in flight due to PID controller corrections. And also, there is a minimum time for the calibration to work, your multirotor will shoot upwards like a rocket for at least 10 seconds, so I don't think this is viable... The only viable option was the one I proposed to 2 years ago, use the engine test control on the "Mixer" tab and hold the multirotor with your hands or find a way to fix it. But the idea was accepted, so for that reason the PR was closed. |
@JulioCesarMatias I invite you to test the PR I've sumbitted. I'm using it and it works. You can see the YT video too. I guess the point here is not if you are right or wrong. You are right, but calibrating at land level produce worst results than calibrating while flight and doing some monouvers. That for sure not the best result, but the better we can acheive now. |
This feature will solve the problem for most people who have the Mag too close to all frame wiring. It's actually a calibration, I put it as a configurable mode, activated by an auxiliary channel, and called it "Compass Per-Mode". To start the calibration, the user will first activate the "Compass Per-Motor" mode through an auxiliary channel on the radio, then go to the tab labeled "Outputs" and activate the "Motor Test", and put the speed of the engines between 65 ~ 80% (sufficient speed to cause a high current in the motors' wiring, and cause a "surge" in the Mag readings), and let the calibration run until it's over (It automatically shuts off after 10 seconds)... And of course, the propellers must be connected to the motors for the high current draw to occur. Shortly thereafter, the offset will be calculated and applied to the final Mag readings.
CLI:
permotor_expo
: This is the exponential correction for the power output of the motor for per-motor compass correctionpermotor_x
: Magnetometer X offset calced by per-motorpermotor_y
: Magnetometer Y offset calced by per-motorpermotor_z
: Magnetometer Z offset calced by per-motorFirst: Configure the mode,and active

Second: Set engines to +/- 80% of Throttle using the "Output" tab and with the propelers connected (of course), wait 10 seconds for the calibration to finish

Third: run the "get permotor" command in the CLI, and see the calculated XYZ offset values for the mag
