Is there a way to "mix" channels in Phil's encoder but keep full travel?

Arduino projects on the go
Post Reply
FBMinis
Posts: 55
Joined: 25 Feb 2018, 17:59

Is there a way to "mix" channels in Phil's encoder but keep full travel?

Post by FBMinis »

The sketch includes a 50:50 and a 75:25 mix but I've been playing with an "MPX Fox" converted to pitcheron and, due to the position of the servos (my mistake), I need more servo travel. Is it possible to mix elevator and rudder channels but keep servo movement all the way between 1000 and 2000us? Like a "100:100" mix..

Originally:

Code: Select all

         if (mix_option == 2) {
         channel[0]*=.75;
         channel[1]*=.25;
         chtemp=channel[1];
         channel[1]=channel[0]+600-channel[1];
         channel[0]+=chtemp;
         }
         
Last edited by FBMinis on 25 Jul 2018, 10:03, edited 1 time in total.
Scott Todd
Posts: 66
Joined: 26 Mar 2018, 23:21

Re: Is there a way to "mix" channels in Phil's encoder but keep full travel?

Post by Scott Todd »

You have to be careful to not overdrive them. Youprobably don't need as much throw as you think.

Otherwise its a good question. I have tinkered with the mixers a bit but haven't dove in real hard. I want to set up an aerobatic Sloper. I want snap flaps for better inverted maneuvers but I also want Spoilerons for spot landing. So I need to mix elevator to two different channels (Ail and 5/6) but not mix them back to elevator. All my gliders have it set-up (on modern computer radios) and it really makes landing in tight places easier.

I have enabled the mix switches to work all the time.

Lots of fun stuff to do, just a bit lacking in coding skills :)
FBMinis
Posts: 55
Joined: 25 Feb 2018, 17:59

Re: Is there a way to "mix" channels in Phil's encoder but keep full travel?

Post by FBMinis »

FBMinis wrote: 25 Jul 2018, 01:31 The sketch includes a 50:50 and a 75:25 mix but I've been playing with an "MPX Fox" converted to pitcheron and, due to the position of the servos (my mistake), I need more servo travel. Is it possible to mix elevator and rudder channels but keep servo movement all the way between 1000 and 2000us? Like a "100:100" mix..

Originally:

Code: Select all

         if (mix_option == 2) {
         channel[0]*=.75;
         channel[1]*=.25;
         chtemp=channel[1];
         channel[1]=channel[0]+600-channel[1];
         channel[0]+=chtemp;
         }
         
Any help would be appreciated.

I tried something and it worked but occasionally the servos would move erratically, particularly near center joystick so I stopped.

In pseudo-code:

Code: Select all

         
         if (mix_option == 2) {
         channel[0]*=.75;
         channel[1]*=.25;
         chtemp=channel[1];
         channel[1]=channel[0]+600-channel[1];
         channel[0]+=chtemp;
         
         findChannel[0]maxAndMin();
         findChannel[1]maxAndMin();
         
         RemapBothChannelsMaxAndMinTo1000-2000();
         
         ConstrainChannelsTo1000-2000(); //to avoid going over full extention
         }
         
[/quote]
Pchristy
Posts: 413
Joined: 16 Feb 2018, 13:57
Location: South Devon, UK

Re: Is there a way to "mix" channels in Phil's encoder but keep full travel?

Post by Pchristy »

There are several reasons why this is not a good idea! First of all, if you do a 50/50 mix, then move the stick diagonally, you will find one servo doesn't move, but the other goes through 100% of its travel! Moving the stick along the other diagonal will drive the other servo through 100% of its travel. If you made the mix 100:100, then moving the stick diagonally would 1) try and drive a servo to 200% travel and 2) since the output of the encoder is PPM, it would reduce the transmitted pulse width below the possible limit in one direction, and over the max limit in the other!

Either case will result in a failure of some kind!

If you need more travel, you will have to use longer servo arms or some other mechanical means to do it.

--
Pete
User avatar
Mike_K
Posts: 669
Joined: 16 Feb 2018, 06:35
Location: Hertfordshire

Re: Is there a way to "mix" channels in Phil's encoder but keep full travel?

