Quote:
Originally Posted by LFRobotics
Code:
SpeedController frontLeftMotor = new Jaguar(0);
SpeedController frontRightMotor = new Jaguar(1);
SpeedController rearLeftMotor = new Jaguar(2);
SpeedController rearRightMotor = new Jaguar(3);
RobotDrive drive = new RobotDrive(0, 1, 2, 3);
|
What is most likely happening is that you are instantiating the SpeedControllers with PWM channels of 0,1,2 and 3 and then RobotDrive is attempting to do the same therefore throwing the exception.
RobotDrive has two constructors. One, which you are currently using in your code, takes in integers for the PWM channels of the motor controllers. The other takes in SpeedController objects for the motor controllers.
Both do so in this order:
frontLeftMotor
rearLeftMotor
frontRightMotor
rearRightMotor
If you want control over the motor controllers elsewhere I recommend passing those into the constructor rather than just the PWM channels