How do you use intertial sensor with mecanum wheel?

So i want to use a inertial sensor for my mecanum robot. I want to use it to correct the mecanum function because sometime it dosn’t turn right. But i tried to read some post but i find them a bit confusing so if someone can show me how to use the inertial sensor this could be cool!

thx in advance!

If all you want to do is turn using the inertial sensor then just set the motors and use a wait until command.

// Spin left and right motors in opposite directions 
waitUntil(inertialSensor.heading >= 90);
// Stop motors

This does have a tendency to overshoot. If you want it to be more accurate you may want to look into using a PID.


what exaclty is a PID?

PID is a control method that calculates for overshoot and then corrects it. I would recommend just using a P or PD loop which is much simpler. I used this document to program mine.
pid_control_document copy.pdf (141.0 KB)


That document is very helpful; there’s an updated version available here:

1 Like