Log in

View Full Version : How do I use Robotdrive.h?


Darkseer54
17-10-2013, 19:38
Salutations from Team 1086! I am a new programmer and I am trying to set up Cartesian Mecanum code for our robot. I am trying to set up halo drive. In other words, I want to have one joystick control the forward/backward movement and strafing, while another joystick controls rotation. My question is, how can I use the WPI Library's Robotdrive.h? What can I use from this?
Thanks!
Zach
1086 Blue Cheese

mikets
17-10-2013, 21:18
Let's say you have the leftDriveStick and the rightDriveStick. The right stick X and Y will be the forward/backward and strafe. The left stick X will be the rotate.

Joystick leftStick;
Joystick rightStick;
RobotDrive robotDrive;

float x = DEAD_BAND(rightStick.GetX());
float y = DEAD_BAND(rightStick.GetY());
float rot = DEAD_BAND(leftStick.GetX());

robotDrive.MecanumDrive_Cartesian(x, y, rot);