Is it possible to configure four servos for ailerons
« on: November 10, 2019, 08:34:06 pm »
Hello,
I'm new here and to Libre Pilot. I've built a flying wing RC plane and I would like to have yaw control. I read about Differential Spoilers and would like to modify my plane to enable this and to get yaw controll. I just don't know if it is posible. Hope you can help me.

Re: Is it possible to configure four servos for ailerons
« Reply #1 on: November 10, 2019, 10:03:31 pm »
Possible?  I think it needs code changes.

Two things to address, plane hardware, and FC setup.

Off the top of my head, I can imagine four ways to set up the plane hardware:
- Split ailerons with two pieces of thin aileron sandwiched together on each side.  You want to yaw left, you open the split up on the left wing.  This is the right way to do it, but more difficult.
- Dual ailerons on each wing, inner and outer.  To yaw left, on the left wing you make one go up and the other go down.  The problem with that is you get a roll effect too with the roll going in the direction of the outer aileron.  That can be trimmed out by making the opposite pair roll a little in the other direction, but then you have remaining a little bit of elevator, which again can be trimmed out in the mixer.  Lots of mixer tweaks to get it right.
- Air brakes on each wing tip.
- Rudders on each wing tip or one in the middle.  This seems to me to be the only way that doesn't require code changes.

I would use a custom mixer to set any of the first three up.  They require some code changes (mixing table) to give you the capability of setting up neutral rudder so that (e.g. #1) both sets of ailerons work with no gaps, but moving rudder spreads one aileron open but does not try to compress the other one farther closed.

The mixing table change would be something like a +-limit per mixer input or a "plus only", "normal", "minus only" (dev note: would "absolute value" or "offset" be useful for other reasons too) per mixer input.  Either of these would be set up to stop the jamming of the two aileron servos per side by allowing the split to open, but not to squeeze it past closed.  For #2 or #3 it would do the same thing, move on one side but not the other.

Since you are already adding the weight of 2 more servos, another way to do it would be to make some kind of air brake on each wing tip, but that would still need the code changes or at least a mechanical method of avoiding servo jamming.

Then there are some ways that are a bit non-standard.  For a single motor, you could use thrust vectoring.  You could make it a twin and use differential thrust.
« Last Edit: November 12, 2019, 09:29:33 am by TheOtherCliff »

Re: Is it possible to configure four servos for ailerons
« Reply #2 on: November 11, 2019, 11:49:52 am »
Thank you for your detailed list of possibilities.
I think I need to look more into everyone and I hope I find a way, which I'm able to pull off ;)
I saw the split ailerons but thought they would be too complex to implement correctly. That's why I would love to use the method with four ailerons, but I didn't think about the roll that they would introduce. And the airbrake sounds promising too. But if nothing works, I will add rudders.
I will start to look into the programming of mixing tables and so on, but do you have a few locations where it would be eaiser to pick up the nessesary basics?
Thank you for your help :)

How the Mixer table works
« Reply #3 on: November 12, 2019, 08:10:29 am »
There are inputs (that come from the RC transmitter sticks in Manual mode or come from stabilization+control code in other modes) and there are actuators (outputs like motors and servos).

The mixer table connects the inputs to the actuators in the most flexible way possible.

Think of each input as a number between -1.0 and +1.0 (inclusive).  It so happens that roll right, pitch up, yaw right, and throttle up are all positive numbers.  E.g. +1.0 is full right roll while -0.5 is half left roll.  The throttle RC channel input is special in that lowest throttle stick produces -1.0, but the tiniest bit higher than that quickly gets up to zero, so the normal range of the throttle stick produces basically 0.0 to +1.0.

Throttle is also special in that the throttle input goes through a throttle curve function (the default curve doesn't curve it at all) and the curved value (still in the range -1.0 to +1.0) is used instead of the input.  Further, there are two curves supported, but the second one is usually turned off by setting the weight (described below) to 0.0.

The mixer table has a set of 5 numbers (in a column if looking at the Vehicle -> Custom page) for each of the 12 actuators.  For any particular actuator, each of these 5 numbers is a weight (factor, strength or multiplier) for that input for that particular actuator.  For any particular actuator, each input gets multiplied by it's associated weight and the resultant set of products is added together to create that actuator output value.

Weights are integers in the range -128 to +127.  Generally that -128 is only set to -127, but it isn't critical as far as I know.  A sum of +127.0 (+128.0 actually, but you don't need to worry about it) or higher means actuator full on, motor full on, full right roll, full back pitch, or full right yaw.  A sum of 0.0 puts actuators in the center (more precisely stated, at neutral, which may not be center, recall for instance that multicopter motor neutral is idle speed).  For a particular actuator, you can see that a weight of zero on some input says that moving that input does not affect that actuator.

