[wpilib] Remove IterativeRobotBase mode init prints (#3500)

They don't provide much utility for the end user. A print at the call to
HAL_ObserveUserProgramStarting() was added in their place so it's still
clear when constructors have finished running.
This commit is contained in:
Tyler Veness
2021-08-05 23:54:50 -07:00
committed by GitHub
parent fb2ee8ec34
commit 5ac60f0a20
4 changed files with 15 additions and 36 deletions

View File

@@ -22,29 +22,17 @@ IterativeRobotBase::IterativeRobotBase(units::second_t period)
: m_period(period),
m_watchdog(period, [this] { PrintLoopOverrunMessage(); }) {}
void IterativeRobotBase::RobotInit() {
fmt::print("Default {}() method... Override me!\n", __FUNCTION__);
}
void IterativeRobotBase::RobotInit() {}
void IterativeRobotBase::SimulationInit() {
fmt::print("Default {}() method... Override me!\n", __FUNCTION__);
}
void IterativeRobotBase::SimulationInit() {}
void IterativeRobotBase::DisabledInit() {
fmt::print("Default {}() method... Override me!\n", __FUNCTION__);
}
void IterativeRobotBase::DisabledInit() {}
void IterativeRobotBase::AutonomousInit() {
fmt::print("Default {}() method... Override me!\n", __FUNCTION__);
}
void IterativeRobotBase::AutonomousInit() {}
void IterativeRobotBase::TeleopInit() {
fmt::print("Default {}() method... Override me!\n", __FUNCTION__);
}
void IterativeRobotBase::TeleopInit() {}
void IterativeRobotBase::TestInit() {
fmt::print("Default {}() method... Override me!\n", __FUNCTION__);
}
void IterativeRobotBase::TestInit() {}
void IterativeRobotBase::RobotPeriodic() {
static bool firstRun = true;

View File

@@ -6,6 +6,7 @@
#include <stdint.h>
#include <cstdio>
#include <utility>
#include <hal/DriverStation.h>
@@ -25,6 +26,7 @@ void TimedRobot::StartCompetition() {
}
// Tell the DS that the robot is ready to be enabled
std::puts("\n********** Robot program startup complete **********");
HAL_ObserveUserProgramStarting();
// Loop forever, calling the appropriate mode-dependent function

View File

@@ -92,9 +92,7 @@ public abstract class IterativeRobotBase extends RobotBase {
* until RobotInit() exits. Code in RobotInit() that waits for enable will cause the robot to
* never indicate that the code is ready, causing the robot to be bypassed in a match.
*/
public void robotInit() {
System.out.println("Default robotInit() method... Override me!");
}
public void robotInit() {}
/**
* Robot-wide simulation initialization code should go here.
@@ -103,9 +101,7 @@ public abstract class IterativeRobotBase extends RobotBase {
* which will be called when the robot is first started. It will be called exactly one time after
* RobotInit is called only when the robot is in simulation.
*/
public void simulationInit() {
System.out.println("Default simulationInit() method... Override me!");
}
public void simulationInit() {}
/**
* Initialization code for disabled mode should go here.
@@ -113,9 +109,7 @@ public abstract class IterativeRobotBase extends RobotBase {
* <p>Users should override this method for initialization code which will be called each time the
* robot enters disabled mode.
*/
public void disabledInit() {
System.out.println("Default disabledInit() method... Override me!");
}
public void disabledInit() {}
/**
* Initialization code for autonomous mode should go here.
@@ -123,9 +117,7 @@ public abstract class IterativeRobotBase extends RobotBase {
* <p>Users should override this method for initialization code which will be called each time the
* robot enters autonomous mode.
*/
public void autonomousInit() {
System.out.println("Default autonomousInit() method... Override me!");
}
public void autonomousInit() {}
/**
* Initialization code for teleop mode should go here.
@@ -133,9 +125,7 @@ public abstract class IterativeRobotBase extends RobotBase {
* <p>Users should override this method for initialization code which will be called each time the
* robot enters teleop mode.
*/
public void teleopInit() {
System.out.println("Default teleopInit() method... Override me!");
}
public void teleopInit() {}
/**
* Initialization code for test mode should go here.
@@ -144,9 +134,7 @@ public abstract class IterativeRobotBase extends RobotBase {
* robot enters test mode.
*/
@SuppressWarnings("PMD.JUnit4TestShouldUseTestAnnotation")
public void testInit() {
System.out.println("Default testInit() method... Override me!");
}
public void testInit() {}
/* ----------- Overridable periodic code ----------------- */

View File

@@ -98,6 +98,7 @@ public class TimedRobot extends IterativeRobotBase {
}
// Tell the DS that the robot is ready to be enabled
System.out.println("********** Robot program startup complete **********");
HAL.observeUserProgramStarting();
// Loop forever, calling the appropriate mode-dependent function