From 05e581f40943cf48bc8c9c269fcf301ba62e84b8 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sun, 19 Nov 2017 22:47:39 -0800 Subject: [PATCH] Fixed crash in wpilibj SampleRobot (#753) robotInit() and HAL.observeUserProgramStarting() should be called in startCompetition() rather than the constructor. Fixes #752. --- .../main/java/edu/wpi/first/wpilibj/SampleRobot.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SampleRobot.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/SampleRobot.java index 7cb7d1d8b3..2c99dbe159 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SampleRobot.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/SampleRobot.java @@ -31,11 +31,6 @@ public class SampleRobot extends RobotBase { * Create a new SampleRobot. */ public SampleRobot() { - robotInit(); - - // Tell the DS that the robot is ready to be enabled - HAL.observeUserProgramStarting(); - HAL.report(tResourceType.kResourceType_Framework, tInstances.kFramework_Simple); } @@ -115,7 +110,13 @@ public class SampleRobot extends RobotBase { * for the robot to be enabled again. */ public void startCompetition() { + robotInit(); + + // Tell the DS that the robot is ready to be enabled + HAL.observeUserProgramStarting(); + robotMain(); + if (!m_robotMainOverridden) { while (true) { if (isDisabled()) {