On the Custom mixer page, the actuators are labeled Ch1 - Ch12 and the weights are in a column of 5 numbers (Curve 1, Curve 2, Roll, Pitch, and Yaw) under each Ch label.  On the System page (Settings->MixerSettings) the actuators are Mixer1Vector through Mixer12Vector with each MixerVector being a list of 5 input weights (ThrottleCurve1, ThrottleCurve2, Roll, Pitch, and Yaw).

Talking about how the mixer makes an X quad work will help you understand mixers.  Think about the northwest motor on an X quad, that motor actuator needs to increase for any of:
- roll right
- pitch back (stick) / up (nose)
- yaw left (CW prop rotation causes CCW=left torque)
- throttle higher
so these 4 weights all need to be positive numbers except for yaw which must be negative (positive makes right yaw but we need left yaw).  First of all, throttle weight must be +127 so that the motor puts out full power at full throttle (input=+1.0), even if roll, pitch and yaw inputs are all neutral (0.0) so they don't currently contribute to the output.  Limiting the other weights to +-64 is a compromise.  Obviously full throttle mixed with any of right roll, back pitch, or left yaw would add to higher than 127 (overflow), so for motor type actuators (multicopters) there is some code that automatically reduces (increases) throttle if it detects overflow (underflow).  You can still get overflow e.g. on the NW motor actuator even at idle throttle, if you go full right roll, full back pitch, and full left yaw.  If you limit those +-64's to +-42 instead, you will remove the possibility of overflow (considering that throttle gets reduced or increased if needed to avoid overflow), but you won't be able to flip and pirouette as fast (since e.g. full right roll input will only command 42 out of max 127, not 64 out of max 127).

That 64 comes from the multiplying 128 by the "Mixer" or "Mix Level" sliders on the Vehicle page.

For an airplane, it's pretty simple.  The aileron actuator, which is a servo, has zeros in the list of input weights for everything but the roll stick.

Imagine what you would have to do to the mixing table to make a set of airplane elevons (there is a setting for that so you don't have to do it this way).  First you need two separate actuators (aileron outputs).  Most wing servo pairs are installed as if looking in a mirror, so say the servo shaft points inward toward the fuselage on both the left and right wing servos.  It is done mirrored like this so you can just use a Y cable if you only want ailerons.  If one servo is moving forward, the other is moving back.  In that mounting, the left servo mixer might be +64 roll and +64 pitch, while the right servo mixer would be +64 roll and -64 pitch.  Now most flying wings I have need more elevator throw and less aileron throw, so you might make it say +56 roll +72 pitch and +56 roll -72 pitch.

Got an airplane that rolls a little when you hit the rudder and you want to remove that?  For each of your aileron actuators, just add a small amount of opposite sign yaw input (opposite sign as compared to the roll input for that actuator).  This says that whenever you move the yaw stick you will get a small amount of opposite aileron.
« Last Edit: November 12, 2019, 08:24:54 am by TheOtherCliff »

Re: Is it possible to configure four servos for ailerons
« Reply #4 on: November 28, 2019, 08:42:22 pm »
Wow

Thank you very much for your detailed explanation.. At first, I was a bit desprate because I didn't know how to manipulate the custom mixer table, but after I've found the systems tap, I made it work.
It took me so long to reply, because I order new materials for the split ailerons, you've mentioned.
And I think it is working like a charm .. I still need to test fly it in the next days but I'm very happy with the result.
But I would like to one little Mixer related question:
 
Do you think it is possible to limit the movement on yaw for one pair of servos or does it even matter?
I now use one servo for the upper aileron and one for the lower. I thought it would be wise to let both bends as far as they can when pitch or roll to give them more authority in extreme angles. But now I have the problem that they try to push against each other if I steer in the opposite direction.

What do you think?

Best regards,
chris

Re: Is it possible to configure four servos for ailerons
« Reply #5 on: November 29, 2019, 02:35:32 am »
Do you think it is possible to limit the movement on yaw for one pair of servos or does it even matter?
I now use one servo for the upper aileron and one for the lower. I thought it would be wise to let both bends as far as they can when pitch or roll to give them more authority in extreme angles. But now I have the problem that they try to push against each other if I steer in the opposite direction.

That is the source code change that is needed to do what you want.

Possible?  I think it needs code changes.

- Split ailerons with two pieces of thin aileron sandwiched together on each side.  You want to yaw left, you open the split up on the left wing.  This is the right way to do it, but more difficult.

They require some code changes (mixing table) to give you the capability of setting up neutral rudder so that (e.g. #1) both sets of ailerons work with no gaps, but moving rudder spreads one aileron open but does not try to compress the other one farther closed.

Source code changes to the computer program that makes the mixing table work.  You have just made changes to the mixing table setup, not the mixing table source code.

Without changing the source code, one aileron will open up, but the other one that is already closed will try to close even more and jam the servos and linkages.  That is not good.

Re: Is it possible to configure four servos for ailerons
« Reply #6 on: November 29, 2019, 04:22:04 am »
Thanks again for your fast reply :)

I'll look into the code ;)
for now I've set the upper and lower limits so they won't pass the middle line. I thought jamming servos wasn't so great :D


Re: Is it possible to configure four servos for ailerons
« Reply #7 on: November 30, 2019, 08:57:43 am »
Oh you raise a valid point that I didn't think of.  :)

A dissertation is necessary to get this done, but if you were willing and able to tackle the code, this should be much easier; all setup and no code changes  :)

