Multirotor Acrobatics

Seeing the posts and videos regarding LUA scripting acrobatics with ArduPlane, I was wondering how to implement of such features on ArduCopter (but with a twist!).

I’d like a companion computer to control the acrobatics, I do have an STM32 based “companion computer” running bare metal and I am able to control a quadcopter using GUIDED_NoGPS mode, using SET_ATTITUDE_TARGET messages over Mavlink.

We’re still running in a testing jig, and my current firmware doesn’t try to do anything special other than maintaining the quad’s frame orientation relative to earth.

My issues arise when the pitch angle crosse 90 degrees, effectively inverting the quad.
If I just send absolute values in the attitude target - all is good.

BUT I want to keep track on the drone’s attitude and adjust the course on-the-go.
Once I try to read ArduPilot’s attitude (via Mavlink, of course) and send a SET_ATTITUDE_TARGET with the quad’s attitude + adjustment, things go bad. When the attitude become inverted, control is no longer “logical” for me, and the quad starts rolling\yawing.

In the example log you can see ATT.DesYaw and ATT.Yaw start to divert right before disarming, this is where things went bad. You can also see GUIA values that were transmitted from my companion computer.

Let me know if you have any ideas, suggestions or questions.
Any help will be appreciated!