When I was learning to fly my quad I couldn't wait to develop the skills to start doing acrobatics. I had no idea that arducopter was so limited in this area. Here's the stock options:
Stabilized Acro (AXIS_ENABLED=1, ACRO_BAL_ROLL = x, ACRO_BAL_PITCH = y)
In this mode, you get your familiar stabilize 'earth framed' controls, and the ACRO_BAL parameters set a decay rate on how quickly the copter returns to level when you let off the controls. It's not so bad, but:
- You are limited to +/-90 degree pitch to avoid gimbal lock. No pitch flips for you!
- Yaw is earth based, so yaw and roll become the same control at +/-90 degree pitch. (no flipping the tail around if you chose to do so.)
- The ACRO_BAL seems to limit the roll, because the further you roll, the harder it tries to return to level. I found I needed to drop those right to zero to do roll flips, but getting the exit angle right is really hard for a newbie like myself.
Body Frame Acro (AXIS_ENABLED=0)
In this mode, the stick sets the rate you want to rotate on each axis. You get true 3D axis control, but it is very unstable and hard to fly. A small gust of wind tilts the copter and that's it's new holding position - the integrators in the rate controllers try to get it back, but since the control input is 'don't move' the Kp value kind of cancels it out. In this mode, you also don't have access to the ACRO_BAL safety net.
So I thought the first thing I needed to do was improve the holding power in Body Frame Acro mode. I achieved this by, instead of directly passing the pilot rates to the rate controllers, I rotated a reference and used the stabilize controllers to target that. So far so good. The trick here was to use the gyro drift compensated omega vector to un-rotate my reference which basically put an outer angular controller around the rate controllers. You get the angular holding performance similar to stabilize mode - except at any random angle. I tried it out, it worked just as expected, but I continued to crash my copter because I'm a really bad pilot who can't get the exit angle correct or remember to flip back into stabilize mode before it's too late.
In trying to solve this puzzle, I ran into some posts about MultiWii's HORIZON mode and basically what they've done is combined level mode with acro mode, and your stick position sets the mix between the two. At 0, you are in 100% level mode, at 100% you are in 100% acro mode. This sounded pretty good, but I was a little skeptical with how it would actually perform when getting inverted. For example, if you were passing +90 degree pitch at less than full stick, the sudden roll switch from 0 to 180 would cause the roll level controller to start rolling to copter when you didn't want it to. Also, as you cross the 90 degree pitch point, the pitch angle then looks like it's decreasing from 90, but the pitch level controller would be pulling in the wrong direction. I didn't see how they dealt with this in the MultiWii code, but perhaps their gimbal code works differently. For arducopter, this is what I did:
- I set up the stick based proportional mix just like MultiWii
- For the roll level controller, I made it's output blend towards the acro controller rate as pitch approached +/-90 degrees. At 90 degree pitch, there is no roll level control to blend in, and the stable acro controller keeps things in line while passing through the discontinuity.
- For the pitch level controller, I made it target the closest 'level' point - either up right or upside down. So if you pitch past 90 and let go of the stick, the pitch leveler will actually pull you over to 180 pitch. Sounds bad, but as you approach full inversion, the roll controller will right you on it's axis instead. More importantly, of you roll past 90 on purpose, the pitch controller will happily hold your pitch angle - inverted or not.
I just tested this new algorithm out and it's perfect for a newbie like me. Forward, backward, and side flips where smooth and easy. Since the level/acro rates are blended and fighting each other, the only tuning was to get the acro Kp up high enough to make it feel natural.