Fixed crash in wpilibj SampleRobot (#753)

robotInit() and HAL.observeUserProgramStarting() should be called in
startCompetition() rather than the constructor.

Fixes #752.
This commit is contained in:
Tyler Veness
2017-11-19 22:47:39 -08:00
committed by Peter Johnson
parent c73dd807e1
commit 05e581f409

View File

@@ -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()) {