TX Stick inverting

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
chris_kmn
Posts: 31
Joined: Sun Jun 09, 2013 11:11 am

TX Stick inverting

Post by chris_kmn »

Hi guys,

as I want to control multiple copters with different boards, but with only one TX setup, I tried to integrate a "function" in MultiWii 2.2 to inverse stick travel:

RX.ino:

Code: Select all


/**************************************************************************************/
/***************          compute and Filter the RX data           ********************/
/**************************************************************************************/
void computeRC() {
  static uint16_t rcData4Values[RC_CHANS][4], rcDataMean[RC_CHANS];
  static uint8_t rc4ValuesIndex = 0;
  uint8_t chan,a;
  #if !(defined(RCSERIAL) || defined(OPENLRSv2MULTI)) // dont know if this is right here
    #if defined(SBUS)
      readSBus();
    #endif
    rc4ValuesIndex++;
    if (rc4ValuesIndex == 4) rc4ValuesIndex = 0;
    for (chan = 0; chan < RC_CHANS; chan++) {
      #if defined(FAILSAFE)
        uint16_t rcval = readRawRC(chan);
        if(rcval>FAILSAFE_DETECT_TRESHOLD || chan > 3) {        // update controls channel only if pulse is above FAILSAFE_DETECT_TRESHOLD
          rcData4Values[chan][rc4ValuesIndex] = rcval;
        }
      #else
        rcData4Values[chan][rc4ValuesIndex] = readRawRC(chan);
      #endif
      rcDataMean[chan] = 0;
      for (a=0;a<4;a++) rcDataMean[chan] += rcData4Values[chan][a];
      rcDataMean[chan]= (rcDataMean[chan]+2)>>2;
      if ( rcDataMean[chan] < (uint16_t)rcData[chan] -3)  rcData[chan] = rcDataMean[chan]+2;
      if ( rcDataMean[chan] > (uint16_t)rcData[chan] +3)  rcData[chan] = rcDataMean[chan]-2;
    }
   
//********************************************************************
//*********************** Stick inverting *************************

   #ifdef ROLL_INV
   rcData[ROLL] = 3000 - rcData[ROLL];
   #endif

   #ifdef PITCH_INV
   rcData[PITCH] = 3000 - rcData[PITCH];
   #endif

   #ifdef YAW_INV
   rcData[YAW] = 3000 - rcData[YAW];
   #endif

//*********************** END Stick inverting *************************
//************************************************************************

  #endif
}




So far it works with my quadcopter. I put the constants into the config.h, Section 3:

Code: Select all


//************************************************************************
//***********************   Stick inverting ****************************

     // Uncommenting following line inverts TX Stick travel
    // #define ROLL_INV
    #define PITCH_INV
    #define YAW_INV


//***********************   END Stick inverting ***********************
//************************************************************************





Any ideas, issues or improvements ??
Last edited by chris_kmn on Sun Jun 09, 2013 3:37 pm, edited 2 times in total.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: TX Stick inverting

Post by Hamburger »

Why not reverse channel signal in tx once and for all associated copters?
If signal is wrong then it is for all rx attached or do you have some rx which reverse some signals on their own?

chris_kmn
Posts: 31
Joined: Sun Jun 09, 2013 11:11 am

Re: TX Stick inverting

Post by chris_kmn »

I have some multicpoter controller boards (no multiwii) where I neither have the source code nor do I have a feature to reverse the channels on the board. Unfortunately they have different directions/travels on the axes.
And I want to avoid creating individual models in my TX. Just want to have one copter profile to handle all my multicopters.

Well, I just wanted to know if there are more pilots with the same problem. For me this way works fine, but I bet that there is a more straight forward way to implement it.

Post Reply