Skip to content

Commit f6c5717

Browse files
committed
[wpilib] Rename mode Init functions to Enter
Fixes #8717.
1 parent dfc8098 commit f6c5717

84 files changed

Lines changed: 292 additions & 293 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cameraserver/src/main/java/org/wpilib/vision/process/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* }
5050
*
5151
* {@literal @}Override
52-
* public void autonomousInit() {
52+
* public void autonomousEnter() {
5353
* findToteThread.start();
5454
* }
5555
*

developerRobot/src/main/java/wpilib/robot/Robot.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ public Robot() {}
1515

1616
/** This function is run once each time the robot enters autonomous mode. */
1717
@Override
18-
public void autonomousInit() {}
18+
public void autonomousEnter() {}
1919

2020
/** This function is called periodically during autonomous. */
2121
@Override
2222
public void autonomousPeriodic() {}
2323

2424
/** This function is called once each time the robot enters tele-operated mode. */
2525
@Override
26-
public void teleopInit() {}
26+
public void teleopEnter() {}
2727

2828
/** This function is called periodically during operator control. */
2929
@Override

developerRobot/src/main/native/cpp/Robot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Robot : public wpi::TimedRobot {
1515
/**
1616
* This function is run once each time the robot enters autonomous mode
1717
*/
18-
void AutonomousInit() override {}
18+
void AutonomousEnter() override {}
1919

2020
/**
2121
* This function is called periodically during autonomous
@@ -25,7 +25,7 @@ class Robot : public wpi::TimedRobot {
2525
/**
2626
* This function is called once each time the robot enters tele-operated mode
2727
*/
28-
void TeleopInit() override {}
28+
void TeleopEnter() override {}
2929

3030
/**
3131
* This function is called periodically during operator control

wpilibc/src/main/native/cpp/framework/IterativeRobotBase.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ void IterativeRobotBase::DriverStationConnected() {}
2222

2323
void IterativeRobotBase::SimulationInit() {}
2424

25-
void IterativeRobotBase::DisabledInit() {}
25+
void IterativeRobotBase::DisabledEnter() {}
2626

27-
void IterativeRobotBase::AutonomousInit() {}
27+
void IterativeRobotBase::AutonomousEnter() {}
2828

29-
void IterativeRobotBase::TeleopInit() {}
29+
void IterativeRobotBase::TeleopEnter() {}
3030

31-
void IterativeRobotBase::TestInit() {}
31+
void IterativeRobotBase::TestEnter() {}
3232

3333
void IterativeRobotBase::RobotPeriodic() {
3434
static bool firstRun = true;
@@ -119,17 +119,17 @@ void IterativeRobotBase::LoopFunc() {
119119

120120
// Call current mode's entry function
121121
if (mode == RobotMode::UNKNOWN) {
122-
DisabledInit();
123-
m_watchdog.AddEpoch("DisabledInit()");
122+
DisabledEnter();
123+
m_watchdog.AddEpoch("DisabledEnter()");
124124
} else if (mode == RobotMode::AUTONOMOUS) {
125-
AutonomousInit();
126-
m_watchdog.AddEpoch("AutonomousInit()");
125+
AutonomousEnter();
126+
m_watchdog.AddEpoch("AutonomousEnter()");
127127
} else if (mode == RobotMode::TELEOPERATED) {
128-
TeleopInit();
129-
m_watchdog.AddEpoch("TeleopInit()");
128+
TeleopEnter();
129+
m_watchdog.AddEpoch("TeleopEnter()");
130130
} else if (mode == RobotMode::TEST) {
131-
TestInit();
132-
m_watchdog.AddEpoch("TestInit()");
131+
TestEnter();
132+
m_watchdog.AddEpoch("TestEnter()");
133133
}
134134

135135
m_lastMode = static_cast<int>(mode);

wpilibc/src/main/native/include/wpi/framework/IterativeRobotBase.hpp

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ namespace wpi {
2323
* DriverStationConnected() -- provide for initialization the first time the DS
2424
* is connected
2525
*
26-
* Init() functions -- each of the following functions is called once when the
26+
* Enter() functions -- each of the following functions is called once when the
2727
* appropriate mode is entered:
2828
*
29-
* \li DisabledInit() -- called each and every time disabled is entered from
29+
* \li DisabledEnter() -- called each and every time disabled is entered from
3030
* another mode
31-
* \li AutonomousInit() -- called each and every time autonomous is entered from
31+
* \li AutonomousEnter() -- called each and every time autonomous is entered
32+
* from another mode
33+
* \li TeleopEnter() -- called each and every time teleop is entered from
3234
* another mode
33-
* \li TeleopInit() -- called each and every time teleop is entered from another
34-
* mode
35-
* \li TestInit() -- called each and every time test is entered from another
35+
* \li TestEnter() -- called each and every time test is entered from another
3636
* mode
3737
*
3838
* Periodic() functions -- each of these functions is called on an interval:
@@ -72,37 +72,36 @@ class IterativeRobotBase : public RobotBase {
7272
virtual void SimulationInit();
7373

7474
/**
75-
* Initialization code for disabled mode should go here.
75+
* Entry code for disabled mode should go here.
7676
*
77-
* Users should override this method for initialization code which will be
78-
* called each time
77+
* Users should override this method for code which will be called each time
7978
* the robot enters disabled mode.
8079
*/
81-
virtual void DisabledInit();
80+
virtual void DisabledEnter();
8281

8382
/**
84-
* Initialization code for autonomous mode should go here.
83+
* Entry code for autonomous mode should go here.
8584
*
86-
* Users should override this method for initialization code which will be
87-
* called each time the robot enters autonomous mode.
85+
* Users should override this method for code which will be called each time
86+
* the robot enters autonomous mode.
8887
*/
89-
virtual void AutonomousInit();
88+
virtual void AutonomousEnter();
9089

9190
/**
92-
* Initialization code for teleop mode should go here.
91+
* Entry code for teleop mode should go here.
9392
*
94-
* Users should override this method for initialization code which will be
95-
* called each time the robot enters teleop mode.
93+
* Users should override this method for code which will be called each time
94+
* the robot enters teleop mode.
9695
*/
97-
virtual void TeleopInit();
96+
virtual void TeleopEnter();
9897

9998
/**
100-
* Initialization code for test mode should go here.
99+
* Entry code for test mode should go here.
101100
*
102-
* Users should override this method for initialization code which will be
103-
* called each time the robot enters test mode.
101+
* Users should override this method for code which will be called each time
102+
* the robot enters test mode.
104103
*/
105-
virtual void TestInit();
104+
virtual void TestEnter();
106105

107106
/**
108107
* Periodic code for all modes should go here.

wpilibc/src/main/python/semiwrap/IterativeRobotBase.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ classes:
22
wpi::IterativeRobotBase:
33
methods:
44
DriverStationConnected:
5-
DisabledInit:
6-
AutonomousInit:
7-
TeleopInit:
8-
TestInit:
5+
DisabledEnter:
6+
AutonomousEnter:
7+
TeleopEnter:
8+
TestEnter:
99
RobotPeriodic:
1010
DisabledPeriodic:
1111
AutonomousPeriodic:

wpilibc/src/test/native/cpp/TimedRobotTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ class MockRobot : public TimedRobot {
5454

5555
void SimulationInit() override { m_simulationInitCount++; }
5656

57-
void DisabledInit() override { m_disabledInitCount++; }
57+
void DisabledEnter() override { m_disabledInitCount++; }
5858

59-
void AutonomousInit() override { m_autonomousInitCount++; }
59+
void AutonomousEnter() override { m_autonomousInitCount++; }
6060

61-
void TeleopInit() override { m_teleopInitCount++; }
61+
void TeleopEnter() override { m_teleopInitCount++; }
6262

63-
void TestInit() override { m_testInitCount++; }
63+
void TestEnter() override { m_testInitCount++; }
6464

6565
void RobotPeriodic() override { m_robotPeriodicCount++; }
6666

wpilibcExamples/src/main/cpp/examples/ArmSimulation/cpp/Robot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ void Robot::SimulationPeriodic() {
88
m_arm.SimulationPeriodic();
99
}
1010

11-
void Robot::TeleopInit() {
11+
void Robot::TeleopEnter() {
1212
m_arm.LoadPreferences();
1313
}
1414

@@ -22,7 +22,7 @@ void Robot::TeleopPeriodic() {
2222
}
2323
}
2424

25-
void Robot::DisabledInit() {
25+
void Robot::DisabledEnter() {
2626
// This just makes sure that our simulation code knows that the motor's off.
2727
m_arm.Stop();
2828
}

wpilibcExamples/src/main/cpp/examples/ArmSimulation/include/Robot.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class Robot : public wpi::TimedRobot {
1515
public:
1616
Robot() {}
1717
void SimulationPeriodic() override;
18-
void TeleopInit() override;
18+
void TeleopEnter() override;
1919
void TeleopPeriodic() override;
20-
void DisabledInit() override;
20+
void DisabledEnter() override;
2121

2222
private:
2323
wpi::Joystick m_joystick{kJoystickPort};

wpilibcExamples/src/main/cpp/examples/DriveDistanceOffboard/cpp/Robot.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ void Robot::RobotPeriodic() {
2626
* can use it to reset any subsystem information you want to clear when the
2727
* robot is disabled.
2828
*/
29-
void Robot::DisabledInit() {}
29+
void Robot::DisabledEnter() {}
3030

3131
void Robot::DisabledPeriodic() {}
3232

3333
/**
3434
* This autonomous runs the autonomous command selected by your {@link
3535
* RobotContainer} class.
3636
*/
37-
void Robot::AutonomousInit() {
37+
void Robot::AutonomousEnter() {
3838
m_autonomousCommand = m_container.GetAutonomousCommand();
3939

4040
if (m_autonomousCommand) {
@@ -45,7 +45,7 @@ void Robot::AutonomousInit() {
4545

4646
void Robot::AutonomousPeriodic() {}
4747

48-
void Robot::TeleopInit() {
48+
void Robot::TeleopEnter() {
4949
// This makes sure that the autonomous stops running when
5050
// teleop starts running. If you want the autonomous to
5151
// continue until interrupted by another command, remove

0 commit comments

Comments
 (0)