Skip to content

Commit

Permalink
Deprecate RobotInit
Browse files Browse the repository at this point in the history
  • Loading branch information
spacey-sooty committed May 20, 2024
1 parent 8c420fa commit 230d511
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions wpilibc/src/main/native/cpp/TimedRobot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@
#include <hal/DriverStation.h>
#include <hal/FRCUsageReporting.h>
#include <hal/Notifier.h>
#include <wpi/deprecated.h>

#include "frc/Errors.h"
#include "frc/Timer.h"

using namespace frc;

void TimedRobot::StartCompetition() {
WPI_IGNORE_DEPRECATED
RobotInit();
WPI_UNIGNORE_DEPRECATED

if constexpr (IsSimulation()) {
SimulationInit();
Expand Down
7 changes: 3 additions & 4 deletions wpilibc/src/main/native/include/frc/IterativeRobotBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,10 @@ class IterativeRobotBase : public RobotBase {
* which will be called when the robot is first powered on. It will be called
* exactly one time.
*
* Warning: the Driver Station "Robot Code" light and FMS "Robot Ready"
* indicators will be off 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.
* Note: This method is functionally identical to the class constructor so
* that should be used instead.
*/
[[deprecated("Use the robot class constructor instead.")]]
virtual void RobotInit();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ protected IterativeRobotBase(double period) {
* <p>Users should override this method for default Robot-wide initialization which will be called
* when the robot is first powered on. It will be called exactly one time.
*
* <p>Warning: the Driver Station "Robot Code" light and FMS "Robot Ready" indicators will be off
* 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.
* <p>Note: This method is functionally identical to the class constructor so that should be used
* instead.
*
* @deprecated Use the robot class constructor instead.
*/
@Deprecated(since = "2025", forRemoval = true)
public void robotInit() {}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public void close() {

/** Provide an alternate "main loop" via startCompetition(). */
@Override
@SuppressWarnings("removal")
public void startCompetition() {
robotInit();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static class MockRobot extends TimedRobot {
}

@Override
@SuppressWarnings("removal")
public void robotInit() {
m_robotInitCount.addAndGet(1);
}
Expand Down

0 comments on commit 230d511

Please sign in to comment.