Skip to content

Commit 7461c83

Browse files
author
WBelchman
committed
added documentation
1 parent f309ebd commit 7461c83

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

FRC2020/src/main/java/frc/robot/Main.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import edu.wpi.first.wpilibj.RobotBase;
1111

12+
//This class looks pretty important but there's really not a whole lot to do here.
1213
public final class Main {
1314
private Main() {
1415
}

FRC2020/src/main/java/frc/robot/OI.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414

1515
public class OI {
1616

17+
//Instantiate peripherals like joysticks here
18+
19+
//Each method is called in a Command class to get data from the driver.
20+
//A Command will then call a Subsystem to send information to the robot.
21+
1722
boolean grabberState = true;
1823
Joystick leftStick = RobotMap.leftJoystick;
1924
Joystick rightStick = RobotMap.rightJoystick;

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public class Robot extends TimedRobot {
3939

4040
@Override
4141
public void robotInit() {
42+
//Instantiate subsystems here.
43+
//Subsystem classes should only preform basic controls
4244

4345
//CameraServer.getInstance().startAutomaticCapture();
4446
driveTrain = new DriveTrain();
@@ -59,6 +61,7 @@ public void disabledPeriodic() {
5961
Scheduler.getInstance().run();
6062
}
6163

64+
//These are functions for the Autonomous period
6265
@Override
6366
public void autonomousInit() {
6467
}
@@ -67,6 +70,7 @@ public void autonomousInit() {
6770
public void autonomousPeriodic() {
6871
}
6972

73+
//Run at the beginning of the Teleop Period
7074
@Override
7175
public void teleopInit() {
7276

@@ -108,6 +112,8 @@ public void teleopPeriodic() {
108112
toggle = false;
109113
}
110114

115+
//After a command is added to the Scheduler, its execute function is
116+
//called at each iteration of teleopPeriodic
111117
Scheduler.getInstance().run();
112118

113119
}

FRC2020/src/main/java/frc/robot/RobotMap.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
public class RobotMap {
2020

21+
//This is where motors and other component classes are instantiated.
22+
//Subsystem classes call these to interact with the Robot.
23+
2124
// Talons
2225
public static WPI_TalonSRX LeftMotor = new WPI_TalonSRX(1);
2326
public static WPI_TalonSRX RightMotor = new WPI_TalonSRX(2);

FRC2020/src/main/java/frc/robot/commands/DriveWithJoysticks.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ public class DriveWithJoysticks extends Command {
1515
OI oi = Robot.m_oi;
1616

1717
public DriveWithJoysticks() {
18+
//This allows only the current command to use the subsystem.
19+
//Mainly used when the subsystem has a physicall device like a motor controller
1820
requires(Robot.driveTrain);
1921
}
2022

2123
protected void initialize() {
2224
}
2325

24-
protected void execute() {
26+
protected void execute() { //Runs when the command is called by the Scheduler
2527
// Passes OI input into drive train
2628
Robot.driveTrain.tankDrive(oi.getLeftSpeed(), oi.getRightSpeed());
2729
}

0 commit comments

Comments
 (0)