diff --git a/wpilibc/src/main/native/cpp/IterativeRobot.cpp b/wpilibc/src/main/native/cpp/IterativeRobot.cpp index 5b0efac0ac..60b42468f4 100644 --- a/wpilibc/src/main/native/cpp/IterativeRobot.cpp +++ b/wpilibc/src/main/native/cpp/IterativeRobot.cpp @@ -25,6 +25,11 @@ IterativeRobot::IterativeRobot() { * the DS packets. */ void IterativeRobot::StartCompetition() { + RobotInit(); + + // Tell the DS that the robot is ready to be enabled + HAL_ObserveUserProgramStarting(); + // Loop forever, calling the appropriate mode-dependent function while (true) { // wait for driver station data so the loop doesn't hog the CPU diff --git a/wpilibc/src/main/native/cpp/IterativeRobotBase.cpp b/wpilibc/src/main/native/cpp/IterativeRobotBase.cpp index 64dc9f6e87..a0b819be10 100644 --- a/wpilibc/src/main/native/cpp/IterativeRobotBase.cpp +++ b/wpilibc/src/main/native/cpp/IterativeRobotBase.cpp @@ -146,13 +146,6 @@ void IterativeRobotBase::TestPeriodic() { } } -IterativeRobotBase::IterativeRobotBase() { - RobotInit(); - - // Tell the DS that the robot is ready to be enabled - HAL_ObserveUserProgramStarting(); -} - void IterativeRobotBase::LoopFunc() { // Call the appropriate function depending upon the current robot mode if (IsDisabled()) { diff --git a/wpilibc/src/main/native/cpp/TimedRobot.cpp b/wpilibc/src/main/native/cpp/TimedRobot.cpp index 07cc0f665e..f0d8492e0e 100644 --- a/wpilibc/src/main/native/cpp/TimedRobot.cpp +++ b/wpilibc/src/main/native/cpp/TimedRobot.cpp @@ -17,6 +17,11 @@ using namespace frc; * Provide an alternate "main loop" via StartCompetition(). */ void TimedRobot::StartCompetition() { + RobotInit(); + + // Tell the DS that the robot is ready to be enabled + HAL_ObserveUserProgramStarting(); + // Loop forever, calling the appropriate mode-dependent function m_startLoop = true; m_loop->StartPeriodic(m_period); diff --git a/wpilibc/src/main/native/include/IterativeRobotBase.h b/wpilibc/src/main/native/include/IterativeRobotBase.h index f469a7150f..01bfa7e7fa 100644 --- a/wpilibc/src/main/native/include/IterativeRobotBase.h +++ b/wpilibc/src/main/native/include/IterativeRobotBase.h @@ -55,7 +55,6 @@ class IterativeRobotBase : public RobotBase { virtual void TestPeriodic(); protected: - IterativeRobotBase(); virtual ~IterativeRobotBase() = default; void LoopFunc(); diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java index 6bef66bf6d..fb13579fba 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java @@ -28,7 +28,12 @@ public class IterativeRobot extends IterativeRobotBase { * Provide an alternate "main loop" via startCompetition(). */ public void startCompetition() { - // loop forever, calling the appropriate mode-dependent function + robotInit(); + + // Tell the DS that the robot is ready to be enabled + HAL.observeUserProgramStarting(); + + // Loop forever, calling the appropriate mode-dependent function while (true) { // Wait for new data to arrive m_ds.waitForData(); diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/IterativeRobotBase.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/IterativeRobotBase.java index a1794c873c..6847383dc6 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/IterativeRobotBase.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/IterativeRobotBase.java @@ -50,16 +50,6 @@ public abstract class IterativeRobotBase extends RobotBase { private Mode m_lastMode = Mode.kNone; - /** - * IterativeRobotBase constructor. - */ - public IterativeRobotBase() { - robotInit(); - - // Tell the DS that the robot is ready to be enabled - HAL.observeUserProgramStarting(); - } - /** * Provide an alternate "main loop" via startCompetition(). */ diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/TimedRobot.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/TimedRobot.java index 9c20f10d55..52eabe5742 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/TimedRobot.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/TimedRobot.java @@ -39,7 +39,12 @@ public class TimedRobot extends IterativeRobotBase { * Provide an alternate "main loop" via startCompetition(). */ public void startCompetition() { - // loop forever, calling the appropriate mode-dependent function + robotInit(); + + // Tell the DS that the robot is ready to be enabled + HAL.observeUserProgramStarting(); + + // Loop forever, calling the appropriate mode-dependent function m_startLoop = true; m_loop.startPeriodic(m_period); while (true) {