Resolved artf3579: robot can no longer be enabled until robotInit() finishes in IterativeRobot; similar options available by overriding prestart() for other base classes.

Change-Id: I07fde4b1bd2fae0c2e2a04336639b44ec715628a
This commit is contained in:
Colby Skeggs
2014-12-09 02:30:34 +00:00
parent ac60198842
commit 1c24096cc9
7 changed files with 55 additions and 21 deletions

View File

@@ -36,6 +36,11 @@ IterativeRobot::~IterativeRobot()
{
}
void IterativeRobot::Prestart() {
// Don't immediately say that the robot's ready to be enabled.
// See below.
}
/**
* Provide an alternate "main loop" via StartCompetition().
*
@@ -54,6 +59,12 @@ void IterativeRobot::StartCompetition()
NetworkTable::GetTable("LiveWindow")->GetSubTable("~STATUS~")->PutBoolean("LW Enabled", false);
RobotInit();
// We call this now (not in Prestart like default) so that the robot
// won't enable until the initialization has finished. This is useful
// because otherwise it's sometimes possible to enable the robot
// before the code is ready.
HALNetworkCommunicationObserveUserProgramStarting();
// loop forever, calling the appropriate mode-dependent function
lw->SetEnabled(false);
while (true)