Shooter Start Competition Error 1

Hi, I’m recieving the Start Competition error and was struggling to find the root of it. I can compile and deploy the code with no issue to the Roborio, but once it’s enabled I receive this error:

ERROR  1  The startCompetition() method (or methods called by it) should have handled the exception above.  edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:386) 
 at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:453) 
 at frc.robot.Main.main(Main.java:23)

My code proceeds as follows below:

package frc.robot;
//import Libraries from WPI
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
import edu.wpi.first.wpilibj.motorcontrol.Talon;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.XboxController;

public class Robot extends TimedRobot {
private static final String kDefaultAuto = “Default”;
private static final String kCustomAuto = “My Auto”;
private String m_autoSelected;
private final SendableChooser m_chooser = new SendableChooser<>();
private DifferentialDrive m_roboDrive;

//initialize Motor Controllers
private Talon RightHoof;
private Talon LeftHoof;
private Talon Spitfire;
private Talon ShooterOne;
private Talon ShooterTwo;

//initialize Various Numerical Plug-in Values
private double LeftStickSpeed;
private double RightStickSpeed;
private double Fire = 1.0;

//initialize Xbox Controller
private XboxController Pilot;

@Override
public void robotInit() {
m_chooser.setDefaultOption(“Default Auto”, kDefaultAuto);
m_chooser.addOption(“My Auto”, kCustomAuto);
SmartDashboard.putData(“Auto choices”, m_chooser);

//intialize Motor Controllers
RightHoof = new Talon(1); LeftHoof = new Talon(0);
ShooterTwo = new Talon(2); ShooterOne = new Talon(3);

//intialize Controller Input
Pilot = new XboxController(0);
m_roboDrive = new DifferentialDrive(LeftHoof, RightHoof);

}

@Override
public void robotPeriodic() {}

@Override
public void autonomousInit() {
m_autoSelected = m_chooser.getSelected();
System.out.println("Auto selected: " + m_autoSelected);
}

@Override
public void autonomousPeriodic() {
switch (m_autoSelected) {
case kCustomAuto:

    break;
  case kDefaultAuto:

    break;
  default:

    break;
}

}

@Override
public void teleopInit() {
//prepare Speed Values for Usage by Pilot
LeftStickSpeed = 0.0; RightStickSpeed = 0.0;
RightHoof.setInverted(true);
// soon to remove
RightHoof.setSafetyEnabled(false);
LeftHoof.setSafetyEnabled(false);
}

@Override
public void teleopPeriodic() {

//setup Stick Functionaility for the Drivetrain
RightStickSpeed = Pilot.getLeftY(); LeftStickSpeed = Pilot.getRightY();
m_roboDrive.tankDrive(LeftStickSpeed, RightStickSpeed);

//setup Y Button for Raising Hook AND setup A Button for Retracting Hook

//Current Status: Unknown | LIVE
if(Pilot.getAButton()==true){ShooterOne.set(1.0);} else if (Pilot.getYButton()==true){ShooterOne.set(-1.0);} else {ShooterOne.stopMotor();}
if(Pilot.getAButton()==true){ShooterTwo.set(1.0);} else if (Pilot.getYButton()==true){ShooterTwo.set(-1.0);} else {ShooterTwo.stopMotor();}


//Current Status: Not Functioning to Expectations | DISABLED
//if(Pilot.getAButton()==true){Horns.set(1.0);} else {Horns.stopMotor();}
//if(Pilot.getYButton()==true){Horns.set(1.0);} else {Horns.stopMotor();}

//setup X Button for Firing Note from Shooter AND setup B Button for Loading Note into Shooter
if(Pilot.getXButton()==true){Spitfire.set(Fire);}
if(Pilot.getXButton()==false){Spitfire.stopMotor();}

}

/** This function is called once when the robot is disabled. */
@Override
public void disabledInit() {}

/** This function is called periodically when disabled. */
@Override
public void disabledPeriodic() {}

/** This function is called once when test mode is enabled. */
@Override
public void testInit() {}

/** This function is called periodically during test mode. */
@Override
public void testPeriodic() {}

/** This function is called once when the robot is first started up. */
@Override
public void simulationInit() {}

/** This function is called periodically whilst in simulation. */
@Override
public void simulationPeriodic() {}
}

What can I do?

  1. If you put three ` characters to start your code, and three to end we’ll be able to read it better.
  2. You need to provide the rest of the stacktrace to see where the code actually crashed.
  3. Here’s a link to help you track down on your own what is going on.

Where do you initialize Spitfire?

Hi! Sorry for the late response; in removing Spitfire from the code (It was made obsolete after some previous changes from if statements to else ifs) Thank you so much for bringing up Spitfire, that allowed me to dive deeper into the problem and curate the solution. The code has been fixed and is working accordingly now!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.