[Hover Mode] Testing and setting Parameters
[Hover Mode] Testing and setting Parameters
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
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
Re: [Hover Mode] Testing and setting Parameters
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
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
Re: [Hover Mode] Testing and setting Parameters
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?
Am I supposed to "trigger" hover mode some way?
Re: [Hover Mode] Testing and setting Parameters
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.phiamo wrote:either the fly drops like a stone or it raises
Re: [Hover Mode] Testing and setting Parameters
Manually hover your copter and then press the "Hover" button!
Must have firmware and client software which match, of course!
Rich
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
Re: [Hover Mode] Testing and setting Parameters
Okay, I've figured out that I need to configure the controller for hover mode.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?
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?
Re: [Hover Mode] Testing and setting Parameters
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
Rich
VGer's v1.7.1 frame, 10DOF Crazyflie, Wireless Xbox360 Controller, Virtual Machine on VMware/Windows 7
Re: [Hover Mode] Testing and setting Parameters
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
nice to hear it works for some others too, anyways i think we need to get it faaar better
Re: [Hover Mode] Testing and setting Parameters
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 :/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
When I use two variables for the same axis in the config, none of them seem to work.
Workaround anyone?
Re: [Hover Mode] Testing and setting Parameters
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 ...
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 ...