View Single Post February 4th, 2022, 06:26 PM   #89
Peter Nachtwey
Member  Join Date: Apr 2002
Location: The land of the woke and the home of the broke
Posts: 7,966
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 := rAcceleration; rVelocityEMA := rVelocityEMA; rVelocity := rVelocity; rPosition := rPosition; rPosition := rPosition; rPosition := LocalIOHere; rVelocity := (rPosition-rPosition)*(60*1000)/tSampleRate.PRE; rAcceleration := (rVelocity-rVelocity)*(60*1000)/tSampleRate.PRE; rJerk := (rAcceleration-rAcceleration)*(60*1000)/tSampleRate.PRE; end_if; //Filter rAlpha := 1; rVelocityEMA := trunc((rAlpha*rVelocity+(1-rAlpha)*rVelocityEMA)*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.
https://deltamotion.com/peter/Videos/AlphaBetaGamma.mp4
The alpha-beta-gamma filter is just a simplified form of a steady state Kalman filter.

https://www.kalmanfilter.net/alphabeta.html
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon 