Proportional servo reflection

Post Reply
universam
Posts: 14
Joined: Thu Nov 20, 2014 4:41 pm

Proportional servo reflection

Post by universam »

In our club the discussion why MWII and Baseflight are currently not ready for serious fixed wing & flying wing usage is that it kind of a strange servo reflection. Honestly, in 30 years RC I haven't seen one single TX working like this. :?
As long as you keep servo middle at 1500 and max at 1000/2000 everything is fine, the problem is how MWII/Baseflight work when you change one / more of these settings: One side will be constrained and the other reflection wont be reached... This is a no-go for serious planes where you need asymetric servo reflection for flaps, ailerons and so forth

For better understanding see the illustration, left the current problem and right the result of the change.

Actually it is very easy to improve! With this changes MWII will work proportional and respect the max & min servo reflection. So a full extension of your stick will result in the max/min servo reflection.

When you think twice, you realize that now only min / mid / max is of interest, the servo rates dont make sense any more :o . But for compatibility I left that in calculation, as long as you keep it on 100 it really means 100%. A different value here could be also done, but I have no idea for an application.

The code changes simple!
Airplane mod, replace one line ~1336

Code: Select all

    for(i=3;i<7;i++) {
      // servo[i]  = ((int32_t)conf.servoConf[i].rate * servo[i])/100L;  // servo rates
    
    // propotional Servo patch
       // here we honor the servo rate and reversing! if rate is 100 we get full propotional path
       int32_t path = (int32_t)conf.servoConf[i].rate * servo[i];
           // depending on the side the left path to max/min is different so taking that in account for propotional path
       servo[i] = (path*(path>=0 ? conf.servoConf[i].max-conf.servoConf[i].middle:conf.servoConf[i].middle-conf.servoConf[i].min))/(100L*500L); 

      servo[i] += get_middle(i);
    }


Fixed Wing mod, replace ~1231 - this should be probably aligned to 2.4

Code: Select all

   for (i=3; i<=4; i++) {
    if (f.PASSTHRU_MODE) {    // do not use sensors for correction, simple 2 channel mixing
      servo[i] = (SERVODIR(i,1) * rcCommand[PITCH])*PITCHRATE + (SERVODIR(i,2) * rcCommand[ROLL])*ROLLRATE;
    } else {                  // use sensors to correct (gyro only or gyro+acc according to aux1/aux2 configuration
      servo[i] = (SERVODIR(i,1) * axisPID[PITCH])*PITCHRATE   + (SERVODIR(i,2) * axisPID[ROLL])*ROLLRATE;
    }
           // depending on the side the left path to max/min is different so taking that in account for propotional path
   servo[i] = (int32_t) servo[i]*(servo[i]>=0 ? conf.servoConf[i].max-conf.servoConf[i].middle:conf.servoConf[i].middle-conf.servoConf[i].min)/500;
        servo[i] += get_middle(i);
   }



Just for noting that, this code is currently being flown by several guys in our club with great success. I'm flying this already since months, and have no drawback. A sentence regarding the calculation time - I counted 37 more instructions in sum and the round trip could be a bit longer but I was unable to see any differences than before. So I can confirm it not realy time consuming.

I really hope this or something similar would go into master for the future.

Comments welcome!
Sam
Attachments
Servo problem of asymetric reflection
Servo problem of asymetric reflection

nppc
Posts: 1
Joined: Thu Feb 12, 2015 11:39 am

Re: Proportional servo reflection

Post by nppc »

+1
It is true. I'm flying this mod too and can say it makes sense. My butterfly (brakes) mode on my glider is realy butterfly with full deflection of flaps and ailerons.

Thank you for considering this addition to the core of MWII.

Pavel

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Proportional servo reflection

Post by PatrikE »

A modified Output file for evaluation added in this thread.
viewtopic.php?f=7&t=2456&p=61468#p61468

Post Reply