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
Stabilise altitude using z axis accelerometer
Re: Stabilise altitude using z axis accelerometer
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
hmm interesting.. one idea would be to replace thrust ctrl with z-axis acceleration ctrl.
Re: Stabilise altitude using z axis accelerometer
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)
(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
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
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
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