Developer

Inverted flight patch for APM

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)

 

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • I have tried this and at least on the bench, I notice no change in the MissionPlanner's horizon even though the APM is still upright and level on the bench....is this normal?I would have thought it would indicated that the APM was upside down when the switch was activated?

  • Andrew,

    I have been trying to get inverted flight to work for quite some time now, with no luck. I think i finally figured out what the problem was. The inverted flight channel does not account for the pitch compensation parameter. I happen to have an airplane that has a fairly high pitch comp. value, so whenever I try to fly inverted, the elevator deflects so much that i would end up flying at about 30 degrees rather my trim case which in about 8 degrees.

    I will look into ways of fixing this. An easy way would be to turn pitch comp to 0 if inverted flight is enabled, but I would like for may plane to fly the same inverted as upright as I have a symmetric airfoil. 

    If you have any idea or comments let me know.

  • Developer
    Darren and Davey, the current patch won't help with mounting APM boards upside down, as the gyro calibration at startup would be wrong.
  • Developer

    I've added a wiki page on how to setup inverted flight

     

  • Developer

    I've just pushed the inverted flight patch to the master svn repository, so everyone can use it. It is enabled using a config parameter INVERTEDFLT_CH which you can set with your ground control station. You set it to the channel number you will use to trigger inverted flight from your transmitter. When that channel goes above 1750, APM will engage inverted flight. The default is zero, meaning no inverted flight trigger.

     

  • @Darren: That's what I was thinking. This might let you fix the board inverted in your airframe, which is a feature APM sorely misses!

  • Or better yet, a transition from VTOL to forward flight mode in a hybrid Quad/Bipe?
  • Could this be used for non-standard mounting options for the APM Board?
  • Effectively, that could be accomplished with existing airframes by setting it up to takeoff/land "upside down."
  • Developer

    @Joel

    A flying wing was just the first thing that popped into my head. It could just as well be a purpose designed UAV, using midsection mounted symmetrical profile wings like aerobatic airplanes use.

    Or you could take it a step further and design the wing profile so that the plane has better efficiency inverted, but still can perform takeoff/landing in normal flight.

This reply was deleted.