I recently received my Ardupilot mega, but I could not find instructions on how to get it working on airframes like Twinstar, which have separate servos for each aileron. One related blog post here in diydrones mentioned, that feature is being implemented (although I did not find an open issue about it) but I was too impatient to wait for proper fix.


Here's my ugly fix for this:

1. Disable aileron mixing from transmitter and make connections to ardupilot as you would do on 1-servo aileron case.

2. Connect 2nd aileron servo to ardupilot output 5

3. Open ardupilot sketch in arduino ide and open "Attitude" file

4. Insert these two lines to place marked in picture:


g.rc_5.radio_out = g.channel_roll.radio_max.get() + ( -1 * (g.channel_roll.radio_out - g.channel_roll.radio_min.get()));       
APM_RC.OutputCh(CH_5, g.rc_5.radio_out); // send to Servos



5. Compile and upload


Remove "-1 *" part, if 2nd servo does not need to be reversed compared to 1st servo.



Since failsafe mux only operates on first four channels, on event of failure, 2nd aileron can't be moved.


I hope this feature will be implemented properly in the near future, but this should do at least for now and at least for me. Hope this helps others too!




E-mail me when people leave their comments –

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

Join diydrones


  • Yeah; Ch 5 in and out.  I have a Futaba, in which case I have AIL2 set to channel 5 and I have an "airbrake" option that controls AIL and AIL2.  I have that set to do flaps and it works in all modes with the exception of the rudder issue.
  • Sean...what is your hardware setup?  Are you using CH5 also for the second aileron? 
  • Messing with some code, I've achieved 2 servo aileron flaps (flaperons) working in manual, stabilize, and auto pilot modes and likely all others. The one issue I have remaining is that when the flaps are turned on in stabilize mode, the rudder auto tilts to the left. For now though, at least everything is working...
  • If you don't need to reverse ch5 servo, it should be enough to just add "APM_RC.OutputCh(CH_5, g.channel_roll.radio_out);", as you said. Good luck with hacking!
  • Am I reading this code correctly to mean that you're outputting to ch 5, but the "input" is calculated from the other aileron?  In other words....a "virtual" Y cable?  If so, is there anything wrong with simply duplicating the other aileron channel with "APM_RC.OutputCh(CH_5, g.channel_roll.radio_out);" (I don't have to reverse mine)?  It seems to work perfectly, and for good measure I have the trim duplicated elsewhere.  My conundrum is that I want flaperons.  The best I've been able to achieve thus far is normal operation with flaperons under manual control with one non-functional aileron under auto/stabilize.  It's not much, but I'll admit I haven't had time to play with the code recently >).
  • The patch was created for 2.11. I can try to port it to latest version during the weekend as I'm planning to do upgrade while I add airspeed sensor and telemetry transmitter.
  • Have you tried this using the latest software?  I just loaded this code into APM 2.1.2 and it doesn't seem to work...  With anything plugged into the CH5 out, the servo seizes to one side and doesn't respond to any controls.  None of the things I've tried with my controller settings changes this situation.
  • One thing to keep in mind, Historicly, the reason we were keeping aileron support to one channel, was keeping the first 4 channels (mux passthrough) was allowing for primary rc control, in case of APM failure.

    Flapperon support takes primary navigation out to a non-muxed channel. This causes a configuration that could fail if the apm failed and couldnt support a hardware manual mode.


    Now that being said, that was early on...


    Today; a quad copter (ACM) will never be flyable with hardware manual, (thats why they avoid ch8...)


    so whats the huge issue with having a non-flyable config if apm goes on the blink?

    (apm may glide, acm will plummit)


    I feel it could to be added to the APM3 wish list, as enhanced speed control options with flapperon and potentialy airbrake support.

  • Yes it would be nice to have proper flaperon support. And that is something you can not get with Y-cable, nor with reversed Y-cable.


    And BTW can someone add a "flaperon" tag to the blog post ? (added by moderator)

  • I'd like to get flaps/airbrake feature implemented and I've thought it a bit. It's not nearly as simple modification as aileron function, but not too hard to do. Only problem is that I'm new to ardupilot code and I'd like to see it done properly so I'm not certain that I'd be the right person to do it.
This reply was deleted.