[Hover Mode] Testing and setting Parameters

Firmware/software/electronics/mechanics
phiamo
Member
Posts: 31
Joined: Wed May 08, 2013 11:44 am

[Hover Mode] Testing and setting Parameters

Post by phiamo »

Hi Folks,
i further developed the hover mode. The current solution uses the Pressure difference as input for a PID controller telling what to do in therory (some kind of climb rate needed is beeing calculated)
If we are too high, the decent rate rate will only get half the influence than while climbing, cause the thrust release and the gravitation are stronger while loosing height.

This info is then fed into a second PID controller using the accelerometer data from z axis to further tune the output. (loosing a lot of height rapidly should cause this PID to increase thrust even more)

Currently this output oscillates around zero and this rate is the thrust needed, and added or subtracted around a ground hoverParameter (actually 42800)

There are several parameters tunable via the gui, making it quite easy to test different values.

I am currently playing around to get some reliable parameters, cause different situations make it quite hard to predict all of these:
Hovering around ground needs less thrust at all while starting hovering during flight needs an extremely fast response, to have hovering thust actually.
I would love to see if you folks could do some code review, and play around with parameters too.

currently the most important ones are:
thrust_kp
thrust_ki
thrust_kd
thrust_il
climb_rate_kp
climb_rate_ki
climb_rate_kd
climb_rate_il

There is also a stabilizer.debug parameter which will cause not to distribute power, but just calculate, which is quite nice together with the log output of the pc-client, just to see if your values are ok.

If the flie does not behave like desired, have a look into the logged variables, especially the pressure difference is sometimes strange, since in that moment where you press the button the value differrences from the current a lot, causing a completely wrong calculation, either the fly drops like a stone or it raises ... if you are playing around, just disable hover mode and reenable it, to get a new desired pressure.

Thr source can be found here:
https://bitbucket.org/phiamo/crazyflie- ... r_mode_pid
https://bitbucket.org/phiamo/crazyflie- ... hover_mode

Since i needed to change the comm protocol to also transmit hover changes (current implementation changes the desired pressure) you need the hover pc-client to control the hover firmware.
Also the hover mode PC client introduces a hover switch to be configured and a hover axis to be configured, while the switch is obvious to turn hovering on and off, the new axis should once make us abled to let the flie climb or decent.

Hopefully we will find some values satisfieng all needs or improve the code further :-)

Have Phun
rmirwin2
Member
Posts: 51
Joined: Mon May 13, 2013 6:06 pm

Re: [Hover Mode] Testing and setting Parameters

Post by rmirwin2 »

Looks really good, Philip!

Hovered with mine twice for several minutes each time with the "stock" parameters, until the battery began to drop out.

Initially some oscillation in Z axis but it seem to go away. Perhaps still some honing on with the parameters, but these seem like the best commits so far!

Congratulations on your accomplishment so far!

Rich
VGer's v1.7.1 frame, 10DOF Crazyflie, Wireless Xbox360 Controller, Virtual Machine on VMware/Windows 7
guff
Beginner
Posts: 4
Joined: Sun May 26, 2013 9:57 pm

Re: [Hover Mode] Testing and setting Parameters

Post by guff »

I don't really understand the trick here. I've managed to install everything, but I don't notice anything different.
Am I supposed to "trigger" hover mode some way?
TheFrog4u
Expert
Posts: 113
Joined: Fri Feb 08, 2013 6:59 pm
Location: Bremen, Germany

Re: [Hover Mode] Testing and setting Parameters

Post by TheFrog4u »

phiamo wrote:either the fly drops like a stone or it raises
Yeah sadly this is what I got most of the time.. one time it was actualy quite stable with some ocilations getting bigger after some time. Will have a look to the values a bit closer next time.
rmirwin2
Member
Posts: 51
Joined: Mon May 13, 2013 6:06 pm

Re: [Hover Mode] Testing and setting Parameters

Post by rmirwin2 »

Manually hover your copter and then press the "Hover" button!

Must have firmware and client software which match, of course!

Rich
VGer's v1.7.1 frame, 10DOF Crazyflie, Wireless Xbox360 Controller, Virtual Machine on VMware/Windows 7
guff
Beginner
Posts: 4
Joined: Sun May 26, 2013 9:57 pm

Re: [Hover Mode] Testing and setting Parameters

Post by guff »

guff wrote:I don't really understand the trick here. I've managed to install everything, but I don't notice anything different.
Am I supposed to "trigger" hover mode some way?
Okay, I've figured out that I need to configure the controller for hover mode.
However, it seem to need an additional analog stick to control the hover variable. Does this mean I can't run hover with a PS3 controller?
rmirwin2
Member
Posts: 51
Joined: Mon May 13, 2013 6:06 pm

Re: [Hover Mode] Testing and setting Parameters

Post by rmirwin2 »

I attached the Hover axis to shoulder buttons on the Xbox360. I think its necessary right now but the value isn't applied. Hope that helps!

Rich
VGer's v1.7.1 frame, 10DOF Crazyflie, Wireless Xbox360 Controller, Virtual Machine on VMware/Windows 7
phiamo
Member
Posts: 31
Joined: Wed May 08, 2013 11:44 am

Re: [Hover Mode] Testing and setting Parameters

Post by phiamo »

I am also on PS3 but anyways, it should even be possible to reuse the thrust axis since there is no logic to prevent this, and it would be perfectly acceptable ...
nice to hear it works for some others too, anyways i think we need to get it faaar better :)
guff
Beginner
Posts: 4
Joined: Sun May 26, 2013 9:57 pm

Re: [Hover Mode] Testing and setting Parameters

Post by guff »

rmirwin2 wrote:I attached the Hover axis to shoulder buttons on the Xbox360. I think its necessary right now but the value isn't applied. Hope that helps!

Rich
So my problem is that the PS3 controller doesn't provide me with a 5th analog variables, since the triggers apparently aren't pressure sensitive in osx :/

When I use two variables for the same axis in the config, none of them seem to work.

Workaround anyone?
phiamo
Member
Posts: 31
Joined: Wed May 08, 2013 11:44 am

Re: [Hover Mode] Testing and setting Parameters

Post by phiamo »

If possible ignore it and try using / adapting https://bitbucket.org/phiamo/crazyflie- ... hover_mode
the gui atm forces you to set all axis, and if your controller doesnt have them, it wont work, not sure if it is a req having enough axis or if we just let people live without it ...
Post Reply