Post by Mike_K »

You can do what you are asking, but it'll probably work differently to how you think.

What Pete has written above is 100% correct for a normal elevon or v-tail mixer, with the sticks in the corner, one servo will be at 100% movement, the other will not move.

What I have done in the past when playing around with my own encoder is to have a 100:100 mix, but limited both of the outputs from the mixer to a minimum of 1000uS and a maximum of 2000uS.

With an elevon mixer, full elevator moves both servos to full deflection to give a very tight loop and and full ailerons move both servos to full deflection to give the fastest roll rate. BUT (and it is a very big but) if you hold full elevator and start applying aileron (for elevons), one servo starts moving back to centre to give the rolling movement until the stick is in the corner and you are back to one servo full movement the other is centre.

I'm not too familiar how Phil has done his mixing, but if I use a generic terms, a mixer works as follows:

output1 = ail.input * ail.mix% + ele.input * ele.mix%
output2 = ail.input * ail.mix% - ele.input * ele.mix%

if you allow 100:100 mix you need to add the following after the mix calculations

if (output1 < -100%) output1 = -100%;
if (output1 > 100%) output1 = 100%;
if (output2 < -100%) output2 = -100%;
if (output2 > 100%) output2 = 100%;

I'll leave you to sort the actual coding out.

If you have a delta and want to be a hooligan, its great!! When I tried it with a 38" mini version of a 362 delta, it would loop so tightly that it often stalled out. And a 362 has never rolled so fast. But in some ways it was pointless as I usually flew it on reduced rates to calm it down and a normal 40:60 mix (you need more ele on a 362 delta) would have worked just as well.

Cheers

Mike
Scott Todd
Posts: 66
Joined: 26 Mar 2018, 23:21

Re: Is there a way to "mix" channels in Phil's encoder but keep full travel?

Post by Scott Todd »

Depending on your receiver and servos, they will probably go a little further than 1000-2000. It would have to be trial an error to find the max.

Any coders out there that can help me understand where the 1500 comes from in Phil's PPM code? It should be straight forward but I can't figure it out. He reads the pots and ranges them from -500 to 500. Then when he builds the PPM stream, he adds the 300 sync pause. Where does the other 1200 get added in?
User avatar
Phil_G
Posts: 596
Joined: 15 Feb 2018, 23:32
Contact:

Re: Is there a way to "mix" channels in Phil's encoder but keep full travel?

Post by Phil_G »

Scott Todd wrote: 31 Jul 2018, 17:34Any coders out there that can help me understand where the 1500 comes from in Phil's PPM code? It should be straight forward but I can't figure it out. He reads the pots and ranges them from -500 to 500. Then when he builds the PPM stream, he adds the 300 sync pause. Where does the other 1200 get added in?
The 300uS is the width of the PPM pulse, nothing to do with the sync pause Scott...
and the 1200 is added where the frame is formatted. Its defined early on:

static int neutralPulse = 1200;
.
.... then...
.
// format the frame
channel[7]=0; // 8th element is sync
for (ch=0; ch<7; ch++) {
channel[ch]+=neutralPulse;
channel[ch]=constrain(channel[ch], 600, 1800);
if (reverse[ch] ==1) channel[ch] = 2400-channel[ch];
channel[7]+=channel[ch];
}

to keep the framerate fairly constant, the eighth channel element totals all the channel values, then this is taken off the sync.
Scott Todd
Posts: 66
Joined: 26 Mar 2018, 23:21

Re: Is there a way to "mix" channels in Phil's encoder but keep full travel?

Post by Scott Todd »

I got it!!!

I was stupid. I had lunch with a friend that's a former EE and plays with C and C+ code. I printed it out to go over it with him after we ate. I was stepping him thru the code and I found my own ignorance. Having it printed out might have helped.

I kept plugging in 300 for the neutralPulse in the format section. So STUPID!!! That's where the 1200 comes in and the 300 gets added in as a delay. So clear and obvious! I feel like a tool.

Thank you for answering Phil. I know you are busy. I'm having an absolute blast with your code :) I think I'm up to 21 transmitters running it now.
Post Reply