|
Re: Mechanum with XBox Controller
for mechanum wheels, our team also uses a Xbox controller. We have the right joystick axis mapped to the linear movement of the robot, and the the left joystick x axis mapped to the rotation.
Here's a simplified version of our code:
//FLMotor = Front Left Motor
//FRMotor = Front Right Motor
//BLMotor = Back Left Motor
//BRMotor = Back Right Motor
//x = right joystick, x axis
//y = right joystick, y axis
//yaw = left joystick, x axis
FLMotor = y + x + yaw
FRMotor = y - x - yaw
BLMotor = y - x + yaw
BRMotor = y + x - yaw
The values will have to be limited, other-wise it will go beyond the accepted values (-1 to 1). Make sure the wheels are set up properly, and good luck!
|