I am planning to add flaps to the plane and wondering if I should just add it as an extra channel on the transmitter or should I  incorporate it into the APM 2.1 code.


Would it effect the "stabilized", "fly by wire" etc mode flying, or APM would compensate when using the flaps?


Did anybody add flaps to the APM code?

Views: 1312

Reply to This

Replies to This Discussion

I have added flaps into APM.  You have (at least) 3 ways you can go, depending on your goals.  You can just stick flaps on a rc channel separate from APM, you can use the servo commands built in to APM to control flaps (only in AUTO mode), or you can write your own code and add it to APM.

I had camera setup on the old code move down when it was 20m above the ground. You could use a similar idea to make the flaps deploy when you are landing and taking off. The code below is a shortened version of what I have as well as being generic. If copter/plane higher than 20m above home servo turns 45° to the left. If not it stays 45° to the right.

Put it in a routine and it will do it automatically.


if (current_loc.alt - home.alt > 20)


APM_RC.OutputCh(CH_6,1500 + (-45*10.31));





APM_RC.OutputCh(CH_6,1500 + (45*10.31));


Perfect. Thank you Doug and Ritchie.  I need to look at the APM code in detail. 


I assume if I use the separate channel to deploy the flaps, the APM if in AUTO mode would not "know" that, but it would still compensate for any change in flight performance (speed decrease, etc) as if nothing happened.


Now, for flaperons, I assume that if I introduce into the exisiting APM code in AUTO mode to the two aileron servos a 45 degrees offset (downward as if deploying the flaps) , the APM would still maintain it's aileron functionality of stabilizing the roll?  Just like if the plane is in a turn, the plane would maintain that degree of turn (let's not count the elevetor function), but in this case with one aileron servo receiving the same deflection signal as the other aileron servo, not in the opposite direction as if in a normal aileron turn function.

Correct on the first paragraph.


On the second, APM does not support individual aileron channels at present.  You will need to add that.  We have been dragging our feet as it is in a mix of functions for channels 5-7 that people have requested and coordinating implementation of all of them is a challenge.



I am personally very grateful for all the work that went into this code. No pressure, I am sure the priorities are juggled the best possible way.


For flaperons, with my limited coding knowledge, I will try the following, unless it's already wrong in principle (I am sure there are lots of other factors to consider, like calibration, etc):


1. Two separate servos for ailerons, one channel for each (use existing aileron, and one unused channel)

2. For normal aileron operation: both channels get the same (original coding) signal from APM, just like a "Y" connector except by adding the second channel in the loop with the original aileron code

3. For flaperon operation: both channels run the same original APM code, but one servo channel gets a -45 degrees offset signal (let's say "aileron value - 300ms" signal) and the other gets +45 (absolute value) degrees offset signal introduced into their original code. Both ailerons move down 45 degrees like flaps and remain there while receiving the original APM code's signals for ailerons.


For example during normal aileron operations both servos center on 1500ms pulse on each channel. For example, the APM code sends an 1800ms signal to both servos to move the ailerons (linkage goes right for one servo, and left for other servo).


For flaperon operation, the original APM code has an aileron variable with a value of "flap" added to it code (ex: aileron value = "aileron + flap" where "flap = 0"). When a switch is turned on the flap becomes a value in signal worth a 45 degrees deflection (for example -300ms).


In flaperon mode, both servos center on 1500ms pulse on each channel until the flap switch is turned ON and "flap" value becomes a 45 degrees worth of servo movement pulse. So now for servo #1 the original 1500ms center aileron servo pulse becomes (for example) 1500ms - 300ms = 1200ms where -300ms is the -45 degrees offset (it moves down 45 degrees). At the same time, using the same original APM code, for servo #2 the original 1500ms center aileron servo pulse becomes (for example) 1500ms + 300ms = 1800ms where +300ms is the +45 degrees offset and is the absolute value of "flap". That servo moves down 45 degrees as well. While the flaps value remains at -45 and +45 and remains tagged onto the aileron code, the original APM code for aileron will still flow to both servos without any changes, except the ailerons remain down at 45 degrees like flaps, but also moving up and down separately, just in opposite direction like ailerons.


When the -45 flap signal is removed the ailerons return to their centered position since the flap value is zero now and plays no factor in the original APM code.


Please excuse my technical inaccuracies when it comes to RC servo signals. I also may have simplified the coding part a little too much without considering additional factors?




There are a few channels and IOs free for use so you could use one of them to create it or wait just a lil while for me to create something :D

I am in the process of changing my setup for two ailerons and one flap servo. Will attempt at coding next, as time allows.

Would it be advantageous to utilize an "App store" for manual and autopilot mixing (or rather, control-implementation-specific behavior), with everyone posting loadouts to a common database accessible from the APM software (in particular the simulator hookup)?  It seems like experimentation and sharing should be the name of the game there - rare combinations abound.  IMO, the ideal would be that one should be able to design, trim and test a tip rudder / canard stabilator / flapperon / differential thrust dual-motor plane without an inordinate amount of coding experience, just lots of trial and error.  There are lots of smart RC guys willing to put in the work.

Reply to Discussion



Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service