From 412ce88c4f8a5c2928ca7e515f91fe345a2d2669 Mon Sep 17 00:00:00 2001 From: Spaceman 11 <135277197+Spaceman113138@users.noreply.github.com> Date: Sun, 5 Jul 2026 23:11:54 -0500 Subject: [PATCH 1/5] add docstrings to match ctre code --- .../rev/src/main/java/first/robot/Robot.java | 12 +++++++++++- .../rev/src/main/java/first/robot/opmode/MyAuto.java | 11 +++++++++-- .../src/main/java/first/robot/opmode/MyTeleop.java | 2 ++ .../rev/src/main/java/first/robot/Robot.java | 11 +++++++++++ .../rev/src/main/java/first/robot/opmode/MyAuto.java | 7 +++++++ .../src/main/java/first/robot/opmode/MyTeleop.java | 5 ++++- 6 files changed, 44 insertions(+), 4 deletions(-) diff --git a/examples/stage1/solutions/rev/src/main/java/first/robot/Robot.java b/examples/stage1/solutions/rev/src/main/java/first/robot/Robot.java index 65dcdd6..8488622 100644 --- a/examples/stage1/solutions/rev/src/main/java/first/robot/Robot.java +++ b/examples/stage1/solutions/rev/src/main/java/first/robot/Robot.java @@ -17,6 +17,13 @@ import org.wpilib.hardware.imu.OnboardIMU; import org.wpilib.hardware.imu.OnboardIMU.MountOrientation; +/** + * The methods in this class are called automatically as described in the OpModeRobot documentation. + * OpMode classes anywhere in the package (or sub-packages) where this class is located are + * automatically registered to display in the Driver Station. If you change the name of this class + * or the package after creating this project, you must also update the Main.java file in the + * project. + */ public class Robot extends OpModeRobot { private SparkMax leftLeader = new SparkMax(0, 0, MotorType.kBrushless); @@ -37,8 +44,11 @@ public class Robot extends OpModeRobot { public final DifferentialDrive drivetrain = new DifferentialDrive(leftLeader::setThrottle, rightLeader::setThrottle); +/** + * This function is run when the robot is first started up and should be used for any + * initialization code. + */ public Robot() { - var leftConfig = new SparkMaxConfig().inverted(true); leftLeader.configure( leftConfig, ResetMode.kResetSafeParameters, PersistMode.kPersistParameters); diff --git a/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java b/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java index 826a695..174c481 100644 --- a/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java +++ b/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java @@ -15,18 +15,25 @@ public class MyAuto extends PeriodicOpMode { private final Robot robot; private Timer timer = new Timer(); + /** The Robot instance is passed into the opmode via the constructor. */ public MyAuto(Robot robot) { this.robot = robot; } @Override public void start() { - timer.restart(); + timer.restart(); // Reset the timer to zero at the start of auto } + /* + * This method runs periodically, using the same period as the Robot instance. + * + * Additional periodic methods may be configured with addPeriodic(), + * which can have periods that differ from the main Robot instance. + */ @Override public void periodic() { - if (timer.hasElapsed(4)) { + if (timer.hasElapsed(4)) { // Drive for 4 seconds after the start of auto robot.drivetrain.arcadeDrive(0.0, 0.0); // Stop the robot after 4 seconds } else { robot.drivetrain.arcadeDrive(0.5, 0.0); // Drive forward at half speed with no rotation diff --git a/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyTeleop.java b/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyTeleop.java index 09fd6ab..94ec0e2 100644 --- a/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyTeleop.java +++ b/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyTeleop.java @@ -15,12 +15,14 @@ public class MyTeleop extends PeriodicOpMode { private final Robot robot; private final NiDsXboxController xboxController = new NiDsXboxController(0); + /** The Robot instance is passed into the opmode via the constructor. */ public MyTeleop(Robot robot) { this.robot = robot; } @Override public void periodic() { + /* Called periodically (set time interval) while the robot is enabled. */ robot.drivetrain.arcadeDrive(-xboxController.getLeftY(), xboxController.getRightX()); if (xboxController.getRightBumperButton()) { diff --git a/examples/stage1/templates/rev/src/main/java/first/robot/Robot.java b/examples/stage1/templates/rev/src/main/java/first/robot/Robot.java index e52755b..d014eeb 100644 --- a/examples/stage1/templates/rev/src/main/java/first/robot/Robot.java +++ b/examples/stage1/templates/rev/src/main/java/first/robot/Robot.java @@ -7,8 +7,19 @@ import org.wpilib.framework.OpModeRobot; +/** + * The methods in this class are called automatically as described in the OpModeRobot documentation. + * OpMode classes anywhere in the package (or sub-packages) where this class is located are + * automatically registered to display in the Driver Station. If you change the name of this class + * or the package after creating this project, you must also update the Main.java file in the + * project. + */ public class Robot extends OpModeRobot { + /** + * This function is run when the robot is first started up and should be used for any + * initialization code. + */ public Robot() {} @Override diff --git a/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java b/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java index 5bd8791..e73f0c2 100644 --- a/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java +++ b/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java @@ -13,6 +13,7 @@ public class MyAuto extends PeriodicOpMode { private final Robot robot; + /** The Robot instance is passed into the opmode via the constructor. */ public MyAuto(Robot robot) { this.robot = robot; } @@ -20,6 +21,12 @@ public MyAuto(Robot robot) { @Override public void start() {} + /* + * This method runs periodically, using the same period as the Robot instance. + * + * Additional periodic methods may be configured with addPeriodic(), + * which can have periods that differ from the main Robot instance. + */ @Override public void periodic() {} } diff --git a/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyTeleop.java b/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyTeleop.java index 312336a..e2dcd61 100644 --- a/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyTeleop.java +++ b/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyTeleop.java @@ -13,10 +13,13 @@ public class MyTeleop extends PeriodicOpMode { private final Robot robot; + /** The Robot instance is passed into the opmode via the constructor. */ public MyTeleop(Robot robot) { this.robot = robot; } @Override - public void periodic() {} + public void periodic() { + /* Called periodically (set time interval) while the robot is enabled. */ + } } From 9627e99e5c6683319debf7c3f9f71ab8dd8ca311 Mon Sep 17 00:00:00 2001 From: Spaceman 11 <135277197+Spaceman113138@users.noreply.github.com> Date: Sun, 5 Jul 2026 23:50:14 -0500 Subject: [PATCH 2/5] add missing start() comment --- .../ctre/src/main/java/first/robot/opmode/MyAuto.java | 1 + .../rev/src/main/java/first/robot/opmode/MyAuto.java | 1 + .../ctre/src/main/java/first/robot/opmode/MyAuto.java | 4 +++- .../rev/src/main/java/first/robot/opmode/MyAuto.java | 4 +++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/stage1/solutions/ctre/src/main/java/first/robot/opmode/MyAuto.java b/examples/stage1/solutions/ctre/src/main/java/first/robot/opmode/MyAuto.java index 0e2ce26..f6f01c7 100644 --- a/examples/stage1/solutions/ctre/src/main/java/first/robot/opmode/MyAuto.java +++ b/examples/stage1/solutions/ctre/src/main/java/first/robot/opmode/MyAuto.java @@ -22,6 +22,7 @@ public MyAuto(Robot robot) { @Override public void start() { + /* Called once when the robot is enabled. */ autoTimer.restart(); // Reset the timer to zero at the start of auto } diff --git a/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java b/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java index 174c481..0e09bf7 100644 --- a/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java +++ b/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java @@ -22,6 +22,7 @@ public MyAuto(Robot robot) { @Override public void start() { + /* Called once when the robot is enabled. */ timer.restart(); // Reset the timer to zero at the start of auto } diff --git a/examples/stage1/templates/ctre/src/main/java/first/robot/opmode/MyAuto.java b/examples/stage1/templates/ctre/src/main/java/first/robot/opmode/MyAuto.java index e73f0c2..6d12a12 100644 --- a/examples/stage1/templates/ctre/src/main/java/first/robot/opmode/MyAuto.java +++ b/examples/stage1/templates/ctre/src/main/java/first/robot/opmode/MyAuto.java @@ -19,7 +19,9 @@ public MyAuto(Robot robot) { } @Override - public void start() {} + public void start() { + /* Called once when the robot is enabled. */ + } /* * This method runs periodically, using the same period as the Robot instance. diff --git a/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java b/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java index e73f0c2..6d12a12 100644 --- a/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java +++ b/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java @@ -19,7 +19,9 @@ public MyAuto(Robot robot) { } @Override - public void start() {} + public void start() { + /* Called once when the robot is enabled. */ + } /* * This method runs periodically, using the same period as the Robot instance. From aa87e2f0316d101fcc4bf5f933675700c6e34f52 Mon Sep 17 00:00:00 2001 From: Spaceman 11 <135277197+Spaceman113138@users.noreply.github.com> Date: Sun, 5 Jul 2026 23:11:54 -0500 Subject: [PATCH 3/5] add docstrings to match ctre code --- .../rev/src/main/java/first/robot/Robot.java | 12 +++++++++++- .../rev/src/main/java/first/robot/opmode/MyAuto.java | 11 +++++++++-- .../src/main/java/first/robot/opmode/MyTeleop.java | 2 ++ .../rev/src/main/java/first/robot/Robot.java | 11 +++++++++++ .../rev/src/main/java/first/robot/opmode/MyAuto.java | 7 +++++++ .../src/main/java/first/robot/opmode/MyTeleop.java | 5 ++++- 6 files changed, 44 insertions(+), 4 deletions(-) diff --git a/examples/stage1/solutions/rev/src/main/java/first/robot/Robot.java b/examples/stage1/solutions/rev/src/main/java/first/robot/Robot.java index 65dcdd6..8488622 100644 --- a/examples/stage1/solutions/rev/src/main/java/first/robot/Robot.java +++ b/examples/stage1/solutions/rev/src/main/java/first/robot/Robot.java @@ -17,6 +17,13 @@ import org.wpilib.hardware.imu.OnboardIMU; import org.wpilib.hardware.imu.OnboardIMU.MountOrientation; +/** + * The methods in this class are called automatically as described in the OpModeRobot documentation. + * OpMode classes anywhere in the package (or sub-packages) where this class is located are + * automatically registered to display in the Driver Station. If you change the name of this class + * or the package after creating this project, you must also update the Main.java file in the + * project. + */ public class Robot extends OpModeRobot { private SparkMax leftLeader = new SparkMax(0, 0, MotorType.kBrushless); @@ -37,8 +44,11 @@ public class Robot extends OpModeRobot { public final DifferentialDrive drivetrain = new DifferentialDrive(leftLeader::setThrottle, rightLeader::setThrottle); +/** + * This function is run when the robot is first started up and should be used for any + * initialization code. + */ public Robot() { - var leftConfig = new SparkMaxConfig().inverted(true); leftLeader.configure( leftConfig, ResetMode.kResetSafeParameters, PersistMode.kPersistParameters); diff --git a/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java b/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java index 826a695..174c481 100644 --- a/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java +++ b/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java @@ -15,18 +15,25 @@ public class MyAuto extends PeriodicOpMode { private final Robot robot; private Timer timer = new Timer(); + /** The Robot instance is passed into the opmode via the constructor. */ public MyAuto(Robot robot) { this.robot = robot; } @Override public void start() { - timer.restart(); + timer.restart(); // Reset the timer to zero at the start of auto } + /* + * This method runs periodically, using the same period as the Robot instance. + * + * Additional periodic methods may be configured with addPeriodic(), + * which can have periods that differ from the main Robot instance. + */ @Override public void periodic() { - if (timer.hasElapsed(4)) { + if (timer.hasElapsed(4)) { // Drive for 4 seconds after the start of auto robot.drivetrain.arcadeDrive(0.0, 0.0); // Stop the robot after 4 seconds } else { robot.drivetrain.arcadeDrive(0.5, 0.0); // Drive forward at half speed with no rotation diff --git a/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyTeleop.java b/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyTeleop.java index 09fd6ab..94ec0e2 100644 --- a/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyTeleop.java +++ b/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyTeleop.java @@ -15,12 +15,14 @@ public class MyTeleop extends PeriodicOpMode { private final Robot robot; private final NiDsXboxController xboxController = new NiDsXboxController(0); + /** The Robot instance is passed into the opmode via the constructor. */ public MyTeleop(Robot robot) { this.robot = robot; } @Override public void periodic() { + /* Called periodically (set time interval) while the robot is enabled. */ robot.drivetrain.arcadeDrive(-xboxController.getLeftY(), xboxController.getRightX()); if (xboxController.getRightBumperButton()) { diff --git a/examples/stage1/templates/rev/src/main/java/first/robot/Robot.java b/examples/stage1/templates/rev/src/main/java/first/robot/Robot.java index e52755b..d014eeb 100644 --- a/examples/stage1/templates/rev/src/main/java/first/robot/Robot.java +++ b/examples/stage1/templates/rev/src/main/java/first/robot/Robot.java @@ -7,8 +7,19 @@ import org.wpilib.framework.OpModeRobot; +/** + * The methods in this class are called automatically as described in the OpModeRobot documentation. + * OpMode classes anywhere in the package (or sub-packages) where this class is located are + * automatically registered to display in the Driver Station. If you change the name of this class + * or the package after creating this project, you must also update the Main.java file in the + * project. + */ public class Robot extends OpModeRobot { + /** + * This function is run when the robot is first started up and should be used for any + * initialization code. + */ public Robot() {} @Override diff --git a/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java b/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java index 5bd8791..e73f0c2 100644 --- a/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java +++ b/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java @@ -13,6 +13,7 @@ public class MyAuto extends PeriodicOpMode { private final Robot robot; + /** The Robot instance is passed into the opmode via the constructor. */ public MyAuto(Robot robot) { this.robot = robot; } @@ -20,6 +21,12 @@ public MyAuto(Robot robot) { @Override public void start() {} + /* + * This method runs periodically, using the same period as the Robot instance. + * + * Additional periodic methods may be configured with addPeriodic(), + * which can have periods that differ from the main Robot instance. + */ @Override public void periodic() {} } diff --git a/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyTeleop.java b/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyTeleop.java index 312336a..e2dcd61 100644 --- a/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyTeleop.java +++ b/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyTeleop.java @@ -13,10 +13,13 @@ public class MyTeleop extends PeriodicOpMode { private final Robot robot; + /** The Robot instance is passed into the opmode via the constructor. */ public MyTeleop(Robot robot) { this.robot = robot; } @Override - public void periodic() {} + public void periodic() { + /* Called periodically (set time interval) while the robot is enabled. */ + } } From 08dd9f5b6377d58de517d4246d4d44ba9fa0763d Mon Sep 17 00:00:00 2001 From: Spaceman 11 <135277197+Spaceman113138@users.noreply.github.com> Date: Sun, 5 Jul 2026 23:50:14 -0500 Subject: [PATCH 4/5] add missing start() comment --- .../ctre/src/main/java/first/robot/opmode/MyAuto.java | 1 + .../rev/src/main/java/first/robot/opmode/MyAuto.java | 1 + .../ctre/src/main/java/first/robot/opmode/MyAuto.java | 4 +++- .../rev/src/main/java/first/robot/opmode/MyAuto.java | 4 +++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/stage1/solutions/ctre/src/main/java/first/robot/opmode/MyAuto.java b/examples/stage1/solutions/ctre/src/main/java/first/robot/opmode/MyAuto.java index 0e2ce26..f6f01c7 100644 --- a/examples/stage1/solutions/ctre/src/main/java/first/robot/opmode/MyAuto.java +++ b/examples/stage1/solutions/ctre/src/main/java/first/robot/opmode/MyAuto.java @@ -22,6 +22,7 @@ public MyAuto(Robot robot) { @Override public void start() { + /* Called once when the robot is enabled. */ autoTimer.restart(); // Reset the timer to zero at the start of auto } diff --git a/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java b/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java index 174c481..0e09bf7 100644 --- a/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java +++ b/examples/stage1/solutions/rev/src/main/java/first/robot/opmode/MyAuto.java @@ -22,6 +22,7 @@ public MyAuto(Robot robot) { @Override public void start() { + /* Called once when the robot is enabled. */ timer.restart(); // Reset the timer to zero at the start of auto } diff --git a/examples/stage1/templates/ctre/src/main/java/first/robot/opmode/MyAuto.java b/examples/stage1/templates/ctre/src/main/java/first/robot/opmode/MyAuto.java index e73f0c2..6d12a12 100644 --- a/examples/stage1/templates/ctre/src/main/java/first/robot/opmode/MyAuto.java +++ b/examples/stage1/templates/ctre/src/main/java/first/robot/opmode/MyAuto.java @@ -19,7 +19,9 @@ public MyAuto(Robot robot) { } @Override - public void start() {} + public void start() { + /* Called once when the robot is enabled. */ + } /* * This method runs periodically, using the same period as the Robot instance. diff --git a/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java b/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java index e73f0c2..6d12a12 100644 --- a/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java +++ b/examples/stage1/templates/rev/src/main/java/first/robot/opmode/MyAuto.java @@ -19,7 +19,9 @@ public MyAuto(Robot robot) { } @Override - public void start() {} + public void start() { + /* Called once when the robot is enabled. */ + } /* * This method runs periodically, using the same period as the Robot instance. From 44bddb3c4b9d147d3831fd7d1fa8e10fdf558c64 Mon Sep 17 00:00:00 2001 From: Spaceman 11 <135277197+Spaceman113138@users.noreply.github.com> Date: Sun, 5 Jul 2026 23:54:08 -0500 Subject: [PATCH 5/5] examples formatting --- .../stage1/solutions/rev/src/main/java/first/robot/Robot.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/stage1/solutions/rev/src/main/java/first/robot/Robot.java b/examples/stage1/solutions/rev/src/main/java/first/robot/Robot.java index 8488622..f87db4c 100644 --- a/examples/stage1/solutions/rev/src/main/java/first/robot/Robot.java +++ b/examples/stage1/solutions/rev/src/main/java/first/robot/Robot.java @@ -44,7 +44,7 @@ public class Robot extends OpModeRobot { public final DifferentialDrive drivetrain = new DifferentialDrive(leftLeader::setThrottle, rightLeader::setThrottle); -/** + /** * This function is run when the robot is first started up and should be used for any * initialization code. */