Hello, I tried deploying my code (https://github.com/FRC2495/2016-Java-FRC-Code.git) and am getting this error when i do:
➔ Launching «’/usr/local/frc/JRE/bin/java’ ‘-jar’ ‘/home/lvuser/FRCUserProgram.jar’»
platform: /Linux/arm/
********** Robot program starting **********
Error at edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:244): ERROR Unhandled exception: java.lang.StackOverflowError at [edu.wpi.first.wpilibj.communication.UsageReporting.report(UsageReporting.java:21), edu.wpi.first.wpilibj.communication.UsageReporting.report(UsageReporting.java:17), edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:70), org.usfirst.frc.team2495.robot.Robot.robotInit(Robot.java:51), edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72), org.usfirst.frc.team2495.robot.Robot.robotInit(Robot.java:51), edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72), org.usfirst.frc.team2495.robot.Robot.robotInit(Robot.java:51), edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72), org.usfirst.frc.team2495.robot.Robot.robotInit(Robot.java:51), edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72), org.usfirst.frc.team2495.robot.Robot.robotInit(Robot.java:51), edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72), org.usfirst.frc.team2495.robot.Robot.robotInit(Robot.java:51), edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72), org.usfirst.frc.team2495.robot.Robot.robotInit(Robot.java:51), edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72), org.usfirst.frc.team2495.robot.Robot.robotInit(Robot.java:51), edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72), org.usfirst.frc.team2495.robot.Robot.robotInit(Robot.java:51), (Continues on for a really long time.)]
WARNING: Robots don’t quit!
—> The startCompetition() method (or methods called by it) should have handled the exception above.
Looks like you have a run-away recursion. What is on line 51 in robot.java? It is somehow calling startCompetition.
The problem is here:
public void robotInit() {
oi = new OI();
// autochooser = new SendableChooser();
//autochooser.addDefault("Default Auto", new ExampleCommand());
// chooser.addObject("My Auto", new MyAutoCommand());
// SmartDashboard.putData("Auto mode", autochooser);
startCompetition();
}
Remove the startCompetition() line and it will fix the problem. robotInit() is called when you call startCompetition(), so calling startCompetition() in robotInit() causes an infinite loop (AKA, a StackOverflowError). Also, you shouldn’t call startCompetition() anywhere, since that function is handled by FIRST.