Caveats and Warnings:
This setup will really bend your mind, and I can't guarantee it work, and you will need to use it with "always armed".  I can't think of a reason that it won't work, but throttle is a special channel that is handled differently than the others.  This may be more true for multicopters where throttle neutral is really throttle idle speed, not half speed.

Be aware that sometimes you need to unplug and replug the FC for the mixing table to e.g. change from fixed wing to custom.  I may tell you to save and reboot the FC more than needed.  It might only need to be rebooted when you change mixer type (e.g. from fixed wing to custom).  I may not tell you each time you need to save...  :)

Typical programmable settings ESCs start the settings change process with throttle stick high at power on.  It is possible that you could accidentally program your ESC settings inadvertently.  If you want to be really safe, you can plug the ESC signal connector into an unused output.  No signal to start the motor (still take the prop off) and it still provides power to the FC and receiver.  Then plugging a normal servo in the throttle channel will give good feedback about that working as expected too.

Brief Description:
There are two curves available for throttle in the mixer table.  You don't really even need a single one for fixed wing.  Those curves can be made to go backwards or stop moving on one side or the other side of neutral stick.  This is exactly what we want for rudder.  We will set it up with these two sticks (throttle and yaw) swapped around so that we can use the curves on yaw.

Detailed Instructions:
Start by getting it set up as a simple 2 servo flying wing without rudder by:
- take your prop(s) off!!!  really!  we will be doing stuff with a throttle stick that has a spring that returns to the middle.  IN ADDITION can also unplug the 3 ESC to motor wires but make sure nothing can short out.
- disconnect the linkage from top left and top right servos, leaving just the bottom servos working.  Do this so nothing jams during this initial setup.
- I assume you have the transmitter (Input page) set up properly.  It gets set up when you run the setup wizard and it has you wiggle the sticks to match the transmitter animation on the computer screen.
- do NOT set it to "always armed" yet.  it won't let you make changes if it is armed.
- leave the vehicle type as fixed wing - elevon (and Saved) during this part of setup.  do not go to the Vehicle Custom tab yet.
- you will need to go to the Output page and set the 2 currently defined servos (but not the throttle) up to be Min=1000 Neutral=1500 Max=2000 if they are not at least close to that already.
- throttle can be 1000, 1500, 2000 also.  If you have working values for throttle, those are fine.
- get it working with aileron and elevator moving the 2 bottom servos in the correct direction as if you were going to fly it this way as a normal 2 servo flying wing.
- from this point on do not change the transmitter servo reversing or GCS Input page reversing (except where noted) or you will break what you already have working.
- make sure you save the working configuration and maybe reboot the FC and verify it
- go into the Input page.  make a screen capture so you have all the numbers.
- swap everything (channel number, min, neutral, max, and reversed) on the throttle line with everything on the yaw line (and yaw with throttle).  thus the throttle Neutral should be about (Min+Max)/2,  that is usually about 1500, and the yaw Neutral should be about Min+40.
- we have not used those sticks yet.
- beware that everything in the GCS will have yaw for throttle and throttle for yaw from now on.
- props off!!!
- (this is where you could reprogram ESC settings accidentally when wiggling the sticks) if you Save, switch the transmitter on, and reboot the FC / receiver with both battery and USB plugged in, you can go to the Input page and see the values as you wiggle the sticks.  There may be a time lag (up to 10 seconds) between moving and holding the stick at a new location, and it showing up on the Input page.  The important thing here is that your transmitter trims are neutral, and that the number you see for real live transmitter channel value when the transmitter rudder stick is neutral (as seen on the GCS <Throttle> channel) is the same as the value set as the GCS <Throttle> Neutral setting.  GCS has the same number for the throttle Neutral setting as is coming from the transmitter.

