See the
MecanumDrive_Cartesian() function in the RobotDrive class:
Code:
void RobotDrive::MecanumDrive_Cartesian(float x,
float y,
float rotation,
float gyroAngle = 0.0
)
Pass in the X and Y coordinates of one stick, and pass the X coordinate of another stick to serve as the "rotation" rate, and then finally pass in an angle from the gyro to the `gyroAngle` field to rotate your cartesian x/y inputs relative to your robot's orientation. That way, pushing "forward" on your x/y joystick will always translate to the direction that your robot absolutely considers true 0 degrees based on your gyro feedback, no matter which direction the robot is actually facing.
You will only need to use the gyro if you want your controls to be "field-oriented," such that pushing forward on your joystick means the robot always heads directly away from you, no matter which way it is pointing. If you want it to be "robot-oriented," such that forward on the joystick always means the robot travels in the direction that its front face is pointing, just pass a 0 to the `gyroAngle` field of the function.