Page 1 of 1

Stabilise altitude using z axis accelerometer

Posted: Sun May 19, 2013 10:15 am
by *matt*
I was wondering if anyone has tried using the z axis of the MPU-6050 accelerometer to help maintain altitude. I know it will only help with sudden changes in altitude, but combined with the MS5611 pressure sensor it may work better.

I will try to implement something myself although I’m not an experienced programmer.

Matt

Re: Stabilise altitude using z axis accelerometer

Posted: Sun May 19, 2013 11:42 am
by tobias
It might work but our experience is that the accelerometer readings are very noisy from the vibrations which might make it difficult. Filtering the values might be a solution. Looking forward to your results!

Re: Stabilise altitude using z axis accelerometer

Posted: Sun May 19, 2013 5:17 pm
by TheFrog4u
hmm interesting.. one idea would be to replace thrust ctrl with z-axis acceleration ctrl.

Re: Stabilise altitude using z axis accelerometer

Posted: Mon May 20, 2013 8:55 am
by mjc506
dawwwww thanks! You've just given me the prod I needed to get my hover mode working completely!

(I have it working fairly nicely just using the barometer, but was looking for a decent derivative term - I'll now use an integrated reading from the accelerometer (to get velocity)

Re: Stabilise altitude using z axis accelerometer

Posted: Mon May 20, 2013 8:59 am
by Fucitol
That sounds very good! Please keep us updated on how you are doing, many people are interested in an altitude hold function.

Re: Stabilise altitude using z axis accelerometer

Posted: Mon May 20, 2013 9:08 am
by mjc506
sure, code is here: https://bitbucket.org/mjc506/crazyflie-firmware and it compiles and runs fine. You will also need a patched cf-client - I used Phiamo's code: https://bitbucket.org/phiamo/crazyflie-pc-client (but couldn't get his firmware working for me)

Altitude hold works ok, but I still need to tweak the PID tuning - these show up in the 'Parameters' tab, so they are adjustable in flight. Currently, if the CF gets too far away from its set point (or if you adjust the set point too quickly with the throttle) it goes into oscillation, but dropping the integral and/or proportional terms should help. I think most of the oscillation is from the integral term, but I've been fighting with my crappy Derivative function for the last few days :roll: