A while back Jose Julio built a simple state machine for doing copter flips. I integrated it into AC 2.x a long time ago but never flew it. Then, once I built the Flash simulator I could finally test it without doing too much damage or loosing my quad to a fly away.
The original code was quick and dirty which lead to a few issues, one of which was a tendency to turn the my quad into an air to ground missile. The new code which is in 2.7 added a few items:
- an emergency exit from the state machine (roll or pitch hard to exit)
- a rate controlled loop rather than a using momentum for the second half of the roll
The state machine takes control of the throttle, roll and pitch until the flip is complete. It breaks up the flip into 4 main steps
- Gain altitude - up the throttle for 1 second
- Roll hard until we go past 90°
- Maintain 400°/s roll until we are 90° from level
- Stabilize with a desired angle of 0° for a nice controlled return to level
The mode is enabled by setting the CH 7 option to Flip. Bringing CH 7 high while flying any mode will trigger the flip, but you must be armed and flying to get the flip code to trigger. You must return CH 7 low, then high again to reset the state machine and do another flip.
Jason
Comments
I recently implemented this on my quad. It works great! Thanks for all the work Jason + others!
!https://www.youtube.com/watch?v=WygxE0DpEuI
Not quite an acrobatic but I would love to see a fast/stable descent feature. The PIDs for stable hover and climb are much lower than the PIDs for stable descent.
Jason
hmm. I tried this today with my 3dr quad. It gained altitude correctly and slowly started rolling in the direction to start a flip but it never rolled hard enough for it to go past 90 degrees. Do I need to change some values?
BTW, your gains for rate_roll_P /rate_pitch_P are too high and you have that tell-tale fast wobble. You can lower them by 20% and you should be good. You can also raise rate_roll_D a hair and it might remove some of the wobble.
Jason
ok Just tested this.....on 2.7.1 , pretty impressive, the 1.2s burst after the roll the roll causes quite an altitude gain, any way of tuning that down to a 1 or 3/4 second, ar could my throttle rate be to high/low
either way super impressed...
Anyone know some other acrobatics we can automate?
Just think it should be said that you need your copter to be tuned... must be ok to fly in alt hold / loiter before even trying this... Dont use that function on a copter that is not stable to start with! (I know it seems obvious but I have seem people trying to start a mission without a good alt hold setup... not always pretty!)
Dany
www.CanadaDrones.com
We have been playing with flip at 3DR for a couple of weeks now and it is flawless. Works great , good job Jason!
That's awesome! Can't wait to try it on my quad.
How easy is it to run code through your Sim? :)
My thoughts on how to do a forward moving backflip/loop:
Pitch forward at 10°/sec until 40 until - Gain ~5m altitude during forward pitch.
Gain altitude - up the throttle for 1 sec - Throttle +???%
Hard pitch at -400°/s until we go past 90°
Throttle @ ??? (not sure about this one)
Maintain -400°/s pitch until we are 40° from level
Pitch back at 10°/sec until 0° - Throttle or down to gain / lose altitude (objective = Match starting altitude)
Mode change to Stabilize for controlled return to level
I haven't looked at the flip.pde code yet, but I probably will. I also need to get a simulator working so I can test myself.