File tree Expand file tree Collapse file tree 5 files changed +18
-1
lines changed
FRC2020/src/main/java/frc/robot Expand file tree Collapse file tree 5 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 99
1010import edu .wpi .first .wpilibj .RobotBase ;
1111
12+ //This class looks pretty important but there's really not a whole lot to do here.
1213public final class Main {
1314 private Main () {
1415 }
Original file line number Diff line number Diff line change 1414
1515public 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 ;
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change 1818
1919public 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 );
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments