Quote:
Originally Posted by Chris is me
Both conditionals in the if statement that spin the Jaguars do the exact same thing. You're sending the same commands to the same motors, just in a different order. I think you want to invert one of them.
|
I inverted one of them, so this should fix the problem right?
Code:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
public class RobotTemplate extends SimpleRobot {
RobotDrive chassis = new RobotDrive(1,2);
Joystick mainStick = new Joystick(1);
Jaguar jaguar = new Jaguar(3);
Jaguar jag = new Jaguar(4);
public void autonomous(){
chassis.setSafetyEnabled(false);
chassis.drive (-0.5, 0.08);
Timer.delay(2.0);
chassis.drive (0, 0.0);
}
public void operatorControl() {
chassis.setSafetyEnabled(true);
while (isOperatorControl() && isEnabled()) {
double speed;
double rot;
speed = mainStick.getY();
rot = -mainStick.getX();
chassis.arcadeDrive (speed, rot);
if (mainStick.getRawButton(3)){
jag.set(1);
jaguar.set(-1);
}
else if (mainStick.getRawButton(4)){
jaguar.set(1);
jag.set(-1);
}
else{
jaguar.set(0);
jag.set(0);
}
}
}
public void test() {
}
}