RC_input and the cure for parkinsons

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
User avatar
Plüschi
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

RC_input and the cure for parkinsons

Post by Plüschi »

RC input for PPM SUM does shake quite a bit. Usually by 4us, caused by quantization due to the 4us resolution of the internal arduino timer. To remedy this parkinson shake there is a 4 values averaging filter (and some code i dont understand). This works quite well, but does limit the RC input to 250 steps (1ms / 4us).

I dont understand WHY this filter is active when a parkinsons-free spektrum sat is attached. Or when an equaly parkinsons-free futaba SBUS is attached. Makes no sense to limit the resolution of 1024 / 2048 spektrum signals or the 4096 futaba signals to a resolution of 250 steps.

I have run a filter-less version with frsky ppm-sum and this does shake quite a bit. The same filterless version with orangerx sat and orangerx sbus do not shake at all. Not a bit. Not even +1 if you dont tap the table :)

Lets exclude this filer except for standard / ppmsum input.

Gimbal
Posts: 146
Joined: Tue Jul 24, 2012 7:14 pm
Location: Sweden

Re: RC_input and the cure for parkinsons

Post by Gimbal »

pls post that part of code, will try sbus with out it

User avatar
Plüschi
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: RC_input and the cure for parkinsons

Post by Plüschi »

In rx.ino i have stripped this filter except for ppm_sum.
Note this is quite different to standard, its a data driven routine needing changes in drivers and main.

Code: Select all

bool computeRC() 
{
  uint8_t chan,a;
  #if defined(SBUS)
    readSBus();
    if (RcFrameData == 0x01)
    {
      RcFrameData = 0x00;
      for (chan = 0; chan < RC_CHANS; chan++) rcData[chan] = rcValue[rcChannel[chan]];
      return true;
    }
  #elif defined(SPEKTRUM)
    if (spekFrameFlags == 0x01) readSpektrum();
    if (RcFrameData == 0x01)
    {
      RcFrameData = 0x00;
      for (chan = 0; chan < RC_CHANS; chan++) rcData[chan] = rcValue[rcChannel[chan]];
      return true;
    }
  #elif defined(SERIAL_SUM_PPM)
    if (RcFrameData == 0x01)
    {
      RcFrameData = 0x00;
      rc4ValuesIndex++;     
      if (rc4ValuesIndex == 4) rc4ValuesIndex = 0;
      #if !defined(RAWPPMSUM)
        for (chan = 0; chan < RC_CHANS; chan++)
        {
          rcData4Values[chan][rc4ValuesIndex] = rcValue[rcChannel[chan]];
          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;
        }
      #else
        for (chan = 0; chan < RC_CHANS; chan++) rcData[chan] = rcValue[rcChannel[chan]];
      #endif
      #if defined(FAILSAFE)
        if(rcValue[rcChannel[THROTTLE]]<FAILSAFE_DETECT_TRESHOLD) return false;
        else if(failsafeCnt > 20) failsafeCnt -= 20; else failsafeCnt = 0;
      #endif
      return true;
    }
  #endif
  return false;
}

Gimbal
Posts: 146
Joined: Tue Jul 24, 2012 7:14 pm
Location: Sweden

Re: RC_input and the cure for parkinsons

Post by Gimbal »

thnx, nice job

Post Reply