Skip to content
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

Closed
wants to merge 6 commits into from
Closed

Compass Per-Motor Calibration #7619

wants to merge 6 commits into from

Conversation

JulioCesarMatias
Copy link
Collaborator

@JulioCesarMatias JulioCesarMatias commented Nov 21, 2021

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 correction

permotor_x : Magnetometer X offset calced by per-motor

permotor_y : Magnetometer Y offset calced by per-motor

permotor_z : Magnetometer Z offset calced by per-motor

First: Configure the mode,and active
Mode

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
Motors

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

@JulioCesarMatias
Copy link
Collaborator Author

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

@JulioCesarMatias
Copy link
Collaborator Author

This feature only works with quadcopters. Not functional with frames with more than 4 engines or fixed-wing aircraft

@erstec
Copy link
Collaborator

erstec commented Nov 21, 2021

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

It is not 'disadvantage' but absolutely 'stopper'.
Running all four quad motors at 80% throttle for 10 seconds, holding quad somehow to prevent it fly straight your hands and, probably, face... It is hard to imagine how Pawel will introduce this improvement to audience :D

@JulioCesarMatias
Copy link
Collaborator Author

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

It is not 'disadvantage' but absolutely 'stopper'. Running all four quad motors at 80% throttle for 10 seconds, holding quad somehow to prevent it fly straight your hands and, probably, face... It is hard to imagine how Pawel will introduce this improvement to audience :D

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.

@MrD-RC
Copy link
Collaborator

MrD-RC commented Nov 22, 2021

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.

@avsaase
Copy link
Member

avsaase commented Nov 23, 2021

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).

@erstec
Copy link
Collaborator

erstec commented Nov 23, 2021

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 :)
SAFETY SUGGESTION: It will be more safe to monitor Z-axis acceleration and turn all motors off if it passes some threshold.

@MrD-RC
Copy link
Collaborator

MrD-RC commented Nov 23, 2021

@MrD-RC didn't we once discuss adding your current calibration procedure to the configurator? That also requires spinning up the motor(s).

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.

@brainbubblersbest
Copy link

brainbubblersbest commented Nov 26, 2021

why not just calibrating "inflight" and allow this only to do in manual mode?
Flying straight into one direction for 10 seconds at almost full throttle should be doable.
Show a 10sec countdown in osd and a mag compcal success message at the end.

@JulioCesarMatias
Copy link
Collaborator Author

JulioCesarMatias commented Jan 9, 2022

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

@brainbubblersbest
Copy link

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?
If you make measurement All the time + the quad moved straight into one direction at almost full throttle = apply measured values. Shouldnt multiple dampened measurements lead to an more accurate calibration?
Like every Smartphone does it automatically These Days?

@devMorpheus
Copy link

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

It is not 'disadvantage' but absolutely 'stopper'. Running all four quad motors at 80% throttle for 10 seconds, holding quad somehow to prevent it fly straight your hands and, probably, face... It is hard to imagine how Pawel will introduce this improvement to audience :D

Why somehow hold the quad if you can just put the propellers upside down and it will press itself to the ground?

@erstec
Copy link
Collaborator

erstec commented Jan 31, 2022

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

It is not 'disadvantage' but absolutely 'stopper'. Running all four quad motors at 80% throttle for 10 seconds, holding quad somehow to prevent it fly straight your hands and, probably, face... It is hard to imagine how Pawel will introduce this improvement to audience :D

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.

@brainbubblersbest
Copy link

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

It is not 'disadvantage' but absolutely 'stopper'. Running all four quad motors at 80% throttle for 10 seconds, holding quad somehow to prevent it fly straight your hands and, probably, face... It is hard to imagine how Pawel will introduce this improvement to audience :D

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.

@sdellava
Copy link
Contributor

I've already submitted a PR for "infligth mag calibration". It is waiting to merge: #9411

@JulioCesarMatias
Copy link
Collaborator Author

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...

@sdellava
Copy link
Contributor

I've already submitted a PR for "infligth mag calibration". It is waiting to merge: #9411

... The proposal here was to add a feature to tune the compass based on the noise caused by the motors' current consumption. ...

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.

@JulioCesarMatias
Copy link
Collaborator Author

I've already submitted a PR for "infligth mag calibration". It is waiting to merge: #9411

... The proposal here was to add a feature to tune the compass based on the noise caused by the motors' current consumption. ...

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.

@sdellava
Copy link
Contributor

sdellava commented May 6, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants