Skip to content

Commit 6534282

Browse files
authored
Update TimedRobot code excerpts to use RLIs (#1723)
1 parent 89c4d1c commit 6534282

File tree

1 file changed

+15
-63
lines changed

1 file changed

+15
-63
lines changed

source/docs/software/vscode-overview/creating-robot-program.rst

Lines changed: 15 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -25,69 +25,21 @@ The :code:`TimedRobot` class is the the base class recommended for most users.
2525

2626
.. tabs::
2727

28-
.. code-tab:: java
29-
30-
import edu.wpi.first.wpilibj.TimedRobot;
31-
32-
public class Robot extends TimedRobot {
33-
34-
@Override
35-
public void robotInit() {
36-
// This is called once when the robot code initializes
37-
}
38-
39-
@Override
40-
public void robotPeriodic() {
41-
// This is called every period regardless of mode
42-
}
43-
44-
@Override
45-
public void autonomousInit() {
46-
// This is called once when the robot first enters autonomous mode
47-
}
48-
49-
@Override
50-
public void autonomousPeriodic() {
51-
// This is called periodically while the robot is in autonomous mode
52-
}
53-
54-
@Override
55-
public void teleopInit() {
56-
// This is called once when the robot first enters teleoperated mode
57-
}
58-
59-
@Override
60-
public void teleopPeriodic() {
61-
// This is called periodically while the robot is in teleoperated mode
62-
}
63-
64-
@Override
65-
public void testInit() {
66-
// This is called once when the robot enters test mode
67-
}
68-
69-
@Override
70-
public void testPeriodic() {
71-
// This is called periodically while the robot is in test mode
72-
}
73-
74-
}
75-
76-
.. code-tab:: c++
77-
78-
#include <frc/TimedRobot.h>
79-
80-
class Robot : public frc::TimedRobot {
81-
public:
82-
void RobotInit() override; // This is called once when the robot code initializes
83-
void RobotPeriodic() override; // This is called every period regardless of mode
84-
void AutonomousInit() override; // This is called once when the robot first enters autonomous mode
85-
void AutonomousPeriodic() override; // This is called periodically while the robot is in autonomous mode
86-
void TeleopInit() override; // This is called once when the robot first enters teleoperated mode
87-
void TeleopPeriodic() override; // This is called periodically while the robot is in teleoperated mode
88-
void TestInit() override; // This is called once when the robot enters test mode
89-
void TestPeriodic() override; // This is called periodically while the robot is in test mode
90-
};
28+
.. group-tab:: Java
29+
30+
.. rli:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2022.3.1/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timedskeleton/Robot.java
31+
:language: java
32+
:lines: 7-55
33+
:linenos:
34+
:lineno-start: 7
35+
36+
.. group-tab:: C++
37+
38+
.. rli:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2022.3.1/wpilibcExamples/src/main/cpp/templates/timedskeleton/cpp/Robot.cpp
39+
:language: cpp
40+
:lines: 5-29
41+
:linenos:
42+
:lineno-start: 5
9143

9244
Periodic methods are called every 20 ms by default. This can be changed by calling the superclass constructor with the new desired update rate.
9345

0 commit comments

Comments
 (0)