Quote:
Originally Posted by 2386programming
Code:
double mFL = strafe + forward + rotation;
double mFR = strafe + forward - rotation;
double mRL = strafe - forward + rotation;
double mRR = strafe - forward - rotation;
This is my code for regular driving for mecanum but I feel that if I inverted the motor not everything else would be the same.
|
The correct inverse kinematics for mecanum is:
Code:
double mFL = forward - strafeRight - rotateClockwise;
double mFR = forward + strafeRight + rotateClockwise;
double mRL = forward - strafeRight + rotateClockwise;
double mRR = forward + strafeRight - rotateClockwise;
If the above doesn't work, it's better to do the necessary motor inverting/swapping to make it work, rather than changing the signs of the kinematics.