Set vehicle type to custom on the Vehicle page (and save and reboot the FC) so you can see the mixer table.

Looking in the mixer table (it shows as a raw number table when you have a custom mixer), you will see that each of the two servo outputs (columns) has both aileron and elevator mixed in, but there are plus and minus numbers.  Start with taking a screen shot of this working mixer table.  I think you will only have 3 active mixer table columns.  Say that Ch1 is throttle, Ch2 is left (bottom) elevon and Ch3 is right (bottom) elevon.
- duplicate (hand type) the left elevon servo mixer table column (2) onto the 4th (first unused) column (set as type=servo).  If needed we will handle the fact that this all needs to be reversed by reversing the servo on the Output page.
- duplicate the right elevon servo mixer table column (3) onto the 5th column.
- save it and reboot the FC.
- go to the Output page and make sure these new servos (should be listed as Servo 3 and 4 on the Output page, but columns 4 and 5 in the mixer table) have the same values for Min, Neutral, Max, and Reversed as for the original servos.  Basically Servo3 should be the exact same as Servo1, (and 4 the same as 2).
- do not change anything in Servo1 or Servo2 since they are both working correctly.
- now, do these top servos need to be in the same or opposite directions as the bottom ones?  consider the two left wing servos.  does the splined output arm shaft point out (toward that wing tip) on one and in (towards the center) on the other?  if so, change the Reversed check box for the new servo (e.g. Servo3).  If both servo output shafts point in the same direction, then both Reversed boxes (Servo1 with Servo3 and Servo2 with Servo4) must match.
- that assumes your output shafts point in to center or out to tip and that the servo arm points away from the wing.  if these are not true or too confusing, just try it as it (the Reversed box on the newly configured servo output) is.  Leave it alone if it is correct, change the Reversed box if it is not correct and that should make it work.
- note that when you change the Reversed check box, it swaps Min and Max.
- save and reboot the FC
- convince yourself that the top servos are moving in the correct direction for elevator and aileron stick motions by watching the top left servo arm and the left connected control surface (same for right), but don't connect the top servo linkages yet.

Phew!!!  Now we do some surgery on the curves in the mixer table:
- the throttle values are different than other channels, so the graphs will look funny, but the numbers will be correct?  I hope there isn't some offset / scale coded for the throttle channel.
- set Curve1 Advanced to be 0.0, 0.0, 0.0, 0.5, 1.0 (these both are bottom to top, Min to Max)
- set Curve2 Advanced to be -1.0, -0.5, 0.0, 0.0, 0.0 (Source = Throttle)
- save and reboot the FC

And finally we change the mixer table throttle and yaw.  Are you cross-eyed yet? :
- So assuming Ch2 is the bottom left wing servo, it must spread (downward=apart) on left rudder stick and stay centered on right rudder stick.
- Ch2, you have 4 options.  Choose which ONE works to make your rudder stick work correctly for that wing servo. +127 on Curve1, -127 on Curve1,  +127 on Curve2, -127 on Curve2.  I think it will be Curve2 since Curve2 moves on the left side but is centered on the right side.  Another wild guess is that the sign of the number will be the same as the sign of the aileron mixer table number for that servo.  whatever.  just pick the one that works for that servo.
- do the same for Ch3, Ch4, and Ch5 to get all the wing servos working as desired.
- wow, do all servo functions now work the way you need them to work? ? ?  aileron, elevator, and rudder?
- connect the top servo linkages and adjust in enough slop so the servos don't fight each other at any stick positions.

To get the motor running:
- REMOVE THE PROP
- Mixer table column "Ch1" (type=Motor) is your motor output?  so set the whole column to zeros except for Yaw=127 and Save.
- Understand that after the next line, the motor is always actively controlled by the throttle stick!!!  Depending on your ESC brand, you must be careful that the throttle stick is low when getting ready to fly ... just like a normal airplane.  I think the motor will not start up if the battery is plugged in with the transmitter powered off, but you should check this yourself (with prop off).  Check all the careless scenarios you might do to understand what happens.
- set Input page Arming Settings, to Always Armed.  Save.
- Turn transmitter on.  Understand that you should unplug the battery and not wiggle sticks if the motor beeps as discussed below...  By "beeps" I mean the "I am going into programming mode beeps" as opposed to the normal startup beeps.  Unplug all power to FC / receiver.  power the FC with a battery, and verify that throttle stick controls the throttle.  If throttle is backwards (motor starts beeping), unplug the battery without moving the throttle stick, plug in USB only, set to "Always Disarmed", reboot FC, go to Output Page and change the Reversed box for <<<YAW>>> and Save and set it back to Always Armed, and try that.

