I thought it would be fun to have an 'inverted flight' switch on my transmitter. With an APM, it's easy! I just added a check for a PWM value above 1700 on channel 7 in read_control_switch(), and when it is above 1700 it sets a inverted_flight boolean. That adds 180 degrees to the nav_roll, which is the target roll for the stabiliser, and it switches the sense of the elevator stabilisation in the main stabilize() code. The result is this patch to the current ArduPilotMega code.

I tried this out a few times with HIL simulation using FlightGear first, then took it flying today with my SkyWalker. There was a lot of wind, so not exactly ideal conditions to be trying experimental patches, but I didn't want to wait for next weekend so I took a chance. It works perfectly!

I setup a spring loaded switch on my transmitter to set channel 7 to 1900 while I held the switch. That allows me to takeoff normally, then whenever I hold the switch in the on position the plane immediately flips over and holds nicely stable flight upside down. You can direct it reasonably well while inverted, although it certainly isn't as responsive as with upright flight (a glider like the SkyWalker isn't really designed for this sort of thing!). The manual mixing of elevator is inverted while upside down (just like it is when you flight upside down manually), which makes this patch good for practising inverted flight, as you can get used to the controls.

The only tricky part of the patch was the change to stabilize() to handle wrap of nav_roll at plus and minus 180 degrees. I originally wrapped it just based on the value, but the HIL simulation showed there was a discontinuity in the stability control at exactly 180 degrees, so the plane would suddenly try to flip over again while upside down as you passed the 180 degree mark. This turned out to be an interaction between the wrapping of the dcm roll_sensor and the nav_roll wrap. The fix was to wrap the nav_roll variable based on the sign of the dcm.roll_sensor variable, and that leads to really nice inverted flight with no crazy behaviour near 180 degrees.

This patch works with any of the stabilised flight modes (ie. anything but manual), which means you can flick the switch for inverted flight while flying a mission, or while in any of the other autopilot modes. It should add a bit of interest to longer missions!

(thanks to Stan for taking the video and coping with the gale blowing at the time)

 

Views: 407

Comment by diego colonnello on June 12, 2011 at 9:22pm
Good and  fun stuff Andrew.......
Comment by diego colonnello on June 12, 2011 at 9:25pm
By the way, can it work to manage an inverted emergency landing when the UAV is loaded with an expensive optics payload on its belly???????? i like the idea!!!!
Comment by Teejay on June 13, 2011 at 1:43am

Would there be a 'knife-edge' mode in the near future too? ;)


Developer
Comment by Andrew Tridgell on June 13, 2011 at 1:48am

inverted landing - that would be interesting in a SkyWalker! I guess I'd just need to attach some landing gear on the top, then I can choose to do a belly flop or gear landing with the same plane :-)

Teejay, knife-edge mode would be easy to program, but I think it would be hard to hold altitude! :-)

 

Comment by Russkel on June 13, 2011 at 3:14am
Haha awesome. Wonder if this will be merged into trunk :).
Comment by Ritchie on June 13, 2011 at 3:52am
Brilliant. Simple, effective and fricking cool. Give that man a god damn medal.

Developer
Comment by Andrew Tridgell on June 13, 2011 at 4:17am

Kamu, I asked Doug about it this evening, and he's OK with it being merged as a compile time option. I'll put it in later this week.

 

Comment by Russkel on June 13, 2011 at 4:18am
Cool Andrew :).
Comment by Kirill on June 13, 2011 at 5:56am
Looks pretty cool :)

Developer
Comment by John Arne Birkeland on June 13, 2011 at 7:57am
This could actually be useful for protecting equipment while landing. Imagine a wing with all the equipment including camera installed on top pointing upwards. Then you just flip the wing to take ground survey pictures and flip back again for landings.

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2014   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service