View Single Post
  #9   Spotlight this post!  
Unread 02-02-2015, 14:46
3786KRRobotics 3786KRRobotics is offline
Registered User
FRC #3786
 
Join Date: Feb 2015
Location: Kent, Washington
Posts: 4
3786KRRobotics is an unknown quantity at this point
Re: Issue with Mecanum Test Code

Quote:
Originally Posted by LFRobotics View Post
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
Reply With Quote