# Inertial Sensor Driving Forward

Can the new inertial sensor be used to send back info on driving straight forward therefore to be used to drive forward for a certain distance?

I believe that you can do that using higher order mathematics like integration. As acceleration is the 2nd Derivative of Position and the inertial sensor has an accelerometer

Do you have any example code? And how do you take the 2nd derivative of position (acceleration) and put that into code.

It’s actually the second integral of acceleration (first integral of acceleration is speed, first integral of speed is distance).
An example code would be:

speed += acceleration
distance += speed

Obviously you’d need to format and adjust for VexCode. However, this type of code is likely to have a large margin of error, determined by the speed of the V5 brain’s computer.

2 Likes

So it is basically not possible and the sensor should only be used to take corners?

It’s possible, but (as far as I know) not predictable or precise. So yes I would suggest using the sensor only for measuring rotation (taking corners).

1 Like