View Single Post
  #6   Spotlight this post!  
Unread 31-01-2011, 23:27
Patrick Chiang Patrick Chiang is offline
Programming
FRC #3070 (Team Pronto)
Team Role: Mentor
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Seattle
Posts: 162
Patrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to all
Re: How do I upload code to the Robot with Java?

Code:
 public Joystick leftStick = new Joystick(1);
public Joystick rightStick = new Joystick(2);
/* Here, the cRIO allocates slot 1-4 of the PWM. 
Which means if you try to allocate them again in 
another part of the code, you'll get errors. */
public Jaguar jagFrontLeft = new Jaguar(1);
public Jaguar jagFrontRight = new Jaguar(2);
public Jaguar jagBackLeft = new Jaguar(3);
public Jaguar jagBackRight = new Jaguar(4);
/* See? Here, you're allocating the EXACT SAME 
PWM slots AGAIN. Which creates problems and are
 most likely the cause of your problem. */
public RobotDrive driveRobot = new RobotDrive(1, 3, 2, 4);
Comments in navy blue. Here's the solution:
Code:
Joystick leftStick = new Joystick(1);
Joystick rightStick = new Joystick(2);
/* Code removed because it creates problems */
// Jaguar jagFrontLeft = new Jaguar(1);
// Jaguar jagFrontRight = new Jaguar(2);
// Jaguar jagBackLeft = new Jaguar(3);
// Jaguar jagBackRight = new Jaguar(4);
RobotDrive driveRobot = new RobotDrive(1, 3, 2, 4);
Gyro roboGyro = new Gyro(7);
double leftX =0;
double leftY =0;
double rotationRate =0;
double gyroAngle =0;
int i = 0;
Edit: Darn. Someone beat me to it.
Reply With Quote