Fix IterativeRobot/TimedRobot RobotInit(). (#633)

In C++, it's not legal to call a virtual function from within a constructor,
so the user override was never called (the base function is always called).

See https://isocpp.org/wiki/faq/strange-inheritance#calling-virtuals-from-ctors

While this is technically allowed in Java, also change Java for consistency.
This commit is contained in:
Peter Johnson
2017-09-05 23:57:26 -07:00
committed by GitHub
parent a5ef50c9e7
commit ef3267833f
7 changed files with 22 additions and 20 deletions

View File

@@ -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