Hi,

Two days ago I uploaded an improved gyro/accelerometer calibration code to the Pirates's thread (http://www.rcgroups.com/forums/showpost.php?p=17455791&postcoun...).  This code makes sure the platform is stable while measuring the gyros' rest point.  It also makes sure that the gyro and accelerometer readings are within reasonable range, so you don't try to fly with faulty h/w.  The code, by the way, is based on my own CaspiQuad project where I have successfully used this algorithm.

I now looked at how it's done for the ArduCopterMega, and I see that the code there (though implemented differently than the Pirates' code) does not have the functionality I mentioned above.  I therefore suggest that it will be added.

Why is this important?  Because calibration happens after power up.  I, for example, connect the battery with the quad positioned upside-down, so the calibration took place at the same time I flipped it to put it on its legs - no a good idea at all!

By the way, I suggest moving the calibration to the main loop, immediately before enabling the motors.  That is a much better time to do it.

Dror

 

Views: 412

Reply to This

Replies to This Discussion

hmm,

that would explain a few 'side-effects' i noticed.

i always try have the copter on the ground before powering up.

not that the initialisation sequence goes 'through' when the quad is moving.

 

despite this procedure i can produce erroneous startup behaviour - aka the quad is instable.

the quad can also 'break' away.

to re-produce this just try to start 'fast' after arming the motors - and this as soon as possible.

initially i thought this was a sideeffects of having the accel values not correctly calibrated.

then i thought about having faulty boards - but two boards show the same behaviour.

but that is not the whole story.

 

i will give your idea a try.

 

thanks for the code and time you spend ;-)

robert

Thanks, I'll pass this on to Jason (ACM's developer)
it should all be calibrated when you can arm motors...
Actually it is not calibrated immediately after you power up your electronics. System will wait fair time for all movement to stop before calibration has been taken. But as Chris said, we are now looking this implementation on our ArduCopter team.
That's what I do.  Actually with my code the platform needs to be still for 3 seconds during calibration before it is declared calibrated.  I measure the gyro outputs and allow only a very small deviation from the mean value to make sure nothing is moving.

The behavior should be added to the Gyro and Accelerometer classes in the libraries.  And if you write it as a state machine it can be run during the main loop, not just during startup.  This is how I originally wrote it in my own quad project.

 

Dror

that piece of code from dror helped a lot.

the init sequence for the gyro is now ok (added by doug and part of the latest svn update).

 

my quad is able to start smooth - and at least for me the 'in air accel calibration' is not needed.

but when things do change in production thi 'magic' numbers in the code may change again.

so there might be a need to report gyro startup data - making shure all is ok in the future.

thumbs up the improvent!

robert

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service