I would start with a configuration that reduces the amount of rudder.  One way is by cutting rudder throw in half at the transmitter, but read on for a better way that sets smaller numbers in the mixer table.

I have found that flying wings need generally small amounts of aileron and larger amounts of elevator.

Beware that if the servo is at it's limit because of the rudder, that you won't get any more out of it when aileron asks for even more on that servo in that direction.  For that reason, you may want to change all the 127's associated with servos in the mixer table to something smaller.  Leave the motor yaw value at +-127.  For instance 3 42's only add up to 126.  I would probably start with 42's and determine which channels need to be more or less than that.  Maybe you need a lot of rudder, very little aileron, and medium elevator, then use say 63's for curve1 and curve2 (where rudder is really connected), 24 for aileron, and 40 for elevator.  There is no way for the max on all sticks to add up to more than 127.  I would actually start with something like this rather than all 127's (and don't limit the rudder with a transmitter setting).

I probably forgot something or assumed something, etc.  Post back if you run into issues.  Post back whether it works or not.  :)

How many people who read this far think this deserves the "Hack of the Year" award?  :)
« Last Edit: November 30, 2019, 11:43:17 am by TheOtherCliff »

Re: Is it possible to configure four servos for ailerons
« Reply #8 on: November 30, 2019, 06:04:29 pm »
Hallo Again,
And what a monster of a detailed explanation. The Idea to use the throttle curve is brilliant a but sadly I was not able to make it work :(
First, I had the problem that the throttle curve couldn't be adjusted to negative values (with the systems tab I tried it anyway).
Second, no matter what I tried I was not able to make the motion "smooth", basically at the end of my throttle movement they would jump back, only move in the inner 25-50% area, or would correctly work on one side, but always tried to move on the other when they shouldn't.
Then all the sudden, I wasn't able to save anymore, and everything went haywire after that.
At the moment, I'm back to the behavior where every servo has its end in the middle of the wing even if I still like your solution more :S .. maybe I made some glaring mistakes. Oh and I also managed to get it to work on one side, but when I flipped it nothing would work on the other :S

Re: Is it possible to configure four servos for ailerons
« Reply #9 on: November 30, 2019, 09:34:41 pm »
It's possible that these throttle curves don't work over the same range, given that the normal usable throttle range is 0 to 1, but the curve that allows other than throttle as an input certainly must allow for the range of a non-throttle channel to be -1 to 1.  It's possible that something is going on here because of that.  I discount that idea because we generally write code to be "unsurprising".

First, I had the problem that the throttle curve couldn't be adjusted to negative values (with the systems tab I tried it anyway).
It works for me.  I can set it in Configuration->Vehicle->Custom, or in System->Settings
The values you must use are from -1.0 to +1.0, they are not percent as System->Settings labels them.


Second, no matter what I tried I was not able to make the motion "smooth", basically at the end of my throttle movement they would jump back, only move in the inner 25-50% area, or would correctly work on one side, but always tried to move on the other when they shouldn't.
If you got it working on one side, then it is doable.  :)
This sounds a little like the curve was not set up correctly.  If you set the curves the way it is in the picture, then one of the four ways should work for each servo. +127 curve1, -127 curve1, +127 curve2, -127 curve2

Actually, it is probably better to just use +-42 everywhere you would normally use +-127 (except you must leave the motor mixer table column using 127 of yaw).  If you use 127 then you will see each control work correctly by itself, but you will not be able to give full stick on two controls at the same time without confusing things happening because a servo can't go farther than max.

Then all the sudden, I wasn't able to save anymore, and everything went haywire after that.
Under some conditions, "Always Armed" will keep you from saving settings.  You must change "Always Armed" to "Always Disarmed", ?reboot the FC?, before you can change settings again.  Always Armed should only be needed to get the motor running, so I would leave it Always Disarmed till you get the servos working, then get the motor working last.

Oh and I also managed to get it to work on one side, but when I flipped it nothing would work on the other :S
If you got it working on one side, then it is doable.  :)
You must set up the curves correctly.  There are several ways that are correct, but I suggest you start with the way shown in the picture.
« Last Edit: November 30, 2019, 10:02:02 pm by TheOtherCliff »