Log in

View Full Version : Inverse Motors?


KyleS
16-02-2012, 13:31
First time working with the WPIlib, not exactly sure how to inverse the motors when using the simple Arcade drive. Any ideas?

rbmj
16-02-2012, 13:43
Use the RobotDrive::SetInvertedMotor(RobotDrive::MotorType , bool) function.

Something like:

//joystick - fill in usb port number
Joystick joy;
//declare jags - fill in ports in constructors
Jaguar left_front, left_rear, right_front, right_rear;
//declare RobotDrive object
RobotDrive drive(left_front, left_rear, right_front, right_rear);
//set motor inversion
drive.SetInvertedMotor(RobotDrive::kFrontLeftMotor , false);
drive.SetInvertedMotor(RobotDrive::kFrontRightMoto r, true);
drive.SetInvertedMotor(RobotDrive::kRearLeftMotor, false);
drive.SetInvertedMotor(RobotDrive::kRearRightMotor , true);
//drive
while (true) {
drive.ArcadeDrive(joy);
}

KyleS
16-02-2012, 13:54
Exactly what I needed, thanks! Now all I need to do is figure out why the Axis Camera isn't working.