Barometer assisted thrust.

Firmware/software/electronics/mechanics
BillyBag2
Member
Posts: 45
Joined: Wed Jul 10, 2013 8:54 am

Barometer assisted thrust.

Post by BillyBag2 »

Hi all,
I have been looking at getting the crazyflie to hover. The current efforts are towards barameter assisted thrust. By measuring the barometer at the start and then appling a small, propotional, correction to the thrust I am hoping to increase the height stability.

Propotional is easy as the sample time does not need to be constant and therefore the beating between the software sampling and the convertion time is not important.

With respect to the barometer it seamed over kill to measure the temperature continuously. Also I was not 100% sure of the logic. I think it would give a reading only when there was a temperature measurement and a pressure measurment at the same time. See ms5611GetPressure(). This did not look correct, infact it looked imposible that the temperature and the pressure would ever be read at the same time. Have I missed something?
omwdunkley
Expert
Posts: 162
Joined: Thu Jun 06, 2013 9:56 pm
Location: Munich

Re: Barometer assisted thrust.

Post by omwdunkley »

This had me a little confused too:)

My solution: see http://forum.bitcraze.se/viewtopic.php? ... eter#p2281

I read temp once, then pressure 9x. And that at 100hz!

Oh, and you probably want to smooth the signal. I found pressure = pressure * 0.92 + new_pressure * 0.08 worked best.

Some example measurements with the LPF and raw signal: http://goo.gl/N9GUc

Good luck, let me know if this helps.
BillyBag2
Member
Posts: 45
Joined: Wed Jul 10, 2013 8:54 am

Re: Barometer assisted thrust.

Post by BillyBag2 »

omwdunkley wrote: Oh, and you probably want to smooth the signal. I found pressure = pressure * 0.92 + new_pressure * 0.08 worked best.
After looking at the code I read the spec for the device. I have not looked back at the code(yet). It's quoted worst convertion time is just under 10ms, which gives you ypur 100Hz when not repeating the temperature measurments.
This is also with the highest over sampling. Is the software using this setting? It used more power too but I guess we do not care about that. 99.999% of power is going to the motors. ( I will look at the code and check, when I get a chance.)

I think over sampling could be quite relevent to us as we probably have masive spikes driving the motor. Oversampling will "filter" the random spike, if it is gettig to the sensor.

I am only doing propotional so noise is not AS important. I will get "fitering" from the machanical system itself. (i think). Filter often cause phase issues that cause instability in control loops. Too scared to do better. I know I can burn loads of tinker time on control loops.

I will stick with unfiltered propotional for now but I need to have a go at the driver code to get the 100Hz you are getting (or even 50Hz with alternate temperature readings.)

I have no idea if self heating becomes an issue. Particularly at the higher current. May be worth droping a presure sample every few seconds to check the temperature.
BillyBag2
Member
Posts: 45
Joined: Wed Jul 10, 2013 8:54 am

Re: Barometer assisted thrust.

Post by BillyBag2 »

I had the first barometer assisted flight. Worked quite well. I think over a meter or two I was getting 10%ish swing on the thrust. (a guess) So now the thrust setting on the controller is abit more like height, rather than before where it was ether flying away or crash landing.

I have not found an easy way to find the trust bouancy point. This changes as the battery fades too. So I experiment with the min and max thrust (on the client) to get a 20% range for which it will fly.

Its quite a nice mod as the cotroller is unchanged.

I need to improve the driver and play some more.
SuperRoach
Member
Posts: 96
Joined: Fri May 03, 2013 2:06 pm

Re: Barometer assisted thrust.

Post by SuperRoach »

That's great news to hear Billybag :)
omwdunkley
Expert
Posts: 162
Joined: Thu Jun 06, 2013 9:56 pm
Location: Munich

Re: Barometer assisted thrust.

Post by omwdunkley »

BillyBag2 wrote: This is also with the highest over sampling. Is the software using this setting? It used more power too but I guess we do not care about that. 99.999% of power is going to the motors. ( I will look at the code and check, when I get a chance.)
If you look at the code again you will see I defined a

Code: Select all

#define MS5611_OSR_DEFAULT MS5611_OSR_4096
and use

Code: Select all

MS5611_OSR_DEFAULT
everywhere, eg

Code: Select all

 ms5611StartConversion(MS5611_D1 + MS5611_OSR_DEFAULT)
BillyBag2
Member
Posts: 45
Joined: Wed Jul 10, 2013 8:54 am

Re: Barometer assisted thrust.

Post by BillyBag2 »

I have the flie hovering when stationary, but flyng it about causes it to loose hieght and recovers slowly. I will look at increasing the thrust based on the actual pitch and roll. Also could look at inproved control using full PID.
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Barometer assisted thrust.

Post by tobias »

I read somewhere that it is good to cover the pressure sensor with some breathing foam or similar to avoid the effect from the airflow from the propellers. Something worth a try to get better reading.
BillyBag2
Member
Posts: 45
Joined: Wed Jul 10, 2013 8:54 am

Re: Barometer assisted thrust.

Post by BillyBag2 »

tobias wrote:I read somewhere that it is good to cover the pressure sensor with some breathing foam or similar to avoid the effect from the airflow from the propellers. Something worth a try to get better reading.
I have logged the alt reading and tested with out motors running. I think filtering is required even with motors off. I wondered about the "blowing about" causing issues when the motors were running, and also motor related spikes on the supply. I'll try some foam or something. I have just added SW filters to the alt and at the moment the readings look alot better but the control gains now need a complete reconfiguring. Its currently not hovering at all at the moment.

I think one of the threads noted that there was a drop of about 50cm on takeoff. Ie the logs indicated it drop 50cm below the takoff height, which did not really happen it did not drop through the floor. Perhaps foam would help remove this. I've not been able to log stuff this effectivly yet.

I don't know if it is completely the wrong frequency range but microphones, which measure "pressure", often have a big furry thing to get rid of wind noise. I think you can buy mini ones for your cam corder.
omwdunkley
Expert
Posts: 162
Joined: Thu Jun 06, 2013 9:56 pm
Location: Munich

Re: Barometer assisted thrust.

Post by omwdunkley »

Hey man,

I guess the reference you are looking for is this one: Graph of real height vs barometer estimate - https://lh5.googleusercontent.com/-AFuo ... export.png

At t=15s the motors spin up and at t=17 seconds you can see the flie achieve lift off. The corresponding barometer estimate clear drops to -0.5m.

Are you using ubuntu? If youre really serious about logging I can help out with that. I use ros which records all the outgoign flie messages, timestamps them all. You can then plot graphs in real time, or play back the data in realtime. Or just dump everything to .mat, .csv, etc.

Ill experiment with adding foam or smth to the barometer soon, it looks like it could be a quick fix. First need to find it on the pcb :) Let us know how your experiments go!

Cheers!
Post Reply