mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user