Coordinate System for Mecanum Drive

OK So what is the coordinate system used for Mecanum.driveCartesian?

This documentation https://github.wpilib.org/allwpilib/docs/release/java/edu/wpi/first/wpilibj/drive/MecanumDrive.html says it’s using NWU so the second parameter is positive to the left. However, this document https://docs.wpilib.org/en/stable/docs/software/hardware-apis/motors/wpi-drive-classes.html shows positive to the right and positive down.

The example mecanum project shows the first coordinate system (positive forward, left, up) with :

m_robotDrive.driveCartesian(-m_joystick.getY(), -m_joystick.getX(), -m_joystick.getZ());

But the lateral and rotation are both backward, so to get the system to drive correctly we have to use:

m_robotDrive.driveCartesian(-m_joystick.getY(), m_joystick.getX(), m_joystick.getZ());

Which is positive forward/right/down.

The API docs and example projects are correct. That docs article is out-of-date and incorrect: Axis conventions documentation incorrect for Mecanum Drive. Still states it is NED, rather than NWU as listed in changes for 2023. · Issue #2134 · wpilibsuite/frc-docs · GitHub

This is also being discussed here: https://www.chiefdelphi.com/t/robotpy-mecanum-drive-robot-rotation/426068. I’m going to go through the robot (again) with a fine tooth comb, verify wiring, motor ids, the whole kit and caboodle; but in it’s current state, if I call m_drive.driveCartesian(0.0,0.5,0.0) the robot moves right not left.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.