Quote:
Originally Posted by Taylor Turner
Checking the rate of stuffs
Code:
//Sets sample rate
tonr(tSampleRate);
tSampleRate.PRE := 100;
if not tSampleRate.DN then
tSampleRate.Reset := 0;
tSampleRate.TimerEnable := 1;
else
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;
end_if;
//Filter
rAlpha := 1;
rVelocityEMA[0] := trunc((rAlpha*rVelocity[0]+(1rAlpha)*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 alphabetagamma and alphabetagammadelta filter built in. These far not available on the RMC150 and RMC75.
Check this out.
https://deltamotion.com/peter/Videos/AlphaBetaGamma.mp4
The alphabetagamma filter is just a simplified form of a steady state Kalman filter.
https://www.kalmanfilter.net/alphabeta.html