View Single Post
Old February 4th, 2022, 07:26 PM   #89
Peter Nachtwey
United States

Peter Nachtwey is offline
Peter Nachtwey's Avatar
Join Date: Apr 2002
Location: The land of the woke and the home of the broke
Posts: 8,023
Originally Posted by Taylor Turner View Post
Checking the rate of stuffs

//Sets sample rate
tSampleRate.PRE := 100;

if not tSampleRate.DN then
    tSampleRate.Reset := 0;
    tSampleRate.TimerEnable := 1;
    tSampleRate.Reset := 1;
    tSampleRate.TimerEnable := 0;
    rAcceleration[1] := rAcceleration[0];
    rVelocityEMA[1] := rVelocityEMA[0];
    rVelocity[1] := rVelocity[0];
    rPosition[2] := rPosition[1];
    rPosition[1] := rPosition[0];
    rPosition[0] := LocalIOHere;
    rVelocity[0] := (rPosition[1]-rPosition[0])*(60*1000)/tSampleRate.PRE;
    rAcceleration[0] := (rVelocity[1]-rVelocity[0])*(60*1000)/tSampleRate.PRE;
    rJerk := (rAcceleration[1]-rAcceleration[0])*(60*1000)/tSampleRate.PRE;

rAlpha := 1;

rVelocityEMA[0] := trunc((rAlpha*rVelocity[0]+(1-rAlpha)*rVelocityEMA[1])*100)/100;
I would like to see a trend of your calculations. The problem I see is that there is nothing that guarantees the samples are taken at equal intervals. That messes up the calculations due to sample jitter.

The RMC200 has an alpha-beta-gamma and alpha-beta-gamma-delta filter built in. These far not available on the RMC150 and RMC75.

Check this out.
The alpha-beta-gamma filter is just a simplified form of a steady state Kalman filter.
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote