|
Re: Mechanum with XBox Controller
Quote:
Originally Posted by Ethan_P
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!
|
We do something very similar to this. I don't want to hijack this thread but how are you limiting the values? Right now in our rough code we have a mess of if-elses determining if the values are over 1. I imagine that there is a better way to do this?
Last edited by jszipszky : 09-01-2015 at 19:10.
|