Is it possible to use an Inertial sensor for strafe PID

For context, we have a mechanum drivebase and already have a drive and turn PID. we are trying to decide between an internal sensor, a strafe encoder, or a combination of both. Since we used an inertial sensor for the turning PID, I was wondering if it would be possible to use an inertial sensor for strafe PID, and can you combine it with an encoder to get a more accurate strafe position?

while it is theoretically possible to integrate the acceleration values twice to find robot displacement, in reality the sensor does not refresh often enough for this to work with any sort of accuracy.

So no, you can’t use the inertial sensor to accurately track robot displacement.


Ok but I was looking at the Vexcode Api Refernce website in the inertial section and there is a class called vex::inertial::matrix which has a function called transform. is that a plausible option.

it’s really not, the sensor updates too infrequently for it to be possible to get an accurate displacement from it. You can try it for yourself though and see why.

The math would look something like:

Velocity += Acceleration
Position += Velocity

which would work, if the sensor was near perfect and had an almost instant refresh rate. But it does not, so your position value will quickly be thrown far off from any reasonable margin of error.


The API doesnt explain exactly what that function does but it very well could be only a 3x3 rotation matrix not a full 4x4 transformation matrix.

@jpearman that right?,%20double%20&y,%20double%20&z)/vex::inertial::matrix/function

My team tried this last year, and on top of what Xenon said, the values aren’t nearly accurate enough to work even if it refreshed quicker. If I remember right it was accurate to around .01 G, which is fine for most uses but is not accurate enough for position measurement, given that 1 G is around 380 in/s^2


Oh ok. Thank you guy’s for your help

I dont think you meant to categorize this in #vrc-discussion:vrc-starstruck-16-17. Please change the category to #v5-technical-support or #programming-support