Okay so I changed it to this:
Code:
package org.usfirst.frc.team4623.robot;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the IterativeRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class Robot extends IterativeRobot {
XBox stick = new XBox(0);
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);
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
}
/**
* This function is run once each time the robot enters autonomous mode
*/
public void autonomousInit() {
}
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
}
/**
* This function is called once each time the robot enters tele-operated mode
*/
public void teleopInit(){
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
drive.mecanumDrive_Polar(stick.getLeftJoyY(), stick.getLeftJoyX(), 0);
}
/**
* This function is called periodically during test mode
*/
public void testPeriodic() {
LiveWindow.run();
}
public void mecanumDrive(double FL, double RL, double FR, double RR) {
frontLeftMotor.set(FL);
rearLeftMotor.set(RL);
frontRightMotor.set(FR);
rearRightMotor.set(RR);
}
}
And now the DriverStation says this:
Code:
ERROR Unhandled exception instantiating robot org.usfirst.frc.team4623.robot.Robot edu.wpi.first.wpilibj.util.AllocationException: PWM channel 1 is already allocated at [edu.wpi.first.wpilibj.PWM.initPWM(PWM.java:126), edu.wpi.first.wpilibj.PWM.<init>(PWM.java:145), edu.wpi.first.wpilibj.SafePWM.<init>(SafePWM.java:33), edu.wpi.first.wpilibj.Talon.<init>(Talon.java:49), edu.wpi.first.wpilibj.RobotDrive.<init>(RobotDrive.java:115), org.usfirst.frc.team4623.robot.Robot.<init>(Robot.java:26), sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method), sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62), sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45), java.lang.reflect.Constructor.newInstance(Constructor.java:408), java.lang.Class.newInstance(Class.java:433), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:197)]
I am sooooo confused - neither of my programs work and I have no idea why