Skip to content
This repository was archived by the owner on Jul 28, 2026. It is now read-only.

Commit 72e3a34

Browse files
authored
Merge pull request #50 from Ocebots/more-comments
2 parents c157507 + aed7303 commit 72e3a34

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/main/java/frc/robot/Robot.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ public class Robot extends TimedRobot {
1717

1818
private final RobotContainer robotContainer;
1919

20+
// creates a new robot container
2021
public Robot() {
2122
robotContainer = new RobotContainer();
2223
Epilogue.bind(this);
2324
}
2425

26+
// starts the command scheduler
2527
@Override
2628
public void robotPeriodic() {
2729
CommandScheduler.getInstance().run();
@@ -37,6 +39,7 @@ public void disabledPeriodic() {}
3739
@Override
3840
public void disabledExit() {}
3941

42+
// initializes autonomus
4043
@Override
4144
public void autonomousInit() {
4245
autonomousCommand = robotContainer.getAutonomousCommand();
@@ -52,6 +55,7 @@ public void autonomousPeriodic() {}
5255
@Override
5356
public void autonomousExit() {}
5457

58+
// stops autonomous during teleop
5559
@Override
5660
public void teleopInit() {
5761
if (autonomousCommand != null) {
@@ -65,6 +69,7 @@ public void teleopPeriodic() {}
6569
@Override
6670
public void teleopExit() {}
6771

72+
// cancels the command scheduler
6873
@Override
6974
public void testInit() {
7075
CommandScheduler.getInstance().cancelAll();

src/main/java/frc/robot/RobotContainer.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class RobotContainer {
3737
true,
3838
drivetrain);
3939
private int lastButtonPressed;
40+
// slows down robot durring pickup
4041
private Command pickup =
4142
coral
4243
.pickUpCoral()
@@ -46,6 +47,7 @@ public class RobotContainer {
4647
speedMultiplier = 1.0;
4748
fieldRelative = true;
4849
}));
50+
// changes speed when picking up from source
4951
private Command pickupSource =
5052
coral.pickUpCoralSource().andThen(Commands.runOnce(() -> speedMultiplier = 1.0));
5153
private Command safeState = coral.safeState();
@@ -56,6 +58,7 @@ public class RobotContainer {
5658
private Field2d selectedSpot = new Field2d();
5759

5860
public RobotContainer() {
61+
// how we selected where we were going to score
5962
DataLogManager.start();
6063
configureBindings();
6164
SmartDashboard.putData("scheduler", CommandScheduler.getInstance());
@@ -73,6 +76,7 @@ public RobotContainer() {
7376
SmartDashboard.putData("Selected Score Locationn", selectedSpot);
7477
}
7578

79+
// all controller bindings
7680
private void configureBindings() {
7781
CommandScheduler.getInstance()
7882
.schedule(
@@ -85,6 +89,7 @@ private void configureBindings() {
8589
}
8690
})
8791
.ignoringDisable(true));
92+
// coral pickup
8893
controller
8994
.a()
9095
.onTrue(
@@ -101,6 +106,7 @@ private void configureBindings() {
101106
fieldRelative = false;
102107
}
103108
}));
109+
// cancel coral pickup
104110
controller
105111
.b()
106112
.onTrue(
@@ -116,6 +122,7 @@ private void configureBindings() {
116122
speedMultiplier = 0.4;
117123
}
118124
}));
125+
// enabling the safe state
119126
controller
120127
.x()
121128
.onTrue(
@@ -129,6 +136,7 @@ private void configureBindings() {
129136
}
130137
}));
131138

139+
// picking up algae
132140
controller
133141
.rightTrigger()
134142
.onTrue(
@@ -137,8 +145,10 @@ private void configureBindings() {
137145
.until(() -> !controller.rightTrigger().getAsBoolean())
138146
.andThen(algae.storeAlgae()));
139147

148+
// releasing the algae
140149
controller.y().onTrue(algae.releaseAlgae().andThen(algae.returnToUp()));
141150

151+
// scoring on all levels
142152
totalController
143153
.button(15)
144154
.whileTrue(
@@ -192,9 +202,11 @@ private void configureBindings() {
192202
}
193203
}));
194204

205+
// clearing algae off reef
195206
totalController.button(14).onTrue(coral.l1ReefClear(controller.leftTrigger()));
196207
totalController.button(13).onTrue(coral.l2ReefClear(controller.leftTrigger()));
197208

209+
// driving the robot
198210
drivetrain.setDefaultCommand(
199211
Commands.run(
200212
() ->
@@ -206,6 +218,7 @@ private void configureBindings() {
206218
true),
207219
drivetrain));
208220

221+
// deploy climber, releases algae too
209222
controller.povUp().whileTrue(climb.pivotClimb());
210223
controller
211224
.povDown()
@@ -217,14 +230,17 @@ private void configureBindings() {
217230
controller.povRight().onTrue(Commands.runOnce(() -> autoDisabled = true));
218231
}
219232

233+
// deadbands for driving
220234
private double applyDeadband(double value) {
221235
return MathUtil.applyDeadband(value, ControllerConfig.DEADBAND);
222236
}
223237

238+
// sets the pose for auto-align
224239
public void periodic() {
225240
selectedSpot.setRobotPose(Positions.getIndividualReef(lastButtonPressed));
226241
}
227242

243+
// autonomous command
228244
public Command getAutonomousCommand() {
229245
return Commands.sequence(
230246
Commands.waitSeconds(2), coral.goToReef(drivetrain, () -> lastButtonPressed, () -> 3));

0 commit comments

Comments
 (0)