View Single Post
  #5   Spotlight this post!  
Unread 22-03-2013, 20:13
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 431
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Joystick Command not working

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.
__________________
http://team2168.org
Reply With Quote