Quote:
|
Construct objects outside of your loop. (in the class)
|
Code:
public class TankDrive extends Thread {
Joystick USB1 = new Joystick(1);
RobotDrive drive = new RobotDrive(2,3,1,4);
public void run(){
while(true){
drive.tankDrive(USB1.getRawAxis(2), USB1.getRawAxis(4));
}
}
}
Note, you shouldn't need to command the drivetrain in its own thread though...
Also, verify with your controller, but typically the y axis on the right analog stick of a joystick is on axis 5 (you are using 4 above). If you find that the right side of your drivetrain doesn't move as expected, this is likely your problem.