I am trying to make PIDs that will calculate jerk and jounce from the accelerometers on the phone. I was able to build a functional version using this equation for jerk:
([ff1251]RDLY(2:[ff1251])/.01*9.80665
and this equation for jounce:
(([eabe3e][eacc75])/.01)/1000
Where the two PIDs are the PIDs for the current jerk and the jerk for the previous timeframe. For both I had to lock the minimum refresh rate at 10ms.
It works but there are issues in the precision of accelerometer data and in calculating the derivative without being able to access the timestep between data pulls. The accelerometers are only using a 2 digit precision but when the sensor data is saved by the data logger they show far more precision available.
I also cannot figure out how to reference the time of each poll or the timestep between two polls. It would be nice if there was a simple time derivative function available but I’d imagine the time stream can be referenced somehow? I just cant figure out how!
Tl;dr is it possible to call the raw data stream for the g sensors like the data logging function does in a PID formula? And is there a way for me to access the time that a sensor was polled in a PID formula?
