├── Project Code ├── Lesson 12 │ └── RobotComposition │ │ ├── src │ │ ├── Drivetrain.java │ │ ├── BallShooter.java │ │ ├── CubeElevator.java │ │ ├── GamePieceManipulator.java │ │ ├── HatchPanelPlacer.java │ │ ├── PowerUpRobot.java │ │ ├── DeepSpaceRobot.java │ │ ├── Robot.java │ │ ├── InfiniteRechargeRobot.java │ │ └── RobotComposition.java │ │ └── README.md ├── Lesson 2 │ └── Lesson2 │ │ ├── .wpilib │ │ └── wpilib_preferences.json │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ └── main │ │ │ ├── deploy │ │ │ └── example.txt │ │ │ └── java │ │ │ └── frc │ │ │ └── robot │ │ │ ├── Constants.java │ │ │ ├── commands │ │ │ ├── AutonomousDistance.java │ │ │ ├── AutonomousTime.java │ │ │ ├── DriveTime.java │ │ │ ├── DriveDistance.java │ │ │ ├── TurnTime.java │ │ │ └── ArcadeDrive.java │ │ │ └── Main.java │ │ ├── .vscode │ │ ├── settings.json │ │ └── launch.json │ │ ├── settings.gradle │ │ ├── vendordeps │ │ └── WPILibNewCommands.json │ │ ├── WPILib-License.md │ │ └── build.gradle ├── Lesson 3 │ └── Lesson3 │ │ ├── .wpilib │ │ └── wpilib_preferences.json │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ └── main │ │ │ ├── deploy │ │ │ └── example.txt │ │ │ └── java │ │ │ └── frc │ │ │ └── robot │ │ │ ├── Constants.java │ │ │ ├── Main.java │ │ │ └── commands │ │ │ ├── AutonomousDistance.java │ │ │ ├── AutonomousTime.java │ │ │ ├── TurnLedOn.java │ │ │ ├── TurnLedOff.java │ │ │ ├── DriveTime.java │ │ │ ├── DriveDistance.java │ │ │ ├── TurnTime.java │ │ │ └── ArcadeDrive.java │ │ ├── .vscode │ │ ├── settings.json │ │ └── launch.json │ │ ├── settings.gradle │ │ ├── vendordeps │ │ └── WPILibNewCommands.json │ │ ├── WPILib-License.md │ │ └── build.gradle ├── Lesson 10 │ └── Autonomous │ │ ├── .wpilib │ │ └── wpilib_preferences.json │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ └── main │ │ │ ├── deploy │ │ │ └── example.txt │ │ │ └── java │ │ │ └── frc │ │ │ └── robot │ │ │ ├── Constants.java │ │ │ ├── Main.java │ │ │ └── commands │ │ │ ├── AutonomousDistance.java │ │ │ ├── AutonomousTime.java │ │ │ ├── DriveTime.java │ │ │ ├── DriveDistance.java │ │ │ ├── TurnTime.java │ │ │ └── ArcadeDrive.java │ │ ├── .vscode │ │ ├── settings.json │ │ └── launch.json │ │ ├── settings.gradle │ │ ├── vendordeps │ │ └── WPILibNewCommands.json │ │ ├── WPILib-License.md │ │ └── build.gradle ├── Lesson 5 │ └── CutPowerMode │ │ ├── .wpilib │ │ └── wpilib_preferences.json │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ └── main │ │ │ ├── deploy │ │ │ └── example.txt │ │ │ └── java │ │ │ └── frc │ │ │ └── robot │ │ │ ├── Constants.java │ │ │ ├── Main.java │ │ │ └── commands │ │ │ ├── AutonomousDistance.java │ │ │ ├── AutonomousTime.java │ │ │ ├── DriveTime.java │ │ │ ├── DriveDistance.java │ │ │ ├── TurnTime.java │ │ │ └── ArcadeDrive.java │ │ ├── .vscode │ │ ├── settings.json │ │ └── launch.json │ │ ├── settings.gradle │ │ ├── vendordeps │ │ └── WPILibNewCommands.json │ │ ├── WPILib-License.md │ │ └── build.gradle ├── Lesson 6 │ └── GyroLights │ │ ├── .wpilib │ │ └── wpilib_preferences.json │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ └── main │ │ │ ├── deploy │ │ │ └── example.txt │ │ │ └── java │ │ │ └── frc │ │ │ └── robot │ │ │ ├── Constants.java │ │ │ ├── Main.java │ │ │ └── commands │ │ │ ├── AutonomousDistance.java │ │ │ ├── AutonomousTime.java │ │ │ ├── ToggleLightsBasedOnGyro.java │ │ │ ├── DriveTime.java │ │ │ ├── DriveDistance.java │ │ │ ├── TurnTime.java │ │ │ └── ArcadeDrive.java │ │ ├── .vscode │ │ ├── settings.json │ │ └── launch.json │ │ ├── settings.gradle │ │ ├── vendordeps │ │ └── WPILibNewCommands.json │ │ ├── WPILib-License.md │ │ └── build.gradle ├── Lesson 7 │ └── GyroLights 2 │ │ ├── .wpilib │ │ └── wpilib_preferences.json │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── frc │ │ │ │ └── robot │ │ │ │ ├── commands │ │ │ │ ├── Constants.java │ │ │ │ ├── AutonomousDistance.java │ │ │ │ ├── AutonomousTime.java │ │ │ │ ├── ToggleLightsBasedOnGyro.java │ │ │ │ ├── DriveTime.java │ │ │ │ ├── DriveDistance.java │ │ │ │ ├── TurnTime.java │ │ │ │ └── ArcadeDrive.java │ │ │ │ ├── Constants.java │ │ │ │ └── Main.java │ │ │ └── deploy │ │ │ └── example.txt │ │ ├── .vscode │ │ ├── settings.json │ │ └── launch.json │ │ ├── settings.gradle │ │ ├── vendordeps │ │ └── WPILibNewCommands.json │ │ ├── WPILib-License.md │ │ └── build.gradle ├── Lesson 1 │ └── ExampleProject │ │ ├── .wpilib │ │ └── wpilib_preferences.json │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ └── main │ │ │ ├── deploy │ │ │ └── example.txt │ │ │ └── java │ │ │ └── frc │ │ │ └── robot │ │ │ ├── Constants.java │ │ │ ├── Main.java │ │ │ └── commands │ │ │ ├── AutonomousDistance.java │ │ │ ├── AutonomousTime.java │ │ │ ├── DriveTime.java │ │ │ ├── DriveDistance.java │ │ │ └── TurnTime.java │ │ ├── .vscode │ │ ├── settings.json │ │ └── launch.json │ │ ├── settings.gradle │ │ ├── vendordeps │ │ └── WPILibNewCommands.json │ │ ├── WPILib-License.md │ │ └── build.gradle ├── Lesson 11 │ └── DriveStraight │ │ ├── .wpilib │ │ └── wpilib_preferences.json │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ └── main │ │ │ ├── deploy │ │ │ └── example.txt │ │ │ └── java │ │ │ └── frc │ │ │ └── robot │ │ │ ├── Main.java │ │ │ ├── Constants.java │ │ │ └── commands │ │ │ ├── AutonomousDistance.java │ │ │ ├── AutonomousTime.java │ │ │ ├── DriveTime.java │ │ │ ├── DriveDistance.java │ │ │ └── TurnTime.java │ │ ├── .vscode │ │ ├── settings.json │ │ └── launch.json │ │ ├── settings.gradle │ │ ├── vendordeps │ │ └── WPILibNewCommands.json │ │ ├── WPILib-License.md │ │ └── build.gradle ├── Lesson 9 │ └── DriveStraight │ │ ├── .wpilib │ │ └── wpilib_preferences.json │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ └── main │ │ │ ├── deploy │ │ │ └── example.txt │ │ │ └── java │ │ │ └── frc │ │ │ └── robot │ │ │ ├── Main.java │ │ │ ├── Constants.java │ │ │ └── commands │ │ │ ├── AutonomousDistance.java │ │ │ ├── AutonomousTime.java │ │ │ ├── DriveTime.java │ │ │ ├── DriveDistance.java │ │ │ └── TurnTime.java │ │ ├── .vscode │ │ ├── settings.json │ │ └── launch.json │ │ ├── settings.gradle │ │ ├── vendordeps │ │ └── WPILibNewCommands.json │ │ ├── WPILib-License.md │ │ └── build.gradle ├── Lesson 14 │ └── SpriteGame │ │ ├── src │ │ ├── Fightable.java │ │ ├── Movable.java │ │ ├── NPC.java │ │ ├── Character.java │ │ ├── DestructibleObject.java │ │ ├── Enemy.java │ │ ├── Player.java │ │ └── SpriteGame.java │ │ └── README.md ├── Lesson 15 │ ├── SpriteGame │ │ ├── src │ │ │ ├── Fightable.java │ │ │ ├── Movable.java │ │ │ ├── NPC.java │ │ │ ├── Character.java │ │ │ ├── DestructibleObject.java │ │ │ ├── Enemy.java │ │ │ ├── Player.java │ │ │ └── SpriteGame.java │ │ └── README.md │ └── BasicOperations │ │ ├── README.md │ │ └── src │ │ └── App.java └── Lesson 4 │ └── MethodsScratch │ ├── README.md │ └── src │ └── App.java ├── General Troubleshooting.pdf └── Lessons ├── Romi Lesson 8 - Loops.pdf ├── Romi Lesson 13 - Arrays.pdf ├── Romi Lesson 9 - Gyro Project.pdf ├── Romi Lesson 1 - Getting Started.pdf ├── Romi Lesson 15 - Static & Super.pdf ├── Romi Lesson 4 - Methods Deep Dive.pdf ├── Romi Lesson 10 - Autonomous Commands.pdf ├── Romi Lesson 11 - Logical Operators.pdf ├── Romi Lesson 6 - OOP Deep Dive Part 1.pdf ├── Romi Lesson 7 - OOP Deep Dive Part 2.pdf ├── Romi Lesson 16 - Manual Drive Methods.pdf ├── Romi Lesson 19 - Parallel Command Groups.pdf ├── Romi Lesson 2 - Intro to Java - Variables.pdf ├── Romi Lesson 12 - Inheritance & Polymorphism.pdf ├── Romi Lesson 17 - Deadbanding & Turn Scaling.pdf ├── Romi Lesson 14 - Abstract Classes & Interfaces.pdf ├── Romi Lesson 18 - Exponential & Linear Control.pdf ├── Romi Lesson 3 - Methods, Classes, and Objects.pdf ├── Romi Lesson 5 - If Statements & Cut-Power Mode.pdf └── Romi Lesson 20 - Integrating Commands In Teleop.pdf /Project Code/Lesson 12/RobotComposition/src/Drivetrain.java: -------------------------------------------------------------------------------- 1 | public class Drivetrain { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /General Troubleshooting.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/General Troubleshooting.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 8 - Loops.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 8 - Loops.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 13 - Arrays.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 13 - Arrays.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 9 - Gyro Project.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 9 - Gyro Project.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 1 - Getting Started.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 1 - Getting Started.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 15 - Static & Super.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 15 - Static & Super.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 4 - Methods Deep Dive.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 4 - Methods Deep Dive.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 10 - Autonomous Commands.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 10 - Autonomous Commands.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 11 - Logical Operators.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 11 - Logical Operators.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 6 - OOP Deep Dive Part 1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 6 - OOP Deep Dive Part 1.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 7 - OOP Deep Dive Part 2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 7 - OOP Deep Dive Part 2.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 16 - Manual Drive Methods.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 16 - Manual Drive Methods.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 19 - Parallel Command Groups.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 19 - Parallel Command Groups.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 2 - Intro to Java - Variables.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 2 - Intro to Java - Variables.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 12 - Inheritance & Polymorphism.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 12 - Inheritance & Polymorphism.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 17 - Deadbanding & Turn Scaling.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 17 - Deadbanding & Turn Scaling.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 14 - Abstract Classes & Interfaces.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 14 - Abstract Classes & Interfaces.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 18 - Exponential & Linear Control.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 18 - Exponential & Linear Control.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 3 - Methods, Classes, and Objects.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 3 - Methods, Classes, and Objects.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 5 - If Statements & Cut-Power Mode.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 5 - If Statements & Cut-Power Mode.pdf -------------------------------------------------------------------------------- /Lessons/Romi Lesson 20 - Integrating Commands In Teleop.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Lessons/Romi Lesson 20 - Integrating Commands In Teleop.pdf -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/.wpilib/wpilib_preferences.json: -------------------------------------------------------------------------------- 1 | { 2 | "enableCppIntellisense": false, 3 | "currentLanguage": "java", 4 | "projectYear": "2021", 5 | "teamNumber": 0 6 | } -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Project Code/Lesson 2/Lesson2/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/.wpilib/wpilib_preferences.json: -------------------------------------------------------------------------------- 1 | { 2 | "enableCppIntellisense": false, 3 | "currentLanguage": "java", 4 | "projectYear": "2021", 5 | "teamNumber": 0 6 | } -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Project Code/Lesson 3/Lesson3/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/.wpilib/wpilib_preferences.json: -------------------------------------------------------------------------------- 1 | { 2 | "enableCppIntellisense": false, 3 | "currentLanguage": "java", 4 | "projectYear": "2021", 5 | "teamNumber": 0 6 | } -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/.wpilib/wpilib_preferences.json: -------------------------------------------------------------------------------- 1 | { 2 | "enableCppIntellisense": false, 3 | "currentLanguage": "java", 4 | "projectYear": "2021", 5 | "teamNumber": 0 6 | } -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/.wpilib/wpilib_preferences.json: -------------------------------------------------------------------------------- 1 | { 2 | "enableCppIntellisense": false, 3 | "currentLanguage": "java", 4 | "projectYear": "2021", 5 | "teamNumber": 0 6 | } -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/.wpilib/wpilib_preferences.json: -------------------------------------------------------------------------------- 1 | { 2 | "enableCppIntellisense": false, 3 | "currentLanguage": "java", 4 | "projectYear": "2021", 5 | "teamNumber": 0 6 | } -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/.wpilib/wpilib_preferences.json: -------------------------------------------------------------------------------- 1 | { 2 | "enableCppIntellisense": false, 3 | "currentLanguage": "java", 4 | "projectYear": "2021", 5 | "teamNumber": 0 6 | } -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Project Code/Lesson 10/Autonomous/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/.wpilib/wpilib_preferences.json: -------------------------------------------------------------------------------- 1 | { 2 | "enableCppIntellisense": false, 3 | "currentLanguage": "java", 4 | "projectYear": "2021", 5 | "teamNumber": 0 6 | } -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Project Code/Lesson 5/CutPowerMode/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Project Code/Lesson 6/GyroLights/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Project Code/Lesson 7/GyroLights 2/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/.wpilib/wpilib_preferences.json: -------------------------------------------------------------------------------- 1 | { 2 | "enableCppIntellisense": false, 3 | "currentLanguage": "java", 4 | "projectYear": "2021", 5 | "teamNumber": 0 6 | } -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Project Code/Lesson 1/ExampleProject/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Project Code/Lesson 11/DriveStraight/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czbeatty/FRC-Romi-Programming-Course/HEAD/Project Code/Lesson 9/DriveStraight/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Project Code/Lesson 12/RobotComposition/src/BallShooter.java: -------------------------------------------------------------------------------- 1 | public class BallShooter extends GamePieceManipulator { 2 | public void manipulate() { 3 | System.out.println("Shooting the balls!"); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Project Code/Lesson 12/RobotComposition/src/CubeElevator.java: -------------------------------------------------------------------------------- 1 | public class CubeElevator extends GamePieceManipulator { 2 | public void manipulate() { 3 | System.out.println("Elevating the cube!"); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Project Code/Lesson 12/RobotComposition/src/GamePieceManipulator.java: -------------------------------------------------------------------------------- 1 | public class GamePieceManipulator { 2 | public void manipulate() { 3 | System.out.println("Now manipulating the game piece."); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Project Code/Lesson 12/RobotComposition/src/HatchPanelPlacer.java: -------------------------------------------------------------------------------- 1 | public class HatchPanelPlacer extends GamePieceManipulator { 2 | public void manipulate() { 3 | System.out.println("Placing the hatch panel!"); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/src/main/java/frc/robot/commands/Constants.java: -------------------------------------------------------------------------------- 1 | package frc.robot.commands; 2 | 3 | public class Constants { 4 | 5 | public static final double IS_ORIENTED_STRAIGHT_DEGREE_THRESHOLD = 5; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Project Code/Lesson 14/SpriteGame/src/Fightable.java: -------------------------------------------------------------------------------- 1 | public interface Fightable { 2 | public void attack(); 3 | 4 | public void takeDamage(int damage); 5 | 6 | public int getMaxHp(); 7 | 8 | public int getHpRemaining(); 9 | } 10 | -------------------------------------------------------------------------------- /Project Code/Lesson 15/SpriteGame/src/Fightable.java: -------------------------------------------------------------------------------- 1 | public interface Fightable { 2 | public void attack(); 3 | 4 | public void takeDamage(int damage); 5 | 6 | public int getMaxHp(); 7 | 8 | public int getHpRemaining(); 9 | } 10 | -------------------------------------------------------------------------------- /Project Code/Lesson 12/RobotComposition/src/PowerUpRobot.java: -------------------------------------------------------------------------------- 1 | public class PowerUpRobot extends Robot { 2 | 3 | public PowerUpRobot() { 4 | CubeElevator elevator = new CubeElevator(); 5 | this.manipulator = elevator; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Project Code/Lesson 12/RobotComposition/src/DeepSpaceRobot.java: -------------------------------------------------------------------------------- 1 | public class DeepSpaceRobot extends Robot { 2 | public DeepSpaceRobot() { 3 | HatchPanelPlacer placer = new HatchPanelPlacer(); 4 | this.manipulator = placer; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Project Code/Lesson 14/SpriteGame/src/Movable.java: -------------------------------------------------------------------------------- 1 | public interface Movable { 2 | public void moveNorth(); 3 | public void moveEast(); 4 | public void moveSouth(); 5 | public void moveWest(); 6 | public int getXPosition(); 7 | public int getYPosition(); 8 | } 9 | -------------------------------------------------------------------------------- /Project Code/Lesson 15/SpriteGame/src/Movable.java: -------------------------------------------------------------------------------- 1 | public interface Movable { 2 | public void moveNorth(); 3 | public void moveEast(); 4 | public void moveSouth(); 5 | public void moveWest(); 6 | public int getXPosition(); 7 | public int getYPosition(); 8 | } 9 | -------------------------------------------------------------------------------- /Project Code/Lesson 12/RobotComposition/src/Robot.java: -------------------------------------------------------------------------------- 1 | public class Robot { 2 | protected Drivetrain drivetrain; 3 | protected GamePieceManipulator manipulator; 4 | 5 | public void manipulateGamePiece() { 6 | manipulator.manipulate(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/src/main/deploy/example.txt: -------------------------------------------------------------------------------- 1 | Files placed in this directory will be deployed to the RoboRIO into the 2 | 'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function 3 | to get a proper path relative to the deploy directory. -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/src/main/deploy/example.txt: -------------------------------------------------------------------------------- 1 | Files placed in this directory will be deployed to the RoboRIO into the 2 | 'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function 3 | to get a proper path relative to the deploy directory. -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/src/main/deploy/example.txt: -------------------------------------------------------------------------------- 1 | Files placed in this directory will be deployed to the RoboRIO into the 2 | 'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function 3 | to get a proper path relative to the deploy directory. -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/src/main/deploy/example.txt: -------------------------------------------------------------------------------- 1 | Files placed in this directory will be deployed to the RoboRIO into the 2 | 'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function 3 | to get a proper path relative to the deploy directory. -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/src/main/deploy/example.txt: -------------------------------------------------------------------------------- 1 | Files placed in this directory will be deployed to the RoboRIO into the 2 | 'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function 3 | to get a proper path relative to the deploy directory. -------------------------------------------------------------------------------- /Project Code/Lesson 12/RobotComposition/src/InfiniteRechargeRobot.java: -------------------------------------------------------------------------------- 1 | public class InfiniteRechargeRobot extends Robot { 2 | 3 | public InfiniteRechargeRobot() { 4 | BallShooter ballShooter = new BallShooter(); 5 | this.manipulator = ballShooter; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Project Code/Lesson 15/SpriteGame/src/NPC.java: -------------------------------------------------------------------------------- 1 | public class NPC extends Character { 2 | public NPC(String name) { 3 | super(name); 4 | } 5 | 6 | @Override 7 | public void introduce() { 8 | System.out.println("I sell things!"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/src/main/deploy/example.txt: -------------------------------------------------------------------------------- 1 | Files placed in this directory will be deployed to the RoboRIO into the 2 | 'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function 3 | to get a proper path relative to the deploy directory. -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/src/main/deploy/example.txt: -------------------------------------------------------------------------------- 1 | Files placed in this directory will be deployed to the RoboRIO into the 2 | 'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function 3 | to get a proper path relative to the deploy directory. -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/src/main/deploy/example.txt: -------------------------------------------------------------------------------- 1 | Files placed in this directory will be deployed to the RoboRIO into the 2 | 'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function 3 | to get a proper path relative to the deploy directory. -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/src/main/deploy/example.txt: -------------------------------------------------------------------------------- 1 | Files placed in this directory will be deployed to the RoboRIO into the 2 | 'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function 3 | to get a proper path relative to the deploy directory. -------------------------------------------------------------------------------- /Project Code/Lesson 14/SpriteGame/src/NPC.java: -------------------------------------------------------------------------------- 1 | public class NPC extends Character { 2 | public NPC(String name) { 3 | this.setName(name); 4 | } 5 | 6 | @Override 7 | public void introduce() { 8 | System.out.println("I sell things!"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /Project Code/Lesson 14/SpriteGame/src/Character.java: -------------------------------------------------------------------------------- 1 | public abstract class Character { 2 | private String name; 3 | 4 | public void printName() { 5 | System.out.println(this.name); 6 | } 7 | 8 | public void setName(String name) { 9 | this.name = name; 10 | } 11 | 12 | public abstract void introduce(); 13 | } 14 | -------------------------------------------------------------------------------- /Project Code/Lesson 15/SpriteGame/src/Character.java: -------------------------------------------------------------------------------- 1 | public abstract class Character { 2 | private String name; 3 | 4 | public Character(String name) { 5 | this.setName(name); 6 | } 7 | 8 | public void printName() { 9 | System.out.println(this.name); 10 | } 11 | 12 | public void setName(String name) { 13 | this.name = name; 14 | } 15 | 16 | public abstract void introduce(); 17 | } 18 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic", 3 | "java.server.launchMode": "Standard", 4 | "files.exclude": { 5 | "**/.git": true, 6 | "**/.svn": true, 7 | "**/.hg": true, 8 | "**/CVS": true, 9 | "**/.DS_Store": true, 10 | "bin/": true, 11 | "**/.classpath": true, 12 | "**/.project": true, 13 | "**/.settings": true, 14 | "**/.factorypath": true, 15 | "**/*~": true 16 | }, 17 | "wpilib.skipSelectSimulateExtension": true 18 | } 19 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic", 3 | "java.server.launchMode": "Standard", 4 | "files.exclude": { 5 | "**/.git": true, 6 | "**/.svn": true, 7 | "**/.hg": true, 8 | "**/CVS": true, 9 | "**/.DS_Store": true, 10 | "bin/": true, 11 | "**/.classpath": true, 12 | "**/.project": true, 13 | "**/.settings": true, 14 | "**/.factorypath": true, 15 | "**/*~": true 16 | }, 17 | "wpilib.skipSelectSimulateExtension": true 18 | } 19 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic", 3 | "java.server.launchMode": "Standard", 4 | "files.exclude": { 5 | "**/.git": true, 6 | "**/.svn": true, 7 | "**/.hg": true, 8 | "**/CVS": true, 9 | "**/.DS_Store": true, 10 | "bin/": true, 11 | "**/.classpath": true, 12 | "**/.project": true, 13 | "**/.settings": true, 14 | "**/.factorypath": true, 15 | "**/*~": true 16 | }, 17 | "wpilib.skipSelectSimulateExtension": true 18 | } 19 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic", 3 | "java.server.launchMode": "Standard", 4 | "files.exclude": { 5 | "**/.git": true, 6 | "**/.svn": true, 7 | "**/.hg": true, 8 | "**/CVS": true, 9 | "**/.DS_Store": true, 10 | "bin/": true, 11 | "**/.classpath": true, 12 | "**/.project": true, 13 | "**/.settings": true, 14 | "**/.factorypath": true, 15 | "**/*~": true 16 | }, 17 | "wpilib.skipSelectSimulateExtension": true 18 | } 19 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic", 3 | "java.server.launchMode": "Standard", 4 | "files.exclude": { 5 | "**/.git": true, 6 | "**/.svn": true, 7 | "**/.hg": true, 8 | "**/CVS": true, 9 | "**/.DS_Store": true, 10 | "bin/": true, 11 | "**/.classpath": true, 12 | "**/.project": true, 13 | "**/.settings": true, 14 | "**/.factorypath": true, 15 | "**/*~": true 16 | }, 17 | "wpilib.skipSelectSimulateExtension": true 18 | } 19 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic", 3 | "java.server.launchMode": "Standard", 4 | "files.exclude": { 5 | "**/.git": true, 6 | "**/.svn": true, 7 | "**/.hg": true, 8 | "**/CVS": true, 9 | "**/.DS_Store": true, 10 | "bin/": true, 11 | "**/.classpath": true, 12 | "**/.project": true, 13 | "**/.settings": true, 14 | "**/.factorypath": true, 15 | "**/*~": true 16 | }, 17 | "wpilib.skipSelectSimulateExtension": true 18 | } 19 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic", 3 | "java.server.launchMode": "Standard", 4 | "files.exclude": { 5 | "**/.git": true, 6 | "**/.svn": true, 7 | "**/.hg": true, 8 | "**/CVS": true, 9 | "**/.DS_Store": true, 10 | "bin/": true, 11 | "**/.classpath": true, 12 | "**/.project": true, 13 | "**/.settings": true, 14 | "**/.factorypath": true, 15 | "**/*~": true 16 | }, 17 | "wpilib.skipSelectSimulateExtension": true 18 | } 19 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic", 3 | "java.server.launchMode": "Standard", 4 | "files.exclude": { 5 | "**/.git": true, 6 | "**/.svn": true, 7 | "**/.hg": true, 8 | "**/CVS": true, 9 | "**/.DS_Store": true, 10 | "bin/": true, 11 | "**/.classpath": true, 12 | "**/.project": true, 13 | "**/.settings": true, 14 | "**/.factorypath": true, 15 | "**/*~": true 16 | }, 17 | "wpilib.skipSelectSimulateExtension": true 18 | } 19 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic", 3 | "java.server.launchMode": "Standard", 4 | "files.exclude": { 5 | "**/.git": true, 6 | "**/.svn": true, 7 | "**/.hg": true, 8 | "**/CVS": true, 9 | "**/.DS_Store": true, 10 | "bin/": true, 11 | "**/.classpath": true, 12 | "**/.project": true, 13 | "**/.settings": true, 14 | "**/.factorypath": true, 15 | "**/*~": true 16 | }, 17 | "wpilib.skipSelectSimulateExtension": true 18 | } 19 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "type": "wpilib", 10 | "name": "WPILib Desktop Debug", 11 | "request": "launch", 12 | "desktop": true, 13 | }, 14 | { 15 | "type": "wpilib", 16 | "name": "WPILib roboRIO Debug", 17 | "request": "launch", 18 | "desktop": false, 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "type": "wpilib", 10 | "name": "WPILib Desktop Debug", 11 | "request": "launch", 12 | "desktop": true, 13 | }, 14 | { 15 | "type": "wpilib", 16 | "name": "WPILib roboRIO Debug", 17 | "request": "launch", 18 | "desktop": false, 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "type": "wpilib", 10 | "name": "WPILib Desktop Debug", 11 | "request": "launch", 12 | "desktop": true, 13 | }, 14 | { 15 | "type": "wpilib", 16 | "name": "WPILib roboRIO Debug", 17 | "request": "launch", 18 | "desktop": false, 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "type": "wpilib", 10 | "name": "WPILib Desktop Debug", 11 | "request": "launch", 12 | "desktop": true, 13 | }, 14 | { 15 | "type": "wpilib", 16 | "name": "WPILib roboRIO Debug", 17 | "request": "launch", 18 | "desktop": false, 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "type": "wpilib", 10 | "name": "WPILib Desktop Debug", 11 | "request": "launch", 12 | "desktop": true, 13 | }, 14 | { 15 | "type": "wpilib", 16 | "name": "WPILib roboRIO Debug", 17 | "request": "launch", 18 | "desktop": false, 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "type": "wpilib", 10 | "name": "WPILib Desktop Debug", 11 | "request": "launch", 12 | "desktop": true, 13 | }, 14 | { 15 | "type": "wpilib", 16 | "name": "WPILib roboRIO Debug", 17 | "request": "launch", 18 | "desktop": false, 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "type": "wpilib", 10 | "name": "WPILib Desktop Debug", 11 | "request": "launch", 12 | "desktop": true, 13 | }, 14 | { 15 | "type": "wpilib", 16 | "name": "WPILib roboRIO Debug", 17 | "request": "launch", 18 | "desktop": false, 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "type": "wpilib", 10 | "name": "WPILib Desktop Debug", 11 | "request": "launch", 12 | "desktop": true, 13 | }, 14 | { 15 | "type": "wpilib", 16 | "name": "WPILib roboRIO Debug", 17 | "request": "launch", 18 | "desktop": false, 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /Project Code/Lesson 14/SpriteGame/README.md: -------------------------------------------------------------------------------- 1 | ## Getting Started 2 | 3 | Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. 4 | 5 | ## Folder Structure 6 | 7 | The workspace contains two folders by default, where: 8 | 9 | - `src`: the folder to maintain sources 10 | - `lib`: the folder to maintain dependencies 11 | 12 | ## Dependency Management 13 | 14 | The `JAVA DEPENDENCIES` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-pack/blob/master/release-notes/v0.9.0.md#work-with-jar-files-directly). 15 | -------------------------------------------------------------------------------- /Project Code/Lesson 15/SpriteGame/README.md: -------------------------------------------------------------------------------- 1 | ## Getting Started 2 | 3 | Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. 4 | 5 | ## Folder Structure 6 | 7 | The workspace contains two folders by default, where: 8 | 9 | - `src`: the folder to maintain sources 10 | - `lib`: the folder to maintain dependencies 11 | 12 | ## Dependency Management 13 | 14 | The `JAVA DEPENDENCIES` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-pack/blob/master/release-notes/v0.9.0.md#work-with-jar-files-directly). 15 | -------------------------------------------------------------------------------- /Project Code/Lesson 4/MethodsScratch/README.md: -------------------------------------------------------------------------------- 1 | ## Getting Started 2 | 3 | Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. 4 | 5 | ## Folder Structure 6 | 7 | The workspace contains two folders by default, where: 8 | 9 | - `src`: the folder to maintain sources 10 | - `lib`: the folder to maintain dependencies 11 | 12 | ## Dependency Management 13 | 14 | The `JAVA DEPENDENCIES` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-pack/blob/master/release-notes/v0.9.0.md#work-with-jar-files-directly). 15 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "type": "wpilib", 10 | "name": "WPILib Desktop Debug", 11 | "request": "launch", 12 | "desktop": true, 13 | }, 14 | { 15 | "type": "wpilib", 16 | "name": "WPILib roboRIO Debug", 17 | "request": "launch", 18 | "desktop": false, 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /Project Code/Lesson 12/RobotComposition/README.md: -------------------------------------------------------------------------------- 1 | ## Getting Started 2 | 3 | Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. 4 | 5 | ## Folder Structure 6 | 7 | The workspace contains two folders by default, where: 8 | 9 | - `src`: the folder to maintain sources 10 | - `lib`: the folder to maintain dependencies 11 | 12 | ## Dependency Management 13 | 14 | The `JAVA DEPENDENCIES` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-pack/blob/master/release-notes/v0.9.0.md#work-with-jar-files-directly). 15 | -------------------------------------------------------------------------------- /Project Code/Lesson 15/BasicOperations/README.md: -------------------------------------------------------------------------------- 1 | ## Getting Started 2 | 3 | Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. 4 | 5 | ## Folder Structure 6 | 7 | The workspace contains two folders by default, where: 8 | 9 | - `src`: the folder to maintain sources 10 | - `lib`: the folder to maintain dependencies 11 | 12 | ## Dependency Management 13 | 14 | The `JAVA DEPENDENCIES` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-pack/blob/master/release-notes/v0.9.0.md#work-with-jar-files-directly). 15 | -------------------------------------------------------------------------------- /Project Code/Lesson 14/SpriteGame/src/DestructibleObject.java: -------------------------------------------------------------------------------- 1 | public class DestructibleObject implements Fightable { 2 | 3 | @Override 4 | public void attack() { 5 | System.out.println("Object destroyed!"); 6 | } 7 | 8 | @Override 9 | public void takeDamage(int damage) { 10 | // TODO Auto-generated method stub 11 | 12 | } 13 | 14 | @Override 15 | public int getMaxHp() { 16 | // TODO Auto-generated method stub 17 | return 0; 18 | } 19 | 20 | @Override 21 | public int getHpRemaining() { 22 | // TODO Auto-generated method stub 23 | return 0; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Project Code/Lesson 15/SpriteGame/src/DestructibleObject.java: -------------------------------------------------------------------------------- 1 | public class DestructibleObject implements Fightable { 2 | 3 | @Override 4 | public void attack() { 5 | System.out.println("Object destroyed!"); 6 | } 7 | 8 | @Override 9 | public void takeDamage(int damage) { 10 | // TODO Auto-generated method stub 11 | 12 | } 13 | 14 | @Override 15 | public int getMaxHp() { 16 | // TODO Auto-generated method stub 17 | return 0; 18 | } 19 | 20 | @Override 21 | public int getHpRemaining() { 22 | // TODO Auto-generated method stub 23 | return 0; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Project Code/Lesson 12/RobotComposition/src/RobotComposition.java: -------------------------------------------------------------------------------- 1 | public class RobotComposition { 2 | public static void main(String[] args) throws Exception { 3 | Robot robot = new Robot(); 4 | GamePieceManipulator manipulator = new GamePieceManipulator(); 5 | robot.manipulator = manipulator; 6 | 7 | PowerUpRobot powerUpRobot = new PowerUpRobot(); 8 | DeepSpaceRobot deepSpaceRobot = new DeepSpaceRobot(); 9 | InfiniteRechargeRobot infiniteRechargeRobot = new InfiniteRechargeRobot(); 10 | 11 | robot.manipulateGamePiece(); 12 | powerUpRobot.manipulateGamePiece(); 13 | deepSpaceRobot.manipulateGamePiece(); 14 | infiniteRechargeRobot.manipulateGamePiece(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/src/main/java/frc/robot/Constants.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | /** 8 | * The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean 9 | * constants. This class should not be used for any other purpose. All constants should be declared 10 | * globally (i.e. public static). Do not put anything functional in this class. 11 | * 12 | *

It is advised to statically import this class (or one of its inner classes) wherever the 13 | * constants are needed, to reduce verbosity. 14 | */ 15 | public final class Constants {} 16 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/src/main/java/frc/robot/Constants.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | /** 8 | * The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean 9 | * constants. This class should not be used for any other purpose. All constants should be declared 10 | * globally (i.e. public static). Do not put anything functional in this class. 11 | * 12 | *

It is advised to statically import this class (or one of its inner classes) wherever the 13 | * constants are needed, to reduce verbosity. 14 | */ 15 | public final class Constants {} 16 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/src/main/java/frc/robot/Constants.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | /** 8 | * The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean 9 | * constants. This class should not be used for any other purpose. All constants should be declared 10 | * globally (i.e. public static). Do not put anything functional in this class. 11 | * 12 | *

It is advised to statically import this class (or one of its inner classes) wherever the 13 | * constants are needed, to reduce verbosity. 14 | */ 15 | public final class Constants {} 16 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/src/main/java/frc/robot/Constants.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | /** 8 | * The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean 9 | * constants. This class should not be used for any other purpose. All constants should be declared 10 | * globally (i.e. public static). Do not put anything functional in this class. 11 | * 12 | *

It is advised to statically import this class (or one of its inner classes) wherever the 13 | * constants are needed, to reduce verbosity. 14 | */ 15 | public final class Constants {} 16 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/src/main/java/frc/robot/Constants.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | /** 8 | * The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean 9 | * constants. This class should not be used for any other purpose. All constants should be declared 10 | * globally (i.e. public static). Do not put anything functional in this class. 11 | * 12 | *

It is advised to statically import this class (or one of its inner classes) wherever the 13 | * constants are needed, to reduce verbosity. 14 | */ 15 | public final class Constants {} 16 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/src/main/java/frc/robot/Constants.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | /** 8 | * The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean 9 | * constants. This class should not be used for any other purpose. All constants should be declared 10 | * globally (i.e. public static). Do not put anything functional in this class. 11 | * 12 | *

It is advised to statically import this class (or one of its inner classes) wherever the 13 | * constants are needed, to reduce verbosity. 14 | */ 15 | public final class Constants {} 16 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/src/main/java/frc/robot/Constants.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | /** 8 | * The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean 9 | * constants. This class should not be used for any other purpose. All constants should be declared 10 | * globally (i.e. public static). Do not put anything functional in this class. 11 | * 12 | *

It is advised to statically import this class (or one of its inner classes) wherever the 13 | * constants are needed, to reduce verbosity. 14 | */ 15 | public final class Constants {} 16 | -------------------------------------------------------------------------------- /Project Code/Lesson 15/SpriteGame/src/Enemy.java: -------------------------------------------------------------------------------- 1 | public class Enemy extends Character implements Fightable { 2 | public Enemy(String name) { 3 | super(name); 4 | } 5 | 6 | @Override 7 | public void attack() { 8 | System.out.println("Enemy now attacking."); 9 | } 10 | 11 | @Override 12 | public void takeDamage(int damage) { 13 | // TODO Auto-generated method stub 14 | } 15 | 16 | @Override 17 | public int getMaxHp() { 18 | // TODO Auto-generated method stub 19 | return 0; 20 | } 21 | 22 | @Override 23 | public int getHpRemaining() { 24 | // TODO Auto-generated method stub 25 | return 0; 26 | } 27 | 28 | @Override 29 | public void introduce() { 30 | System.out.println("I am an evil enemy!"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Project Code/Lesson 14/SpriteGame/src/Enemy.java: -------------------------------------------------------------------------------- 1 | public class Enemy extends Character implements Fightable { 2 | public Enemy(String name) { 3 | this.setName(name); 4 | } 5 | 6 | @Override 7 | public void attack() { 8 | System.out.println("Enemy now attacking."); 9 | } 10 | 11 | @Override 12 | public void takeDamage(int damage) { 13 | // TODO Auto-generated method stub 14 | } 15 | 16 | @Override 17 | public int getMaxHp() { 18 | // TODO Auto-generated method stub 19 | return 0; 20 | } 21 | 22 | @Override 23 | public int getHpRemaining() { 24 | // TODO Auto-generated method stub 25 | return 0; 26 | } 27 | 28 | @Override 29 | public void introduce() { 30 | System.out.println("I am an evil enemy!"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/src/main/java/frc/robot/Main.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | import edu.wpi.first.wpilibj.RobotBase; 8 | 9 | /** 10 | * Do NOT add any static variables to this class, or any initialization at all. Unless you know what 11 | * you are doing, do not modify this file except to change the parameter class to the startRobot 12 | * call. 13 | */ 14 | public final class Main { 15 | private Main() {} 16 | 17 | /** 18 | * Main initialization function. Do not perform any initialization here. 19 | * 20 | *

If you change your main robot class, change the parameter type. 21 | */ 22 | public static void main(String... args) { 23 | RobotBase.startRobot(Robot::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/src/main/java/frc/robot/Main.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | import edu.wpi.first.wpilibj.RobotBase; 8 | 9 | /** 10 | * Do NOT add any static variables to this class, or any initialization at all. Unless you know what 11 | * you are doing, do not modify this file except to change the parameter class to the startRobot 12 | * call. 13 | */ 14 | public final class Main { 15 | private Main() {} 16 | 17 | /** 18 | * Main initialization function. Do not perform any initialization here. 19 | * 20 | *

If you change your main robot class, change the parameter type. 21 | */ 22 | public static void main(String... args) { 23 | RobotBase.startRobot(Robot::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/src/main/java/frc/robot/Main.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | import edu.wpi.first.wpilibj.RobotBase; 8 | 9 | /** 10 | * Do NOT add any static variables to this class, or any initialization at all. Unless you know what 11 | * you are doing, do not modify this file except to change the parameter class to the startRobot 12 | * call. 13 | */ 14 | public final class Main { 15 | private Main() {} 16 | 17 | /** 18 | * Main initialization function. Do not perform any initialization here. 19 | * 20 | *

If you change your main robot class, change the parameter type. 21 | */ 22 | public static void main(String... args) { 23 | RobotBase.startRobot(Robot::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/src/main/java/frc/robot/Main.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | import edu.wpi.first.wpilibj.RobotBase; 8 | 9 | /** 10 | * Do NOT add any static variables to this class, or any initialization at all. Unless you know what 11 | * you are doing, do not modify this file except to change the parameter class to the startRobot 12 | * call. 13 | */ 14 | public final class Main { 15 | private Main() {} 16 | 17 | /** 18 | * Main initialization function. Do not perform any initialization here. 19 | * 20 | *

If you change your main robot class, change the parameter type. 21 | */ 22 | public static void main(String... args) { 23 | RobotBase.startRobot(Robot::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/src/main/java/frc/robot/Main.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | import edu.wpi.first.wpilibj.RobotBase; 8 | 9 | /** 10 | * Do NOT add any static variables to this class, or any initialization at all. Unless you know what 11 | * you are doing, do not modify this file except to change the parameter class to the startRobot 12 | * call. 13 | */ 14 | public final class Main { 15 | private Main() {} 16 | 17 | /** 18 | * Main initialization function. Do not perform any initialization here. 19 | * 20 | *

If you change your main robot class, change the parameter type. 21 | */ 22 | public static void main(String... args) { 23 | RobotBase.startRobot(Robot::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/src/main/java/frc/robot/Main.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | import edu.wpi.first.wpilibj.RobotBase; 8 | 9 | /** 10 | * Do NOT add any static variables to this class, or any initialization at all. Unless you know what 11 | * you are doing, do not modify this file except to change the parameter class to the startRobot 12 | * call. 13 | */ 14 | public final class Main { 15 | private Main() {} 16 | 17 | /** 18 | * Main initialization function. Do not perform any initialization here. 19 | * 20 | *

If you change your main robot class, change the parameter type. 21 | */ 22 | public static void main(String... args) { 23 | RobotBase.startRobot(Robot::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/src/main/java/frc/robot/Main.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | import edu.wpi.first.wpilibj.RobotBase; 8 | 9 | /** 10 | * Do NOT add any static variables to this class, or any initialization at all. Unless you know what 11 | * you are doing, do not modify this file except to change the parameter class to the startRobot 12 | * call. 13 | */ 14 | public final class Main { 15 | private Main() {} 16 | 17 | /** 18 | * Main initialization function. Do not perform any initialization here. 19 | * 20 | *

If you change your main robot class, change the parameter type. 21 | */ 22 | public static void main(String... args) { 23 | RobotBase.startRobot(Robot::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/src/main/java/frc/robot/Main.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | import edu.wpi.first.wpilibj.RobotBase; 8 | 9 | /** 10 | * Do NOT add any static variables to this class, or any initialization at all. Unless you know what 11 | * you are doing, do not modify this file except to change the parameter class to the startRobot 12 | * call. 13 | */ 14 | public final class Main { 15 | private Main() {} 16 | 17 | /** 18 | * Main initialization function. Do not perform any initialization here. 19 | * 20 | *

If you change your main robot class, change the parameter type. 21 | */ 22 | public static void main(String... args) { 23 | RobotBase.startRobot(Robot::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/src/main/java/frc/robot/Constants.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | /** 8 | * The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean 9 | * constants. This class should not be used for any other purpose. All constants should be declared 10 | * globally (i.e. public static). Do not put anything functional in this class. 11 | * 12 | *

It is advised to statically import this class (or one of its inner classes) wherever the 13 | * constants are needed, to reduce verbosity. 14 | */ 15 | public final class Constants { 16 | public static final double GYRO_ADJUST_SCALE_COEFFICIENT = .01; 17 | public static final double Z_AXIS_ROTATE_DEADBAND_VALUE = .1; 18 | } 19 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/settings.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.internal.os.OperatingSystem 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | gradlePluginPortal() 7 | String frcYear = '2021' 8 | File frcHome 9 | if (OperatingSystem.current().isWindows()) { 10 | String publicFolder = System.getenv('PUBLIC') 11 | if (publicFolder == null) { 12 | publicFolder = "C:\\Users\\Public" 13 | } 14 | def homeRoot = new File(publicFolder, "wpilib") 15 | frcHome = new File(homeRoot, frcYear) 16 | } else { 17 | def userFolder = System.getProperty("user.home") 18 | def homeRoot = new File(userFolder, "wpilib") 19 | frcHome = new File(homeRoot, frcYear) 20 | } 21 | def frcHomeMaven = new File(frcHome, 'maven') 22 | maven { 23 | name 'frcHome' 24 | url frcHomeMaven 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/settings.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.internal.os.OperatingSystem 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | gradlePluginPortal() 7 | String frcYear = '2021' 8 | File frcHome 9 | if (OperatingSystem.current().isWindows()) { 10 | String publicFolder = System.getenv('PUBLIC') 11 | if (publicFolder == null) { 12 | publicFolder = "C:\\Users\\Public" 13 | } 14 | def homeRoot = new File(publicFolder, "wpilib") 15 | frcHome = new File(homeRoot, frcYear) 16 | } else { 17 | def userFolder = System.getProperty("user.home") 18 | def homeRoot = new File(userFolder, "wpilib") 19 | frcHome = new File(homeRoot, frcYear) 20 | } 21 | def frcHomeMaven = new File(frcHome, 'maven') 22 | maven { 23 | name 'frcHome' 24 | url frcHomeMaven 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/settings.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.internal.os.OperatingSystem 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | gradlePluginPortal() 7 | String frcYear = '2021' 8 | File frcHome 9 | if (OperatingSystem.current().isWindows()) { 10 | String publicFolder = System.getenv('PUBLIC') 11 | if (publicFolder == null) { 12 | publicFolder = "C:\\Users\\Public" 13 | } 14 | def homeRoot = new File(publicFolder, "wpilib") 15 | frcHome = new File(homeRoot, frcYear) 16 | } else { 17 | def userFolder = System.getProperty("user.home") 18 | def homeRoot = new File(userFolder, "wpilib") 19 | frcHome = new File(homeRoot, frcYear) 20 | } 21 | def frcHomeMaven = new File(frcHome, 'maven') 22 | maven { 23 | name 'frcHome' 24 | url frcHomeMaven 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/settings.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.internal.os.OperatingSystem 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | gradlePluginPortal() 7 | String frcYear = '2021' 8 | File frcHome 9 | if (OperatingSystem.current().isWindows()) { 10 | String publicFolder = System.getenv('PUBLIC') 11 | if (publicFolder == null) { 12 | publicFolder = "C:\\Users\\Public" 13 | } 14 | def homeRoot = new File(publicFolder, "wpilib") 15 | frcHome = new File(homeRoot, frcYear) 16 | } else { 17 | def userFolder = System.getProperty("user.home") 18 | def homeRoot = new File(userFolder, "wpilib") 19 | frcHome = new File(homeRoot, frcYear) 20 | } 21 | def frcHomeMaven = new File(frcHome, 'maven') 22 | maven { 23 | name 'frcHome' 24 | url frcHomeMaven 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/settings.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.internal.os.OperatingSystem 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | gradlePluginPortal() 7 | String frcYear = '2021' 8 | File frcHome 9 | if (OperatingSystem.current().isWindows()) { 10 | String publicFolder = System.getenv('PUBLIC') 11 | if (publicFolder == null) { 12 | publicFolder = "C:\\Users\\Public" 13 | } 14 | def homeRoot = new File(publicFolder, "wpilib") 15 | frcHome = new File(homeRoot, frcYear) 16 | } else { 17 | def userFolder = System.getProperty("user.home") 18 | def homeRoot = new File(userFolder, "wpilib") 19 | frcHome = new File(homeRoot, frcYear) 20 | } 21 | def frcHomeMaven = new File(frcHome, 'maven') 22 | maven { 23 | name 'frcHome' 24 | url frcHomeMaven 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/settings.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.internal.os.OperatingSystem 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | gradlePluginPortal() 7 | String frcYear = '2021' 8 | File frcHome 9 | if (OperatingSystem.current().isWindows()) { 10 | String publicFolder = System.getenv('PUBLIC') 11 | if (publicFolder == null) { 12 | publicFolder = "C:\\Users\\Public" 13 | } 14 | def homeRoot = new File(publicFolder, "wpilib") 15 | frcHome = new File(homeRoot, frcYear) 16 | } else { 17 | def userFolder = System.getProperty("user.home") 18 | def homeRoot = new File(userFolder, "wpilib") 19 | frcHome = new File(homeRoot, frcYear) 20 | } 21 | def frcHomeMaven = new File(frcHome, 'maven') 22 | maven { 23 | name 'frcHome' 24 | url frcHomeMaven 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/settings.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.internal.os.OperatingSystem 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | gradlePluginPortal() 7 | String frcYear = '2021' 8 | File frcHome 9 | if (OperatingSystem.current().isWindows()) { 10 | String publicFolder = System.getenv('PUBLIC') 11 | if (publicFolder == null) { 12 | publicFolder = "C:\\Users\\Public" 13 | } 14 | def homeRoot = new File(publicFolder, "wpilib") 15 | frcHome = new File(homeRoot, frcYear) 16 | } else { 17 | def userFolder = System.getProperty("user.home") 18 | def homeRoot = new File(userFolder, "wpilib") 19 | frcHome = new File(homeRoot, frcYear) 20 | } 21 | def frcHomeMaven = new File(frcHome, 'maven') 22 | maven { 23 | name 'frcHome' 24 | url frcHomeMaven 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/settings.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.internal.os.OperatingSystem 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | gradlePluginPortal() 7 | String frcYear = '2021' 8 | File frcHome 9 | if (OperatingSystem.current().isWindows()) { 10 | String publicFolder = System.getenv('PUBLIC') 11 | if (publicFolder == null) { 12 | publicFolder = "C:\\Users\\Public" 13 | } 14 | def homeRoot = new File(publicFolder, "wpilib") 15 | frcHome = new File(homeRoot, frcYear) 16 | } else { 17 | def userFolder = System.getProperty("user.home") 18 | def homeRoot = new File(userFolder, "wpilib") 19 | frcHome = new File(homeRoot, frcYear) 20 | } 21 | def frcHomeMaven = new File(frcHome, 'maven') 22 | maven { 23 | name 'frcHome' 24 | url frcHomeMaven 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/settings.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.internal.os.OperatingSystem 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | gradlePluginPortal() 7 | String frcYear = '2021' 8 | File frcHome 9 | if (OperatingSystem.current().isWindows()) { 10 | String publicFolder = System.getenv('PUBLIC') 11 | if (publicFolder == null) { 12 | publicFolder = "C:\\Users\\Public" 13 | } 14 | def homeRoot = new File(publicFolder, "wpilib") 15 | frcHome = new File(homeRoot, frcYear) 16 | } else { 17 | def userFolder = System.getProperty("user.home") 18 | def homeRoot = new File(userFolder, "wpilib") 19 | frcHome = new File(homeRoot, frcYear) 20 | } 21 | def frcHomeMaven = new File(frcHome, 'maven') 22 | maven { 23 | name 'frcHome' 24 | url frcHomeMaven 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/src/main/java/frc/robot/Constants.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | /** 8 | * The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean 9 | * constants. This class should not be used for any other purpose. All constants should be declared 10 | * globally (i.e. public static). Do not put anything functional in this class. 11 | * 12 | *

It is advised to statically import this class (or one of its inner classes) wherever the 13 | * constants are needed, to reduce verbosity. 14 | */ 15 | public final class Constants { 16 | public static final double GYRO_ADJUST_SCALE_COEFFICIENT = .01; 17 | public static final double Z_AXIS_ROTATE_DEADBAND_VALUE = .1; 18 | public static final double TURN_TIMER_TURNING_GRACE_PERIOD = .5; 19 | } 20 | -------------------------------------------------------------------------------- /Project Code/Lesson 15/BasicOperations/src/App.java: -------------------------------------------------------------------------------- 1 | public class App { 2 | public static void main(String[] args) throws Exception { 3 | System.out.println(add(5, 10)); 4 | System.out.println(subtract(5, 10)); 5 | System.out.println(multiply(5, 10)); 6 | System.out.println(divide(5, 10)); 7 | 8 | System.out.println(Math.cos(.5)); 9 | System.out.println(Math.sin(.5)); 10 | System.out.println(Math.PI); 11 | System.out.println(Math.random()); 12 | } 13 | 14 | public static int add(int firstNumber, int secondNumber) { 15 | return firstNumber + secondNumber; 16 | } 17 | 18 | public static int subtract(int firstNumber, int secondNumber) { 19 | return firstNumber - secondNumber; 20 | } 21 | 22 | public static int multiply(int firstNumber, int secondNumber) { 23 | return firstNumber * secondNumber; 24 | } 25 | 26 | public static double divide(double firstNumber, double secondNumber) { 27 | return firstNumber / secondNumber; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/src/main/java/frc/robot/commands/AutonomousDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousDistance extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on distance. This will drive out for a specified distance, 13 | * turn around and drive back. 14 | * 15 | * @param drivetrain The drivetrain subsystem on which this command will run 16 | */ 17 | public AutonomousDistance(Drivetrain drivetrain) { 18 | addCommands( 19 | new DriveDistance(-0.5, 10, drivetrain), 20 | new TurnDegrees(-0.5, 180, drivetrain), 21 | new DriveDistance(-0.5, 10, drivetrain), 22 | new TurnDegrees(0.5, 180, drivetrain)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/src/main/java/frc/robot/commands/AutonomousDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousDistance extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on distance. This will drive out for a specified distance, 13 | * turn around and drive back. 14 | * 15 | * @param drivetrain The drivetrain subsystem on which this command will run 16 | */ 17 | public AutonomousDistance(Drivetrain drivetrain) { 18 | addCommands( 19 | new DriveDistance(-0.5, 10, drivetrain), 20 | new TurnDegrees(-0.5, 180, drivetrain), 21 | new DriveDistance(-0.5, 10, drivetrain), 22 | new TurnDegrees(0.5, 180, drivetrain)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/src/main/java/frc/robot/commands/AutonomousDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousDistance extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on distance. This will drive out for a specified distance, 13 | * turn around and drive back. 14 | * 15 | * @param drivetrain The drivetrain subsystem on which this command will run 16 | */ 17 | public AutonomousDistance(Drivetrain drivetrain) { 18 | addCommands( 19 | new DriveDistance(-0.5, 10, drivetrain), 20 | new TurnDegrees(-0.5, 180, drivetrain), 21 | new DriveDistance(-0.5, 10, drivetrain), 22 | new TurnDegrees(0.5, 180, drivetrain)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/src/main/java/frc/robot/commands/AutonomousDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousDistance extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on distance. This will drive out for a specified distance, 13 | * turn around and drive back. 14 | * 15 | * @param drivetrain The drivetrain subsystem on which this command will run 16 | */ 17 | public AutonomousDistance(Drivetrain drivetrain) { 18 | addCommands( 19 | new DriveDistance(-0.5, 10, drivetrain), 20 | new TurnDegrees(-0.5, 180, drivetrain), 21 | new DriveDistance(-0.5, 10, drivetrain), 22 | new TurnDegrees(0.5, 180, drivetrain)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/src/main/java/frc/robot/commands/AutonomousDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousDistance extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on distance. This will drive out for a specified distance, 13 | * turn around and drive back. 14 | * 15 | * @param drivetrain The drivetrain subsystem on which this command will run 16 | */ 17 | public AutonomousDistance(Drivetrain drivetrain) { 18 | addCommands( 19 | new DriveDistance(-0.5, 10, drivetrain), 20 | new TurnDegrees(-0.5, 180, drivetrain), 21 | new DriveDistance(-0.5, 10, drivetrain), 22 | new TurnDegrees(0.5, 180, drivetrain)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/src/main/java/frc/robot/commands/AutonomousDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousDistance extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on distance. This will drive out for a specified distance, 13 | * turn around and drive back. 14 | * 15 | * @param drivetrain The drivetrain subsystem on which this command will run 16 | */ 17 | public AutonomousDistance(Drivetrain drivetrain) { 18 | addCommands( 19 | new DriveDistance(-0.5, 10, drivetrain), 20 | new TurnDegrees(-0.5, 180, drivetrain), 21 | new DriveDistance(-0.5, 10, drivetrain), 22 | new TurnDegrees(0.5, 180, drivetrain)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/src/main/java/frc/robot/commands/AutonomousDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousDistance extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on distance. This will drive out for a specified distance, 13 | * turn around and drive back. 14 | * 15 | * @param drivetrain The drivetrain subsystem on which this command will run 16 | */ 17 | public AutonomousDistance(Drivetrain drivetrain) { 18 | addCommands( 19 | new DriveDistance(-0.5, 10, drivetrain), 20 | new TurnDegrees(-0.5, 180, drivetrain), 21 | new DriveDistance(-0.5, 10, drivetrain), 22 | new TurnDegrees(0.5, 180, drivetrain)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/src/main/java/frc/robot/commands/AutonomousDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousDistance extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on distance. This will drive out for a specified distance, 13 | * turn around and drive back. 14 | * 15 | * @param drivetrain The drivetrain subsystem on which this command will run 16 | */ 17 | public AutonomousDistance(Drivetrain drivetrain) { 18 | addCommands( 19 | new DriveDistance(-0.5, 10, drivetrain), 20 | new TurnDegrees(-0.5, 180, drivetrain), 21 | new DriveDistance(-0.5, 10, drivetrain), 22 | new TurnDegrees(0.5, 180, drivetrain)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/src/main/java/frc/robot/commands/AutonomousDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousDistance extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on distance. This will drive out for a specified distance, 13 | * turn around and drive back. 14 | * 15 | * @param drivetrain The drivetrain subsystem on which this command will run 16 | */ 17 | public AutonomousDistance(Drivetrain drivetrain) { 18 | addCommands( 19 | new DriveDistance(-0.5, 10, drivetrain), 20 | new TurnDegrees(-0.5, 180, drivetrain), 21 | new DriveDistance(-0.5, 10, drivetrain), 22 | new TurnDegrees(0.5, 180, drivetrain)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/src/main/java/frc/robot/commands/AutonomousTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousTime extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on time. This will drive out for a period of time, turn 13 | * around for time (equivalent to time to turn around) and drive forward again. This should mimic 14 | * driving out, turning around and driving back. 15 | * 16 | * @param drivetrain The drive subsystem on which this command will run 17 | */ 18 | public AutonomousTime(Drivetrain drivetrain) { 19 | addCommands( 20 | new DriveTime(-0.6, 2.0, drivetrain), 21 | new TurnTime(-0.5, 1.3, drivetrain), 22 | new DriveTime(-0.6, 2.0, drivetrain), 23 | new TurnTime(0.5, 1.3, drivetrain)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/src/main/java/frc/robot/commands/AutonomousTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousTime extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on time. This will drive out for a period of time, turn 13 | * around for time (equivalent to time to turn around) and drive forward again. This should mimic 14 | * driving out, turning around and driving back. 15 | * 16 | * @param drivetrain The drive subsystem on which this command will run 17 | */ 18 | public AutonomousTime(Drivetrain drivetrain) { 19 | addCommands( 20 | new DriveTime(-0.6, 2.0, drivetrain), 21 | new TurnTime(-0.5, 1.3, drivetrain), 22 | new DriveTime(-0.6, 2.0, drivetrain), 23 | new TurnTime(0.5, 1.3, drivetrain)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/src/main/java/frc/robot/commands/AutonomousTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousTime extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on time. This will drive out for a period of time, turn 13 | * around for time (equivalent to time to turn around) and drive forward again. This should mimic 14 | * driving out, turning around and driving back. 15 | * 16 | * @param drivetrain The drive subsystem on which this command will run 17 | */ 18 | public AutonomousTime(Drivetrain drivetrain) { 19 | addCommands( 20 | new DriveTime(-0.6, 2.0, drivetrain), 21 | new TurnTime(-0.5, 1.3, drivetrain), 22 | new DriveTime(-0.6, 2.0, drivetrain), 23 | new TurnTime(0.5, 1.3, drivetrain)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/src/main/java/frc/robot/commands/AutonomousTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousTime extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on time. This will drive out for a period of time, turn 13 | * around for time (equivalent to time to turn around) and drive forward again. This should mimic 14 | * driving out, turning around and driving back. 15 | * 16 | * @param drivetrain The drive subsystem on which this command will run 17 | */ 18 | public AutonomousTime(Drivetrain drivetrain) { 19 | addCommands( 20 | new DriveTime(-0.6, 2.0, drivetrain), 21 | new TurnTime(-0.5, 1.3, drivetrain), 22 | new DriveTime(-0.6, 2.0, drivetrain), 23 | new TurnTime(0.5, 1.3, drivetrain)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/src/main/java/frc/robot/commands/AutonomousTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousTime extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on time. This will drive out for a period of time, turn 13 | * around for time (equivalent to time to turn around) and drive forward again. This should mimic 14 | * driving out, turning around and driving back. 15 | * 16 | * @param drivetrain The drive subsystem on which this command will run 17 | */ 18 | public AutonomousTime(Drivetrain drivetrain) { 19 | addCommands( 20 | new DriveTime(-0.6, 2.0, drivetrain), 21 | new TurnTime(-0.5, 1.3, drivetrain), 22 | new DriveTime(-0.6, 2.0, drivetrain), 23 | new TurnTime(0.5, 1.3, drivetrain)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/src/main/java/frc/robot/commands/AutonomousTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousTime extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on time. This will drive out for a period of time, turn 13 | * around for time (equivalent to time to turn around) and drive forward again. This should mimic 14 | * driving out, turning around and driving back. 15 | * 16 | * @param drivetrain The drive subsystem on which this command will run 17 | */ 18 | public AutonomousTime(Drivetrain drivetrain) { 19 | addCommands( 20 | new DriveTime(-0.6, 2.0, drivetrain), 21 | new TurnTime(-0.5, 1.3, drivetrain), 22 | new DriveTime(-0.6, 2.0, drivetrain), 23 | new TurnTime(0.5, 1.3, drivetrain)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/src/main/java/frc/robot/commands/AutonomousTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousTime extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on time. This will drive out for a period of time, turn 13 | * around for time (equivalent to time to turn around) and drive forward again. This should mimic 14 | * driving out, turning around and driving back. 15 | * 16 | * @param drivetrain The drive subsystem on which this command will run 17 | */ 18 | public AutonomousTime(Drivetrain drivetrain) { 19 | addCommands( 20 | new DriveTime(-0.6, 2.0, drivetrain), 21 | new TurnTime(-0.5, 1.3, drivetrain), 22 | new DriveTime(-0.6, 2.0, drivetrain), 23 | new TurnTime(0.5, 1.3, drivetrain)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/src/main/java/frc/robot/commands/AutonomousTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousTime extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on time. This will drive out for a period of time, turn 13 | * around for time (equivalent to time to turn around) and drive forward again. This should mimic 14 | * driving out, turning around and driving back. 15 | * 16 | * @param drivetrain The drive subsystem on which this command will run 17 | */ 18 | public AutonomousTime(Drivetrain drivetrain) { 19 | addCommands( 20 | new DriveTime(-0.6, 2.0, drivetrain), 21 | new TurnTime(-0.5, 1.3, drivetrain), 22 | new DriveTime(-0.6, 2.0, drivetrain), 23 | new TurnTime(0.5, 1.3, drivetrain)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/src/main/java/frc/robot/commands/AutonomousTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 9 | 10 | public class AutonomousTime extends SequentialCommandGroup { 11 | /** 12 | * Creates a new Autonomous Drive based on time. This will drive out for a period of time, turn 13 | * around for time (equivalent to time to turn around) and drive forward again. This should mimic 14 | * driving out, turning around and driving back. 15 | * 16 | * @param drivetrain The drive subsystem on which this command will run 17 | */ 18 | public AutonomousTime(Drivetrain drivetrain) { 19 | addCommands( 20 | new DriveTime(-0.6, 2.0, drivetrain), 21 | new TurnTime(-0.5, 1.3, drivetrain), 22 | new DriveTime(-0.6, 2.0, drivetrain), 23 | new TurnTime(0.5, 1.3, drivetrain)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/vendordeps/WPILibNewCommands.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileName": "WPILibNewCommands.json", 3 | "name": "WPILib-New-Commands", 4 | "version": "2020.0.0", 5 | "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", 6 | "mavenUrls": [], 7 | "jsonUrl": "", 8 | "javaDependencies": [ 9 | { 10 | "groupId": "edu.wpi.first.wpilibNewCommands", 11 | "artifactId": "wpilibNewCommands-java", 12 | "version": "wpilib" 13 | } 14 | ], 15 | "jniDependencies": [], 16 | "cppDependencies": [ 17 | { 18 | "groupId": "edu.wpi.first.wpilibNewCommands", 19 | "artifactId": "wpilibNewCommands-cpp", 20 | "version": "wpilib", 21 | "libName": "wpilibNewCommands", 22 | "headerClassifier": "headers", 23 | "sourcesClassifier": "sources", 24 | "sharedLibrary": true, 25 | "skipInvalidPlatforms": true, 26 | "binaryPlatforms": [ 27 | "linuxathena", 28 | "linuxraspbian", 29 | "linuxaarch64bionic", 30 | "windowsx86-64", 31 | "windowsx86", 32 | "linuxx86-64", 33 | "osxx86-64" 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/vendordeps/WPILibNewCommands.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileName": "WPILibNewCommands.json", 3 | "name": "WPILib-New-Commands", 4 | "version": "2020.0.0", 5 | "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", 6 | "mavenUrls": [], 7 | "jsonUrl": "", 8 | "javaDependencies": [ 9 | { 10 | "groupId": "edu.wpi.first.wpilibNewCommands", 11 | "artifactId": "wpilibNewCommands-java", 12 | "version": "wpilib" 13 | } 14 | ], 15 | "jniDependencies": [], 16 | "cppDependencies": [ 17 | { 18 | "groupId": "edu.wpi.first.wpilibNewCommands", 19 | "artifactId": "wpilibNewCommands-cpp", 20 | "version": "wpilib", 21 | "libName": "wpilibNewCommands", 22 | "headerClassifier": "headers", 23 | "sourcesClassifier": "sources", 24 | "sharedLibrary": true, 25 | "skipInvalidPlatforms": true, 26 | "binaryPlatforms": [ 27 | "linuxathena", 28 | "linuxraspbian", 29 | "linuxaarch64bionic", 30 | "windowsx86-64", 31 | "windowsx86", 32 | "linuxx86-64", 33 | "osxx86-64" 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/vendordeps/WPILibNewCommands.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileName": "WPILibNewCommands.json", 3 | "name": "WPILib-New-Commands", 4 | "version": "2020.0.0", 5 | "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", 6 | "mavenUrls": [], 7 | "jsonUrl": "", 8 | "javaDependencies": [ 9 | { 10 | "groupId": "edu.wpi.first.wpilibNewCommands", 11 | "artifactId": "wpilibNewCommands-java", 12 | "version": "wpilib" 13 | } 14 | ], 15 | "jniDependencies": [], 16 | "cppDependencies": [ 17 | { 18 | "groupId": "edu.wpi.first.wpilibNewCommands", 19 | "artifactId": "wpilibNewCommands-cpp", 20 | "version": "wpilib", 21 | "libName": "wpilibNewCommands", 22 | "headerClassifier": "headers", 23 | "sourcesClassifier": "sources", 24 | "sharedLibrary": true, 25 | "skipInvalidPlatforms": true, 26 | "binaryPlatforms": [ 27 | "linuxathena", 28 | "linuxraspbian", 29 | "linuxaarch64bionic", 30 | "windowsx86-64", 31 | "windowsx86", 32 | "linuxx86-64", 33 | "osxx86-64" 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/vendordeps/WPILibNewCommands.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileName": "WPILibNewCommands.json", 3 | "name": "WPILib-New-Commands", 4 | "version": "2020.0.0", 5 | "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", 6 | "mavenUrls": [], 7 | "jsonUrl": "", 8 | "javaDependencies": [ 9 | { 10 | "groupId": "edu.wpi.first.wpilibNewCommands", 11 | "artifactId": "wpilibNewCommands-java", 12 | "version": "wpilib" 13 | } 14 | ], 15 | "jniDependencies": [], 16 | "cppDependencies": [ 17 | { 18 | "groupId": "edu.wpi.first.wpilibNewCommands", 19 | "artifactId": "wpilibNewCommands-cpp", 20 | "version": "wpilib", 21 | "libName": "wpilibNewCommands", 22 | "headerClassifier": "headers", 23 | "sourcesClassifier": "sources", 24 | "sharedLibrary": true, 25 | "skipInvalidPlatforms": true, 26 | "binaryPlatforms": [ 27 | "linuxathena", 28 | "linuxraspbian", 29 | "linuxaarch64bionic", 30 | "windowsx86-64", 31 | "windowsx86", 32 | "linuxx86-64", 33 | "osxx86-64" 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/vendordeps/WPILibNewCommands.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileName": "WPILibNewCommands.json", 3 | "name": "WPILib-New-Commands", 4 | "version": "2020.0.0", 5 | "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", 6 | "mavenUrls": [], 7 | "jsonUrl": "", 8 | "javaDependencies": [ 9 | { 10 | "groupId": "edu.wpi.first.wpilibNewCommands", 11 | "artifactId": "wpilibNewCommands-java", 12 | "version": "wpilib" 13 | } 14 | ], 15 | "jniDependencies": [], 16 | "cppDependencies": [ 17 | { 18 | "groupId": "edu.wpi.first.wpilibNewCommands", 19 | "artifactId": "wpilibNewCommands-cpp", 20 | "version": "wpilib", 21 | "libName": "wpilibNewCommands", 22 | "headerClassifier": "headers", 23 | "sourcesClassifier": "sources", 24 | "sharedLibrary": true, 25 | "skipInvalidPlatforms": true, 26 | "binaryPlatforms": [ 27 | "linuxathena", 28 | "linuxraspbian", 29 | "linuxaarch64bionic", 30 | "windowsx86-64", 31 | "windowsx86", 32 | "linuxx86-64", 33 | "osxx86-64" 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/vendordeps/WPILibNewCommands.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileName": "WPILibNewCommands.json", 3 | "name": "WPILib-New-Commands", 4 | "version": "2020.0.0", 5 | "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", 6 | "mavenUrls": [], 7 | "jsonUrl": "", 8 | "javaDependencies": [ 9 | { 10 | "groupId": "edu.wpi.first.wpilibNewCommands", 11 | "artifactId": "wpilibNewCommands-java", 12 | "version": "wpilib" 13 | } 14 | ], 15 | "jniDependencies": [], 16 | "cppDependencies": [ 17 | { 18 | "groupId": "edu.wpi.first.wpilibNewCommands", 19 | "artifactId": "wpilibNewCommands-cpp", 20 | "version": "wpilib", 21 | "libName": "wpilibNewCommands", 22 | "headerClassifier": "headers", 23 | "sourcesClassifier": "sources", 24 | "sharedLibrary": true, 25 | "skipInvalidPlatforms": true, 26 | "binaryPlatforms": [ 27 | "linuxathena", 28 | "linuxraspbian", 29 | "linuxaarch64bionic", 30 | "windowsx86-64", 31 | "windowsx86", 32 | "linuxx86-64", 33 | "osxx86-64" 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/vendordeps/WPILibNewCommands.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileName": "WPILibNewCommands.json", 3 | "name": "WPILib-New-Commands", 4 | "version": "2020.0.0", 5 | "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", 6 | "mavenUrls": [], 7 | "jsonUrl": "", 8 | "javaDependencies": [ 9 | { 10 | "groupId": "edu.wpi.first.wpilibNewCommands", 11 | "artifactId": "wpilibNewCommands-java", 12 | "version": "wpilib" 13 | } 14 | ], 15 | "jniDependencies": [], 16 | "cppDependencies": [ 17 | { 18 | "groupId": "edu.wpi.first.wpilibNewCommands", 19 | "artifactId": "wpilibNewCommands-cpp", 20 | "version": "wpilib", 21 | "libName": "wpilibNewCommands", 22 | "headerClassifier": "headers", 23 | "sourcesClassifier": "sources", 24 | "sharedLibrary": true, 25 | "skipInvalidPlatforms": true, 26 | "binaryPlatforms": [ 27 | "linuxathena", 28 | "linuxraspbian", 29 | "linuxaarch64bionic", 30 | "windowsx86-64", 31 | "windowsx86", 32 | "linuxx86-64", 33 | "osxx86-64" 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/vendordeps/WPILibNewCommands.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileName": "WPILibNewCommands.json", 3 | "name": "WPILib-New-Commands", 4 | "version": "2020.0.0", 5 | "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", 6 | "mavenUrls": [], 7 | "jsonUrl": "", 8 | "javaDependencies": [ 9 | { 10 | "groupId": "edu.wpi.first.wpilibNewCommands", 11 | "artifactId": "wpilibNewCommands-java", 12 | "version": "wpilib" 13 | } 14 | ], 15 | "jniDependencies": [], 16 | "cppDependencies": [ 17 | { 18 | "groupId": "edu.wpi.first.wpilibNewCommands", 19 | "artifactId": "wpilibNewCommands-cpp", 20 | "version": "wpilib", 21 | "libName": "wpilibNewCommands", 22 | "headerClassifier": "headers", 23 | "sourcesClassifier": "sources", 24 | "sharedLibrary": true, 25 | "skipInvalidPlatforms": true, 26 | "binaryPlatforms": [ 27 | "linuxathena", 28 | "linuxraspbian", 29 | "linuxaarch64bionic", 30 | "windowsx86-64", 31 | "windowsx86", 32 | "linuxx86-64", 33 | "osxx86-64" 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/vendordeps/WPILibNewCommands.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileName": "WPILibNewCommands.json", 3 | "name": "WPILib-New-Commands", 4 | "version": "2020.0.0", 5 | "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", 6 | "mavenUrls": [], 7 | "jsonUrl": "", 8 | "javaDependencies": [ 9 | { 10 | "groupId": "edu.wpi.first.wpilibNewCommands", 11 | "artifactId": "wpilibNewCommands-java", 12 | "version": "wpilib" 13 | } 14 | ], 15 | "jniDependencies": [], 16 | "cppDependencies": [ 17 | { 18 | "groupId": "edu.wpi.first.wpilibNewCommands", 19 | "artifactId": "wpilibNewCommands-cpp", 20 | "version": "wpilib", 21 | "libName": "wpilibNewCommands", 22 | "headerClassifier": "headers", 23 | "sourcesClassifier": "sources", 24 | "sharedLibrary": true, 25 | "skipInvalidPlatforms": true, 26 | "binaryPlatforms": [ 27 | "linuxathena", 28 | "linuxraspbian", 29 | "linuxaarch64bionic", 30 | "windowsx86-64", 31 | "windowsx86", 32 | "linuxx86-64", 33 | "osxx86-64" 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/src/main/java/frc/robot/commands/TurnLedOn.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import edu.wpi.first.wpilibj2.command.CommandBase; 8 | import frc.robot.subsystems.OnBoardIO; 9 | 10 | public class TurnLedOn extends CommandBase { 11 | private final OnBoardIO m_io; 12 | 13 | /** Creates a new TurnLedOn. */ 14 | public TurnLedOn(OnBoardIO io) { 15 | // Use addRequirements() here to declare subsystem dependencies. 16 | m_io = io; 17 | addRequirements(io); 18 | } 19 | 20 | // Called when the command is initially scheduled. 21 | @Override 22 | public void initialize() {} 23 | 24 | // Called every time the scheduler runs while the command is scheduled. 25 | @Override 26 | public void execute() { 27 | m_io.setGreenLed(true); 28 | } 29 | 30 | // Called once the command ends or is interrupted. 31 | @Override 32 | public void end(boolean interrupted) {} 33 | 34 | // Returns true when the command should end. 35 | @Override 36 | public boolean isFinished() { 37 | return false; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/src/main/java/frc/robot/commands/TurnLedOff.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import edu.wpi.first.wpilibj2.command.CommandBase; 8 | import frc.robot.subsystems.OnBoardIO; 9 | 10 | public class TurnLedOff extends CommandBase { 11 | private final OnBoardIO m_io; 12 | 13 | /** Creates a new TurnLedOff. */ 14 | public TurnLedOff(OnBoardIO io) { 15 | // Use addRequirements() here to declare subsystem dependencies. 16 | m_io = io; 17 | addRequirements(io); 18 | } 19 | // Called when the command is initially scheduled. 20 | @Override 21 | public void initialize() {} 22 | 23 | // Called every time the scheduler runs while the command is scheduled. 24 | @Override 25 | public void execute() { 26 | m_io.setGreenLed(false); 27 | } 28 | 29 | // Called once the command ends or is interrupted. 30 | @Override 31 | public void end(boolean interrupted) {} 32 | 33 | // Returns true when the command should end. 34 | @Override 35 | public boolean isFinished() { 36 | return false; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/src/main/java/frc/robot/Main.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | import edu.wpi.first.wpilibj.RobotBase; 8 | 9 | /** 10 | * Do NOT add any static variables to this class, or any initialization at all. Unless you know what 11 | * you are doing, do not modify this file except to change the parameter class to the startRobot 12 | * call. 13 | */ 14 | public final class Main { 15 | private Main() {} 16 | 17 | /** 18 | * Main initialization function. Do not perform any initialization here. 19 | * 20 | *

If you change your main robot class, change the parameter type. 21 | */ 22 | public static void main(String... args) { 23 | int numberOfWheelsOnRobot = 2; 24 | double robotSpeedInchesPerSecond = 3.1; 25 | 26 | System.out.print("Number of wheels on the robot: "); 27 | System.out.println(numberOfWheelsOnRobot); 28 | 29 | System.out.print("The robot's current speed: "); 30 | System.out.println(robotSpeedInchesPerSecond); 31 | 32 | // The robot has stopped! Update the speed to 0 inches per second. 33 | robotSpeedInchesPerSecond = 0; 34 | 35 | System.out.print("The robot stopped! Now its new speed is: "); 36 | System.out.println(robotSpeedInchesPerSecond); 37 | 38 | RobotBase.startRobot(Robot::new); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Project Code/Lesson 15/SpriteGame/src/Player.java: -------------------------------------------------------------------------------- 1 | public class Player extends Character implements Fightable, Movable { 2 | public Player(String name) { 3 | super(name); 4 | } 5 | 6 | @Override 7 | public void attack() { 8 | System.out.println("Player now attacking."); 9 | } 10 | 11 | @Override 12 | public void takeDamage(int damage) { 13 | // TODO Auto-generated method stub 14 | } 15 | 16 | @Override 17 | public int getMaxHp() { 18 | // TODO Auto-generated method stub 19 | return 0; 20 | } 21 | 22 | @Override 23 | public int getHpRemaining() { 24 | // TODO Auto-generated method stub 25 | return 0; 26 | } 27 | 28 | @Override 29 | public void moveNorth() { 30 | // TODO Auto-generated method stub 31 | 32 | } 33 | 34 | @Override 35 | public void moveEast() { 36 | // TODO Auto-generated method stub 37 | 38 | } 39 | 40 | @Override 41 | public void moveSouth() { 42 | // TODO Auto-generated method stub 43 | 44 | } 45 | 46 | @Override 47 | public void moveWest() { 48 | // TODO Auto-generated method stub 49 | 50 | } 51 | 52 | @Override 53 | public int getXPosition() { 54 | // TODO Auto-generated method stub 55 | return 0; 56 | } 57 | 58 | @Override 59 | public int getYPosition() { 60 | // TODO Auto-generated method stub 61 | return 0; 62 | } 63 | 64 | @Override 65 | public void introduce() { 66 | System.out.println("I am a brave adventurer!"); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Project Code/Lesson 14/SpriteGame/src/Player.java: -------------------------------------------------------------------------------- 1 | public class Player extends Character implements Fightable, Movable { 2 | public Player(String name) { 3 | this.setName(name); 4 | } 5 | 6 | @Override 7 | public void attack() { 8 | System.out.println("Player now attacking."); 9 | } 10 | 11 | @Override 12 | public void takeDamage(int damage) { 13 | // TODO Auto-generated method stub 14 | } 15 | 16 | @Override 17 | public int getMaxHp() { 18 | // TODO Auto-generated method stub 19 | return 0; 20 | } 21 | 22 | @Override 23 | public int getHpRemaining() { 24 | // TODO Auto-generated method stub 25 | return 0; 26 | } 27 | 28 | @Override 29 | public void moveNorth() { 30 | // TODO Auto-generated method stub 31 | 32 | } 33 | 34 | @Override 35 | public void moveEast() { 36 | // TODO Auto-generated method stub 37 | 38 | } 39 | 40 | @Override 41 | public void moveSouth() { 42 | // TODO Auto-generated method stub 43 | 44 | } 45 | 46 | @Override 47 | public void moveWest() { 48 | // TODO Auto-generated method stub 49 | 50 | } 51 | 52 | @Override 53 | public int getXPosition() { 54 | // TODO Auto-generated method stub 55 | return 0; 56 | } 57 | 58 | @Override 59 | public int getYPosition() { 60 | // TODO Auto-generated method stub 61 | return 0; 62 | } 63 | 64 | @Override 65 | public void introduce() { 66 | System.out.println("I am a brave adventurer!"); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/WPILib-License.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2021 FIRST and other WPILib contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of FIRST, WPILib, nor the names of other WPILib 12 | contributors may be used to endorse or promote products derived from 13 | this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR 18 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/WPILib-License.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2021 FIRST and other WPILib contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of FIRST, WPILib, nor the names of other WPILib 12 | contributors may be used to endorse or promote products derived from 13 | this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR 18 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/WPILib-License.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2021 FIRST and other WPILib contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of FIRST, WPILib, nor the names of other WPILib 12 | contributors may be used to endorse or promote products derived from 13 | this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR 18 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/WPILib-License.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2021 FIRST and other WPILib contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of FIRST, WPILib, nor the names of other WPILib 12 | contributors may be used to endorse or promote products derived from 13 | this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR 18 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/WPILib-License.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2021 FIRST and other WPILib contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of FIRST, WPILib, nor the names of other WPILib 12 | contributors may be used to endorse or promote products derived from 13 | this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR 18 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/src/main/java/frc/robot/commands/ToggleLightsBasedOnGyro.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import edu.wpi.first.wpilibj2.command.CommandBase; 8 | import frc.robot.subsystems.OnBoardIO; 9 | 10 | public class ToggleLightsBasedOnGyro extends CommandBase { 11 | OnBoardIO m_io; 12 | 13 | public ToggleLightsBasedOnGyro(OnBoardIO io) { 14 | m_io = io; 15 | addRequirements(io); 16 | } 17 | 18 | // Called when the command is initially scheduled. 19 | @Override 20 | public void initialize() {} 21 | 22 | // Called every time the scheduler runs while the command is scheduled. 23 | @Override 24 | public void execute() { 25 | double gyroAngle = m_io.m_drivetrain.m_gyro.getAngleZ(); 26 | 27 | if (Math.abs(gyroAngle) < 5) { 28 | setLightsGreen(); 29 | } 30 | else { 31 | setLightsRed(); 32 | } 33 | 34 | System.out.println("Gyro angle: " + gyroAngle); 35 | } 36 | 37 | private void setLightsGreen() { 38 | m_io.setGreenLed(true); 39 | m_io.setRedLed(false); 40 | } 41 | 42 | private void setLightsRed() { 43 | m_io.setGreenLed(false); 44 | m_io.setRedLed(true); 45 | } 46 | 47 | // Called once the command ends or is interrupted. 48 | @Override 49 | public void end(boolean interrupted) {} 50 | 51 | // Returns true when the command should end. 52 | @Override 53 | public boolean isFinished() { 54 | return false; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/WPILib-License.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2021 FIRST and other WPILib contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of FIRST, WPILib, nor the names of other WPILib 12 | contributors may be used to endorse or promote products derived from 13 | this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR 18 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/WPILib-License.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2021 FIRST and other WPILib contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of FIRST, WPILib, nor the names of other WPILib 12 | contributors may be used to endorse or promote products derived from 13 | this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR 18 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/WPILib-License.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2021 FIRST and other WPILib contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of FIRST, WPILib, nor the names of other WPILib 12 | contributors may be used to endorse or promote products derived from 13 | this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR 18 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/WPILib-License.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2021 FIRST and other WPILib contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of FIRST, WPILib, nor the names of other WPILib 12 | contributors may be used to endorse or promote products derived from 13 | this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR 18 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Project Code/Lesson 14/SpriteGame/src/SpriteGame.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | 3 | public class SpriteGame { 4 | public static void main(String... args) { 5 | Player player = new Player("Adventurer"); 6 | Enemy goblin = new Enemy("Goblin"); 7 | Enemy orc = new Enemy("Orc"); 8 | NPC shopkeeper = new NPC("Shopkeeper"); 9 | DestructibleObject suspiciousRock = new DestructibleObject(); 10 | 11 | ArrayList characters = new ArrayList(); 12 | ArrayList fighters = new ArrayList(); 13 | 14 | characters.add(player); 15 | characters.add(goblin); 16 | characters.add(orc); 17 | characters.add(shopkeeper); 18 | 19 | fighters.add(player); 20 | fighters.add(goblin); 21 | fighters.add(orc); 22 | fighters.add(suspiciousRock); 23 | 24 | outputCharacterNames(characters); 25 | introduceCharacters(characters); 26 | fightFightables(fighters); 27 | } 28 | 29 | public static void outputCharacterNames(ArrayList characters) { 30 | for (int i = 0; i < characters.size(); i++) { 31 | characters.get(i).printName(); 32 | } 33 | } 34 | 35 | public static void fightFightables(ArrayList fighters) { 36 | for (int i = 0; i < fighters.size(); i++) { 37 | fighters.get(i).attack(); 38 | } 39 | } 40 | 41 | public static void introduceCharacters(ArrayList characters) { 42 | for (int i = 0; i < characters.size(); i++) { 43 | characters.get(i).introduce(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Project Code/Lesson 15/SpriteGame/src/SpriteGame.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | 3 | public class SpriteGame { 4 | public static void main(String... args) { 5 | Player player = new Player("Adventurer"); 6 | Enemy goblin = new Enemy("Goblin"); 7 | Enemy orc = new Enemy("Orc"); 8 | NPC shopkeeper = new NPC("Shopkeeper"); 9 | DestructibleObject suspiciousRock = new DestructibleObject(); 10 | 11 | ArrayList characters = new ArrayList(); 12 | ArrayList fighters = new ArrayList(); 13 | 14 | characters.add(player); 15 | characters.add(goblin); 16 | characters.add(orc); 17 | characters.add(shopkeeper); 18 | 19 | fighters.add(player); 20 | fighters.add(goblin); 21 | fighters.add(orc); 22 | fighters.add(suspiciousRock); 23 | 24 | outputCharacterNames(characters); 25 | introduceCharacters(characters); 26 | fightFightables(fighters); 27 | } 28 | 29 | public static void outputCharacterNames(ArrayList characters) { 30 | for (int i = 0; i < characters.size(); i++) { 31 | characters.get(i).printName(); 32 | } 33 | } 34 | 35 | public static void fightFightables(ArrayList fighters) { 36 | for (int i = 0; i < fighters.size(); i++) { 37 | fighters.get(i).attack(); 38 | } 39 | } 40 | 41 | public static void introduceCharacters(ArrayList characters) { 42 | for (int i = 0; i < characters.size(); i++) { 43 | characters.get(i).introduce(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/src/main/java/frc/robot/commands/ToggleLightsBasedOnGyro.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import edu.wpi.first.wpilibj2.command.CommandBase; 8 | import frc.robot.subsystems.OnBoardIO; 9 | 10 | public class ToggleLightsBasedOnGyro extends CommandBase { 11 | OnBoardIO m_io; 12 | 13 | public ToggleLightsBasedOnGyro(OnBoardIO io) { 14 | m_io = io; 15 | addRequirements(io); 16 | } 17 | 18 | // Called when the command is initially scheduled. 19 | @Override 20 | public void initialize() {} 21 | 22 | // Called every time the scheduler runs while the command is scheduled. 23 | @Override 24 | public void execute() { 25 | double gyroAngle = m_io.getDrivetrain().getGyroAngleZ(); 26 | 27 | if (Math.abs(gyroAngle) < Constants.IS_ORIENTED_STRAIGHT_DEGREE_THRESHOLD) { 28 | setLightsGreen(); 29 | } 30 | else { 31 | setLightsRed(); 32 | } 33 | 34 | System.out.println("Gyro angle: " + gyroAngle); 35 | } 36 | 37 | private void setLightsGreen() { 38 | m_io.setGreenLed(true); 39 | m_io.setRedLed(false); 40 | } 41 | 42 | private void setLightsRed() { 43 | m_io.setGreenLed(false); 44 | m_io.setRedLed(true); 45 | } 46 | 47 | // Called once the command ends or is interrupted. 48 | @Override 49 | public void end(boolean interrupted) {} 50 | 51 | // Returns true when the command should end. 52 | @Override 53 | public boolean isFinished() { 54 | return false; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java" 3 | id "edu.wpi.first.GradleRIO" version "2021.3.1" 4 | } 5 | 6 | sourceCompatibility = JavaVersion.VERSION_11 7 | targetCompatibility = JavaVersion.VERSION_11 8 | 9 | def ROBOT_MAIN_CLASS = "frc.robot.Main" 10 | 11 | // Set this to true to enable desktop support. 12 | def includeDesktopSupport = true 13 | 14 | // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. 15 | // Also defines JUnit 4. 16 | dependencies { 17 | implementation wpi.deps.wpilib() 18 | nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop) 19 | 20 | 21 | implementation wpi.deps.vendor.java() 22 | nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) 23 | 24 | testImplementation 'junit:junit:4.12' 25 | 26 | // Enable simulation gui support. Must check the box in vscode to enable support 27 | // upon debugging 28 | simulation wpi.deps.sim.gui(wpi.platforms.desktop, false) 29 | simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, false) 30 | 31 | // Websocket extensions require additional configuration. 32 | // simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, false) 33 | simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, false) 34 | } 35 | 36 | // Set the websocket remote host (the Romi IP address). 37 | sim { 38 | envVar "HALSIMWS_HOST", "10.0.0.2" 39 | } 40 | 41 | // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') 42 | // in order to make them all available at runtime. Also adding the manifest so WPILib 43 | // knows where to look for our Robot Class. 44 | jar { 45 | from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } 46 | manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) 47 | } 48 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java" 3 | id "edu.wpi.first.GradleRIO" version "2021.3.1" 4 | } 5 | 6 | sourceCompatibility = JavaVersion.VERSION_11 7 | targetCompatibility = JavaVersion.VERSION_11 8 | 9 | def ROBOT_MAIN_CLASS = "frc.robot.Main" 10 | 11 | // Set this to true to enable desktop support. 12 | def includeDesktopSupport = true 13 | 14 | // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. 15 | // Also defines JUnit 4. 16 | dependencies { 17 | implementation wpi.deps.wpilib() 18 | nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop) 19 | 20 | 21 | implementation wpi.deps.vendor.java() 22 | nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) 23 | 24 | testImplementation 'junit:junit:4.12' 25 | 26 | // Enable simulation gui support. Must check the box in vscode to enable support 27 | // upon debugging 28 | simulation wpi.deps.sim.gui(wpi.platforms.desktop, false) 29 | simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, false) 30 | 31 | // Websocket extensions require additional configuration. 32 | // simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, false) 33 | simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, false) 34 | } 35 | 36 | // Set the websocket remote host (the Romi IP address). 37 | sim { 38 | envVar "HALSIMWS_HOST", "10.0.0.2" 39 | } 40 | 41 | // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') 42 | // in order to make them all available at runtime. Also adding the manifest so WPILib 43 | // knows where to look for our Robot Class. 44 | jar { 45 | from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } 46 | manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) 47 | } 48 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java" 3 | id "edu.wpi.first.GradleRIO" version "2021.3.1" 4 | } 5 | 6 | sourceCompatibility = JavaVersion.VERSION_11 7 | targetCompatibility = JavaVersion.VERSION_11 8 | 9 | def ROBOT_MAIN_CLASS = "frc.robot.Main" 10 | 11 | // Set this to true to enable desktop support. 12 | def includeDesktopSupport = true 13 | 14 | // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. 15 | // Also defines JUnit 4. 16 | dependencies { 17 | implementation wpi.deps.wpilib() 18 | nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop) 19 | 20 | 21 | implementation wpi.deps.vendor.java() 22 | nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) 23 | 24 | testImplementation 'junit:junit:4.12' 25 | 26 | // Enable simulation gui support. Must check the box in vscode to enable support 27 | // upon debugging 28 | simulation wpi.deps.sim.gui(wpi.platforms.desktop, false) 29 | simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, false) 30 | 31 | // Websocket extensions require additional configuration. 32 | // simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, false) 33 | simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, false) 34 | } 35 | 36 | // Set the websocket remote host (the Romi IP address). 37 | sim { 38 | envVar "HALSIMWS_HOST", "10.0.0.2" 39 | } 40 | 41 | // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') 42 | // in order to make them all available at runtime. Also adding the manifest so WPILib 43 | // knows where to look for our Robot Class. 44 | jar { 45 | from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } 46 | manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) 47 | } 48 | -------------------------------------------------------------------------------- /Project Code/Lesson 4/MethodsScratch/src/App.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class App { 4 | public static void main(String[] args) throws Exception { 5 | welcome(); 6 | 7 | // Declare a built-in Java Scanner object 8 | Scanner scanner = new Scanner(System.in); 9 | 10 | System.out.println("Enter the first integer:"); 11 | int firstNumber = scanner.nextInt(); 12 | 13 | System.out.println("Enter the second integer:"); 14 | int secondNumber = scanner.nextInt(); 15 | 16 | // Closes the scanner to prevent memory leaks 17 | scanner.close(); 18 | 19 | add(firstNumber, secondNumber); 20 | int product = multiply(firstNumber, secondNumber); 21 | int sum = subtract(firstNumber, secondNumber); 22 | int cube = cube(firstNumber); 23 | 24 | System.out.println("Multiply result: " + product); 25 | System.out.println("Sum result: " + sum); 26 | System.out.println("Cube result: " + cube); 27 | 28 | } 29 | 30 | public static void welcome() { 31 | System.out.println("Welcome to calculator!"); 32 | } 33 | 34 | public static void add(int firstNumber, int secondNumber) { 35 | int result = firstNumber + secondNumber; 36 | 37 | System.out.println("Addition result: " + result); 38 | } 39 | 40 | public static int multiply(int firstNumber, int secondNumber) { 41 | int result = firstNumber * secondNumber; 42 | 43 | return result; 44 | } 45 | 46 | public static int subtract(int firstNumber, int secondNumber) { 47 | int result = firstNumber - secondNumber; 48 | 49 | return result; 50 | } 51 | 52 | public static int cube(int number) { 53 | int result = number * number * number; 54 | 55 | return result; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java" 3 | id "edu.wpi.first.GradleRIO" version "2021.3.1" 4 | } 5 | 6 | sourceCompatibility = JavaVersion.VERSION_11 7 | targetCompatibility = JavaVersion.VERSION_11 8 | 9 | def ROBOT_MAIN_CLASS = "frc.robot.Main" 10 | 11 | // Set this to true to enable desktop support. 12 | def includeDesktopSupport = true 13 | 14 | // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. 15 | // Also defines JUnit 4. 16 | dependencies { 17 | implementation wpi.deps.wpilib() 18 | nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop) 19 | 20 | 21 | implementation wpi.deps.vendor.java() 22 | nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) 23 | 24 | testImplementation 'junit:junit:4.12' 25 | 26 | // Enable simulation gui support. Must check the box in vscode to enable support 27 | // upon debugging 28 | simulation wpi.deps.sim.gui(wpi.platforms.desktop, false) 29 | simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, false) 30 | 31 | // Websocket extensions require additional configuration. 32 | // simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, false) 33 | simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, false) 34 | } 35 | 36 | // Set the websocket remote host (the Romi IP address). 37 | sim { 38 | envVar "HALSIMWS_HOST", "10.0.0.2" 39 | } 40 | 41 | // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') 42 | // in order to make them all available at runtime. Also adding the manifest so WPILib 43 | // knows where to look for our Robot Class. 44 | jar { 45 | from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } 46 | manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) 47 | } 48 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java" 3 | id "edu.wpi.first.GradleRIO" version "2021.3.1" 4 | } 5 | 6 | sourceCompatibility = JavaVersion.VERSION_11 7 | targetCompatibility = JavaVersion.VERSION_11 8 | 9 | def ROBOT_MAIN_CLASS = "frc.robot.Main" 10 | 11 | // Set this to true to enable desktop support. 12 | def includeDesktopSupport = true 13 | 14 | // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. 15 | // Also defines JUnit 4. 16 | dependencies { 17 | implementation wpi.deps.wpilib() 18 | nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop) 19 | 20 | 21 | implementation wpi.deps.vendor.java() 22 | nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) 23 | 24 | testImplementation 'junit:junit:4.12' 25 | 26 | // Enable simulation gui support. Must check the box in vscode to enable support 27 | // upon debugging 28 | simulation wpi.deps.sim.gui(wpi.platforms.desktop, false) 29 | simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, false) 30 | 31 | // Websocket extensions require additional configuration. 32 | // simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, false) 33 | simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, false) 34 | } 35 | 36 | // Set the websocket remote host (the Romi IP address). 37 | sim { 38 | envVar "HALSIMWS_HOST", "10.0.0.2" 39 | } 40 | 41 | // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') 42 | // in order to make them all available at runtime. Also adding the manifest so WPILib 43 | // knows where to look for our Robot Class. 44 | jar { 45 | from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } 46 | manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) 47 | } 48 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java" 3 | id "edu.wpi.first.GradleRIO" version "2021.3.1" 4 | } 5 | 6 | sourceCompatibility = JavaVersion.VERSION_11 7 | targetCompatibility = JavaVersion.VERSION_11 8 | 9 | def ROBOT_MAIN_CLASS = "frc.robot.Main" 10 | 11 | // Set this to true to enable desktop support. 12 | def includeDesktopSupport = true 13 | 14 | // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. 15 | // Also defines JUnit 4. 16 | dependencies { 17 | implementation wpi.deps.wpilib() 18 | nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop) 19 | 20 | 21 | implementation wpi.deps.vendor.java() 22 | nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) 23 | 24 | testImplementation 'junit:junit:4.12' 25 | 26 | // Enable simulation gui support. Must check the box in vscode to enable support 27 | // upon debugging 28 | simulation wpi.deps.sim.gui(wpi.platforms.desktop, false) 29 | simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, false) 30 | 31 | // Websocket extensions require additional configuration. 32 | // simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, false) 33 | simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, false) 34 | } 35 | 36 | // Set the websocket remote host (the Romi IP address). 37 | sim { 38 | envVar "HALSIMWS_HOST", "10.0.0.2" 39 | } 40 | 41 | // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') 42 | // in order to make them all available at runtime. Also adding the manifest so WPILib 43 | // knows where to look for our Robot Class. 44 | jar { 45 | from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } 46 | manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) 47 | } 48 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java" 3 | id "edu.wpi.first.GradleRIO" version "2021.3.1" 4 | } 5 | 6 | sourceCompatibility = JavaVersion.VERSION_11 7 | targetCompatibility = JavaVersion.VERSION_11 8 | 9 | def ROBOT_MAIN_CLASS = "frc.robot.Main" 10 | 11 | // Set this to true to enable desktop support. 12 | def includeDesktopSupport = true 13 | 14 | // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. 15 | // Also defines JUnit 4. 16 | dependencies { 17 | implementation wpi.deps.wpilib() 18 | nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop) 19 | 20 | 21 | implementation wpi.deps.vendor.java() 22 | nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) 23 | 24 | testImplementation 'junit:junit:4.12' 25 | 26 | // Enable simulation gui support. Must check the box in vscode to enable support 27 | // upon debugging 28 | simulation wpi.deps.sim.gui(wpi.platforms.desktop, false) 29 | simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, false) 30 | 31 | // Websocket extensions require additional configuration. 32 | // simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, false) 33 | simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, false) 34 | } 35 | 36 | // Set the websocket remote host (the Romi IP address). 37 | sim { 38 | envVar "HALSIMWS_HOST", "10.0.0.2" 39 | } 40 | 41 | // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') 42 | // in order to make them all available at runtime. Also adding the manifest so WPILib 43 | // knows where to look for our Robot Class. 44 | jar { 45 | from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } 46 | manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) 47 | } 48 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java" 3 | id "edu.wpi.first.GradleRIO" version "2021.3.1" 4 | } 5 | 6 | sourceCompatibility = JavaVersion.VERSION_11 7 | targetCompatibility = JavaVersion.VERSION_11 8 | 9 | def ROBOT_MAIN_CLASS = "frc.robot.Main" 10 | 11 | // Set this to true to enable desktop support. 12 | def includeDesktopSupport = true 13 | 14 | // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. 15 | // Also defines JUnit 4. 16 | dependencies { 17 | implementation wpi.deps.wpilib() 18 | nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop) 19 | 20 | 21 | implementation wpi.deps.vendor.java() 22 | nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) 23 | 24 | testImplementation 'junit:junit:4.12' 25 | 26 | // Enable simulation gui support. Must check the box in vscode to enable support 27 | // upon debugging 28 | simulation wpi.deps.sim.gui(wpi.platforms.desktop, false) 29 | simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, false) 30 | 31 | // Websocket extensions require additional configuration. 32 | // simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, false) 33 | simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, false) 34 | } 35 | 36 | // Set the websocket remote host (the Romi IP address). 37 | sim { 38 | envVar "HALSIMWS_HOST", "10.0.0.2" 39 | } 40 | 41 | // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') 42 | // in order to make them all available at runtime. Also adding the manifest so WPILib 43 | // knows where to look for our Robot Class. 44 | jar { 45 | from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } 46 | manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) 47 | } 48 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java" 3 | id "edu.wpi.first.GradleRIO" version "2021.3.1" 4 | } 5 | 6 | sourceCompatibility = JavaVersion.VERSION_11 7 | targetCompatibility = JavaVersion.VERSION_11 8 | 9 | def ROBOT_MAIN_CLASS = "frc.robot.Main" 10 | 11 | // Set this to true to enable desktop support. 12 | def includeDesktopSupport = true 13 | 14 | // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. 15 | // Also defines JUnit 4. 16 | dependencies { 17 | implementation wpi.deps.wpilib() 18 | nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop) 19 | 20 | 21 | implementation wpi.deps.vendor.java() 22 | nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) 23 | 24 | testImplementation 'junit:junit:4.12' 25 | 26 | // Enable simulation gui support. Must check the box in vscode to enable support 27 | // upon debugging 28 | simulation wpi.deps.sim.gui(wpi.platforms.desktop, false) 29 | simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, false) 30 | 31 | // Websocket extensions require additional configuration. 32 | // simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, false) 33 | simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, false) 34 | } 35 | 36 | // Set the websocket remote host (the Romi IP address). 37 | sim { 38 | envVar "HALSIMWS_HOST", "10.0.0.2" 39 | } 40 | 41 | // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') 42 | // in order to make them all available at runtime. Also adding the manifest so WPILib 43 | // knows where to look for our Robot Class. 44 | jar { 45 | from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } 46 | manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) 47 | } 48 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/src/main/java/frc/robot/commands/DriveTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveTime extends CommandBase { 11 | private final double m_duration; 12 | private final double m_speed; 13 | private final Drivetrain m_drive; 14 | private long m_startTime; 15 | 16 | /** 17 | * Creates a new DriveTime. This command will drive your robot for a desired speed and time. 18 | * 19 | * @param speed The speed which the robot will drive. Negative is in reverse. 20 | * @param time How much time to drive in seconds 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveTime(double speed, double time, Drivetrain drive) { 24 | m_speed = speed; 25 | m_duration = time * 1000; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_startTime = System.currentTimeMillis(); 34 | m_drive.arcadeDrive(0, 0); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/src/main/java/frc/robot/commands/DriveTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveTime extends CommandBase { 11 | private final double m_duration; 12 | private final double m_speed; 13 | private final Drivetrain m_drive; 14 | private long m_startTime; 15 | 16 | /** 17 | * Creates a new DriveTime. This command will drive your robot for a desired speed and time. 18 | * 19 | * @param speed The speed which the robot will drive. Negative is in reverse. 20 | * @param time How much time to drive in seconds 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveTime(double speed, double time, Drivetrain drive) { 24 | m_speed = speed; 25 | m_duration = time * 1000; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_startTime = System.currentTimeMillis(); 34 | m_drive.arcadeDrive(0, 0); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/src/main/java/frc/robot/commands/DriveTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveTime extends CommandBase { 11 | private final double m_duration; 12 | private final double m_speed; 13 | private final Drivetrain m_drive; 14 | private long m_startTime; 15 | 16 | /** 17 | * Creates a new DriveTime. This command will drive your robot for a desired speed and time. 18 | * 19 | * @param speed The speed which the robot will drive. Negative is in reverse. 20 | * @param time How much time to drive in seconds 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveTime(double speed, double time, Drivetrain drive) { 24 | m_speed = speed; 25 | m_duration = time * 1000; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_startTime = System.currentTimeMillis(); 34 | m_drive.arcadeDrive(0, 0); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/src/main/java/frc/robot/commands/DriveTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveTime extends CommandBase { 11 | private final double m_duration; 12 | private final double m_speed; 13 | private final Drivetrain m_drive; 14 | private long m_startTime; 15 | 16 | /** 17 | * Creates a new DriveTime. This command will drive your robot for a desired speed and time. 18 | * 19 | * @param speed The speed which the robot will drive. Negative is in reverse. 20 | * @param time How much time to drive in seconds 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveTime(double speed, double time, Drivetrain drive) { 24 | m_speed = speed; 25 | m_duration = time * 1000; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_startTime = System.currentTimeMillis(); 34 | m_drive.arcadeDrive(0, 0); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/src/main/java/frc/robot/commands/DriveTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveTime extends CommandBase { 11 | private final double m_duration; 12 | private final double m_speed; 13 | private final Drivetrain m_drive; 14 | private long m_startTime; 15 | 16 | /** 17 | * Creates a new DriveTime. This command will drive your robot for a desired speed and time. 18 | * 19 | * @param speed The speed which the robot will drive. Negative is in reverse. 20 | * @param time How much time to drive in seconds 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveTime(double speed, double time, Drivetrain drive) { 24 | m_speed = speed; 25 | m_duration = time * 1000; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_startTime = System.currentTimeMillis(); 34 | m_drive.arcadeDrive(0, 0); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/src/main/java/frc/robot/commands/DriveTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveTime extends CommandBase { 11 | private final double m_duration; 12 | private final double m_speed; 13 | private final Drivetrain m_drive; 14 | private long m_startTime; 15 | 16 | /** 17 | * Creates a new DriveTime. This command will drive your robot for a desired speed and time. 18 | * 19 | * @param speed The speed which the robot will drive. Negative is in reverse. 20 | * @param time How much time to drive in seconds 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveTime(double speed, double time, Drivetrain drive) { 24 | m_speed = speed; 25 | m_duration = time * 1000; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_startTime = System.currentTimeMillis(); 34 | m_drive.arcadeDrive(0, 0); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/src/main/java/frc/robot/commands/DriveTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveTime extends CommandBase { 11 | private final double m_duration; 12 | private final double m_speed; 13 | private final Drivetrain m_drive; 14 | private long m_startTime; 15 | 16 | /** 17 | * Creates a new DriveTime. This command will drive your robot for a desired speed and time. 18 | * 19 | * @param speed The speed which the robot will drive. Negative is in reverse. 20 | * @param time How much time to drive in seconds 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveTime(double speed, double time, Drivetrain drive) { 24 | m_speed = speed; 25 | m_duration = time * 1000; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_startTime = System.currentTimeMillis(); 34 | m_drive.arcadeDrive(0, 0); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/src/main/java/frc/robot/commands/DriveTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveTime extends CommandBase { 11 | private final double m_duration; 12 | private final double m_speed; 13 | private final Drivetrain m_drive; 14 | private long m_startTime; 15 | 16 | /** 17 | * Creates a new DriveTime. This command will drive your robot for a desired speed and time. 18 | * 19 | * @param speed The speed which the robot will drive. Negative is in reverse. 20 | * @param time How much time to drive in seconds 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveTime(double speed, double time, Drivetrain drive) { 24 | m_speed = speed; 25 | m_duration = time * 1000; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_startTime = System.currentTimeMillis(); 34 | m_drive.arcadeDrive(0, 0); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/src/main/java/frc/robot/commands/DriveTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveTime extends CommandBase { 11 | private final double m_duration; 12 | private final double m_speed; 13 | private final Drivetrain m_drive; 14 | private long m_startTime; 15 | 16 | /** 17 | * Creates a new DriveTime. This command will drive your robot for a desired speed and time. 18 | * 19 | * @param speed The speed which the robot will drive. Negative is in reverse. 20 | * @param time How much time to drive in seconds 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveTime(double speed, double time, Drivetrain drive) { 24 | m_speed = speed; 25 | m_duration = time * 1000; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_startTime = System.currentTimeMillis(); 34 | m_drive.arcadeDrive(0, 0); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/src/main/java/frc/robot/commands/DriveDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveDistance extends CommandBase { 11 | private final Drivetrain m_drive; 12 | private final double m_distance; 13 | private final double m_speed; 14 | 15 | /** 16 | * Creates a new DriveDistance. This command will drive your your robot for a desired distance at 17 | * a desired speed. 18 | * 19 | * @param speed The speed at which the robot will drive 20 | * @param inches The number of inches the robot will drive 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveDistance(double speed, double inches, Drivetrain drive) { 24 | m_distance = inches; 25 | m_speed = speed; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_drive.arcadeDrive(0, 0); 34 | m_drive.resetEncoders(); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | // Compare distance travelled from start to desired distance 53 | return Math.abs(m_drive.getAverageDistanceInch()) >= m_distance; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/src/main/java/frc/robot/commands/DriveDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveDistance extends CommandBase { 11 | private final Drivetrain m_drive; 12 | private final double m_distance; 13 | private final double m_speed; 14 | 15 | /** 16 | * Creates a new DriveDistance. This command will drive your your robot for a desired distance at 17 | * a desired speed. 18 | * 19 | * @param speed The speed at which the robot will drive 20 | * @param inches The number of inches the robot will drive 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveDistance(double speed, double inches, Drivetrain drive) { 24 | m_distance = inches; 25 | m_speed = speed; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_drive.arcadeDrive(0, 0); 34 | m_drive.resetEncoders(); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | // Compare distance travelled from start to desired distance 53 | return Math.abs(m_drive.getAverageDistanceInch()) >= m_distance; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/src/main/java/frc/robot/commands/DriveDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveDistance extends CommandBase { 11 | private final Drivetrain m_drive; 12 | private final double m_distance; 13 | private final double m_speed; 14 | 15 | /** 16 | * Creates a new DriveDistance. This command will drive your your robot for a desired distance at 17 | * a desired speed. 18 | * 19 | * @param speed The speed at which the robot will drive 20 | * @param inches The number of inches the robot will drive 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveDistance(double speed, double inches, Drivetrain drive) { 24 | m_distance = inches; 25 | m_speed = speed; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_drive.arcadeDrive(0, 0); 34 | m_drive.resetEncoders(); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | // Compare distance travelled from start to desired distance 53 | return Math.abs(m_drive.getAverageDistanceInch()) >= m_distance; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/src/main/java/frc/robot/commands/DriveDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveDistance extends CommandBase { 11 | private final Drivetrain m_drive; 12 | private final double m_distance; 13 | private final double m_speed; 14 | 15 | /** 16 | * Creates a new DriveDistance. This command will drive your your robot for a desired distance at 17 | * a desired speed. 18 | * 19 | * @param speed The speed at which the robot will drive 20 | * @param inches The number of inches the robot will drive 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveDistance(double speed, double inches, Drivetrain drive) { 24 | m_distance = inches; 25 | m_speed = speed; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_drive.arcadeDrive(0, 0); 34 | m_drive.resetEncoders(); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | // Compare distance travelled from start to desired distance 53 | return Math.abs(m_drive.getAverageDistanceInch()) >= m_distance; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/src/main/java/frc/robot/commands/DriveDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveDistance extends CommandBase { 11 | private final Drivetrain m_drive; 12 | private final double m_distance; 13 | private final double m_speed; 14 | 15 | /** 16 | * Creates a new DriveDistance. This command will drive your your robot for a desired distance at 17 | * a desired speed. 18 | * 19 | * @param speed The speed at which the robot will drive 20 | * @param inches The number of inches the robot will drive 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveDistance(double speed, double inches, Drivetrain drive) { 24 | m_distance = inches; 25 | m_speed = speed; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_drive.arcadeDrive(0, 0); 34 | m_drive.resetEncoders(); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | // Compare distance travelled from start to desired distance 53 | return Math.abs(m_drive.getAverageDistanceInch()) >= m_distance; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/src/main/java/frc/robot/commands/DriveDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveDistance extends CommandBase { 11 | private final Drivetrain m_drive; 12 | private final double m_distance; 13 | private final double m_speed; 14 | 15 | /** 16 | * Creates a new DriveDistance. This command will drive your your robot for a desired distance at 17 | * a desired speed. 18 | * 19 | * @param speed The speed at which the robot will drive 20 | * @param inches The number of inches the robot will drive 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveDistance(double speed, double inches, Drivetrain drive) { 24 | m_distance = inches; 25 | m_speed = speed; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_drive.arcadeDrive(0, 0); 34 | m_drive.resetEncoders(); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | // Compare distance travelled from start to desired distance 53 | return Math.abs(m_drive.getAverageDistanceInch()) >= m_distance; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/src/main/java/frc/robot/commands/DriveDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveDistance extends CommandBase { 11 | private final Drivetrain m_drive; 12 | private final double m_distance; 13 | private final double m_speed; 14 | 15 | /** 16 | * Creates a new DriveDistance. This command will drive your your robot for a desired distance at 17 | * a desired speed. 18 | * 19 | * @param speed The speed at which the robot will drive 20 | * @param inches The number of inches the robot will drive 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveDistance(double speed, double inches, Drivetrain drive) { 24 | m_distance = inches; 25 | m_speed = speed; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_drive.arcadeDrive(0, 0); 34 | m_drive.resetEncoders(); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | // Compare distance travelled from start to desired distance 53 | return Math.abs(m_drive.getAverageDistanceInch()) >= m_distance; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/src/main/java/frc/robot/commands/DriveDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveDistance extends CommandBase { 11 | private final Drivetrain m_drive; 12 | private final double m_distance; 13 | private final double m_speed; 14 | 15 | /** 16 | * Creates a new DriveDistance. This command will drive your your robot for a desired distance at 17 | * a desired speed. 18 | * 19 | * @param speed The speed at which the robot will drive 20 | * @param inches The number of inches the robot will drive 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveDistance(double speed, double inches, Drivetrain drive) { 24 | m_distance = inches; 25 | m_speed = speed; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_drive.arcadeDrive(0, 0); 34 | m_drive.resetEncoders(); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | // Compare distance travelled from start to desired distance 53 | return Math.abs(m_drive.getAverageDistanceInch()) >= m_distance; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/src/main/java/frc/robot/commands/DriveDistance.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | public class DriveDistance extends CommandBase { 11 | private final Drivetrain m_drive; 12 | private final double m_distance; 13 | private final double m_speed; 14 | 15 | /** 16 | * Creates a new DriveDistance. This command will drive your your robot for a desired distance at 17 | * a desired speed. 18 | * 19 | * @param speed The speed at which the robot will drive 20 | * @param inches The number of inches the robot will drive 21 | * @param drive The drivetrain subsystem on which this command will run 22 | */ 23 | public DriveDistance(double speed, double inches, Drivetrain drive) { 24 | m_distance = inches; 25 | m_speed = speed; 26 | m_drive = drive; 27 | addRequirements(drive); 28 | } 29 | 30 | // Called when the command is initially scheduled. 31 | @Override 32 | public void initialize() { 33 | m_drive.arcadeDrive(0, 0); 34 | m_drive.resetEncoders(); 35 | } 36 | 37 | // Called every time the scheduler runs while the command is scheduled. 38 | @Override 39 | public void execute() { 40 | m_drive.arcadeDrive(m_speed, 0); 41 | } 42 | 43 | // Called once the command ends or is interrupted. 44 | @Override 45 | public void end(boolean interrupted) { 46 | m_drive.arcadeDrive(0, 0); 47 | } 48 | 49 | // Returns true when the command should end. 50 | @Override 51 | public boolean isFinished() { 52 | // Compare distance travelled from start to desired distance 53 | return Math.abs(m_drive.getAverageDistanceInch()) >= m_distance; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/src/main/java/frc/robot/commands/TurnTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | /* 11 | * Creates a new TurnTime command. This command will turn your robot for a 12 | * desired rotational speed and time. 13 | */ 14 | public class TurnTime extends CommandBase { 15 | private final double m_duration; 16 | private final double m_rotationalSpeed; 17 | private final Drivetrain m_drive; 18 | private long m_startTime; 19 | 20 | /** 21 | * Creates a new TurnTime. 22 | * 23 | * @param speed The speed which the robot will turn. Negative is in reverse. 24 | * @param time How much time to turn in seconds 25 | * @param drive The drive subsystem on which this command will run 26 | */ 27 | public TurnTime(double speed, double time, Drivetrain drive) { 28 | m_rotationalSpeed = speed; 29 | m_duration = time * 1000; 30 | m_drive = drive; 31 | addRequirements(drive); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() { 37 | m_startTime = System.currentTimeMillis(); 38 | m_drive.arcadeDrive(0, 0); 39 | } 40 | 41 | // Called every time the scheduler runs while the command is scheduled. 42 | @Override 43 | public void execute() { 44 | m_drive.arcadeDrive(0, m_rotationalSpeed); 45 | } 46 | 47 | // Called once the command ends or is interrupted. 48 | @Override 49 | public void end(boolean interrupted) { 50 | m_drive.arcadeDrive(0, 0); 51 | } 52 | 53 | // Returns true when the command should end. 54 | @Override 55 | public boolean isFinished() { 56 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/src/main/java/frc/robot/commands/TurnTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | /* 11 | * Creates a new TurnTime command. This command will turn your robot for a 12 | * desired rotational speed and time. 13 | */ 14 | public class TurnTime extends CommandBase { 15 | private final double m_duration; 16 | private final double m_rotationalSpeed; 17 | private final Drivetrain m_drive; 18 | private long m_startTime; 19 | 20 | /** 21 | * Creates a new TurnTime. 22 | * 23 | * @param speed The speed which the robot will turn. Negative is in reverse. 24 | * @param time How much time to turn in seconds 25 | * @param drive The drive subsystem on which this command will run 26 | */ 27 | public TurnTime(double speed, double time, Drivetrain drive) { 28 | m_rotationalSpeed = speed; 29 | m_duration = time * 1000; 30 | m_drive = drive; 31 | addRequirements(drive); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() { 37 | m_startTime = System.currentTimeMillis(); 38 | m_drive.arcadeDrive(0, 0); 39 | } 40 | 41 | // Called every time the scheduler runs while the command is scheduled. 42 | @Override 43 | public void execute() { 44 | m_drive.arcadeDrive(0, m_rotationalSpeed); 45 | } 46 | 47 | // Called once the command ends or is interrupted. 48 | @Override 49 | public void end(boolean interrupted) { 50 | m_drive.arcadeDrive(0, 0); 51 | } 52 | 53 | // Returns true when the command should end. 54 | @Override 55 | public boolean isFinished() { 56 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Project Code/Lesson 1/ExampleProject/src/main/java/frc/robot/commands/TurnTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | /* 11 | * Creates a new TurnTime command. This command will turn your robot for a 12 | * desired rotational speed and time. 13 | */ 14 | public class TurnTime extends CommandBase { 15 | private final double m_duration; 16 | private final double m_rotationalSpeed; 17 | private final Drivetrain m_drive; 18 | private long m_startTime; 19 | 20 | /** 21 | * Creates a new TurnTime. 22 | * 23 | * @param speed The speed which the robot will turn. Negative is in reverse. 24 | * @param time How much time to turn in seconds 25 | * @param drive The drive subsystem on which this command will run 26 | */ 27 | public TurnTime(double speed, double time, Drivetrain drive) { 28 | m_rotationalSpeed = speed; 29 | m_duration = time * 1000; 30 | m_drive = drive; 31 | addRequirements(drive); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() { 37 | m_startTime = System.currentTimeMillis(); 38 | m_drive.arcadeDrive(0, 0); 39 | } 40 | 41 | // Called every time the scheduler runs while the command is scheduled. 42 | @Override 43 | public void execute() { 44 | m_drive.arcadeDrive(0, m_rotationalSpeed); 45 | } 46 | 47 | // Called once the command ends or is interrupted. 48 | @Override 49 | public void end(boolean interrupted) { 50 | m_drive.arcadeDrive(0, 0); 51 | } 52 | 53 | // Returns true when the command should end. 54 | @Override 55 | public boolean isFinished() { 56 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/src/main/java/frc/robot/commands/TurnTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | /* 11 | * Creates a new TurnTime command. This command will turn your robot for a 12 | * desired rotational speed and time. 13 | */ 14 | public class TurnTime extends CommandBase { 15 | private final double m_duration; 16 | private final double m_rotationalSpeed; 17 | private final Drivetrain m_drive; 18 | private long m_startTime; 19 | 20 | /** 21 | * Creates a new TurnTime. 22 | * 23 | * @param speed The speed which the robot will turn. Negative is in reverse. 24 | * @param time How much time to turn in seconds 25 | * @param drive The drive subsystem on which this command will run 26 | */ 27 | public TurnTime(double speed, double time, Drivetrain drive) { 28 | m_rotationalSpeed = speed; 29 | m_duration = time * 1000; 30 | m_drive = drive; 31 | addRequirements(drive); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() { 37 | m_startTime = System.currentTimeMillis(); 38 | m_drive.arcadeDrive(0, 0); 39 | } 40 | 41 | // Called every time the scheduler runs while the command is scheduled. 42 | @Override 43 | public void execute() { 44 | m_drive.arcadeDrive(0, m_rotationalSpeed); 45 | } 46 | 47 | // Called once the command ends or is interrupted. 48 | @Override 49 | public void end(boolean interrupted) { 50 | m_drive.arcadeDrive(0, 0); 51 | } 52 | 53 | // Returns true when the command should end. 54 | @Override 55 | public boolean isFinished() { 56 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Project Code/Lesson 11/DriveStraight/src/main/java/frc/robot/commands/TurnTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | /* 11 | * Creates a new TurnTime command. This command will turn your robot for a 12 | * desired rotational speed and time. 13 | */ 14 | public class TurnTime extends CommandBase { 15 | private final double m_duration; 16 | private final double m_rotationalSpeed; 17 | private final Drivetrain m_drive; 18 | private long m_startTime; 19 | 20 | /** 21 | * Creates a new TurnTime. 22 | * 23 | * @param speed The speed which the robot will turn. Negative is in reverse. 24 | * @param time How much time to turn in seconds 25 | * @param drive The drive subsystem on which this command will run 26 | */ 27 | public TurnTime(double speed, double time, Drivetrain drive) { 28 | m_rotationalSpeed = speed; 29 | m_duration = time * 1000; 30 | m_drive = drive; 31 | addRequirements(drive); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() { 37 | m_startTime = System.currentTimeMillis(); 38 | m_drive.arcadeDrive(0, 0); 39 | } 40 | 41 | // Called every time the scheduler runs while the command is scheduled. 42 | @Override 43 | public void execute() { 44 | m_drive.arcadeDrive(0, m_rotationalSpeed); 45 | } 46 | 47 | // Called once the command ends or is interrupted. 48 | @Override 49 | public void end(boolean interrupted) { 50 | m_drive.arcadeDrive(0, 0); 51 | } 52 | 53 | // Returns true when the command should end. 54 | @Override 55 | public boolean isFinished() { 56 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/src/main/java/frc/robot/commands/TurnTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | /* 11 | * Creates a new TurnTime command. This command will turn your robot for a 12 | * desired rotational speed and time. 13 | */ 14 | public class TurnTime extends CommandBase { 15 | private final double m_duration; 16 | private final double m_rotationalSpeed; 17 | private final Drivetrain m_drive; 18 | private long m_startTime; 19 | 20 | /** 21 | * Creates a new TurnTime. 22 | * 23 | * @param speed The speed which the robot will turn. Negative is in reverse. 24 | * @param time How much time to turn in seconds 25 | * @param drive The drive subsystem on which this command will run 26 | */ 27 | public TurnTime(double speed, double time, Drivetrain drive) { 28 | m_rotationalSpeed = speed; 29 | m_duration = time * 1000; 30 | m_drive = drive; 31 | addRequirements(drive); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() { 37 | m_startTime = System.currentTimeMillis(); 38 | m_drive.arcadeDrive(0, 0); 39 | } 40 | 41 | // Called every time the scheduler runs while the command is scheduled. 42 | @Override 43 | public void execute() { 44 | m_drive.arcadeDrive(0, m_rotationalSpeed); 45 | } 46 | 47 | // Called once the command ends or is interrupted. 48 | @Override 49 | public void end(boolean interrupted) { 50 | m_drive.arcadeDrive(0, 0); 51 | } 52 | 53 | // Returns true when the command should end. 54 | @Override 55 | public boolean isFinished() { 56 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/src/main/java/frc/robot/commands/TurnTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | /* 11 | * Creates a new TurnTime command. This command will turn your robot for a 12 | * desired rotational speed and time. 13 | */ 14 | public class TurnTime extends CommandBase { 15 | private final double m_duration; 16 | private final double m_rotationalSpeed; 17 | private final Drivetrain m_drive; 18 | private long m_startTime; 19 | 20 | /** 21 | * Creates a new TurnTime. 22 | * 23 | * @param speed The speed which the robot will turn. Negative is in reverse. 24 | * @param time How much time to turn in seconds 25 | * @param drive The drive subsystem on which this command will run 26 | */ 27 | public TurnTime(double speed, double time, Drivetrain drive) { 28 | m_rotationalSpeed = speed; 29 | m_duration = time * 1000; 30 | m_drive = drive; 31 | addRequirements(drive); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() { 37 | m_startTime = System.currentTimeMillis(); 38 | m_drive.arcadeDrive(0, 0); 39 | } 40 | 41 | // Called every time the scheduler runs while the command is scheduled. 42 | @Override 43 | public void execute() { 44 | m_drive.arcadeDrive(0, m_rotationalSpeed); 45 | } 46 | 47 | // Called once the command ends or is interrupted. 48 | @Override 49 | public void end(boolean interrupted) { 50 | m_drive.arcadeDrive(0, 0); 51 | } 52 | 53 | // Returns true when the command should end. 54 | @Override 55 | public boolean isFinished() { 56 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/src/main/java/frc/robot/commands/TurnTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | /* 11 | * Creates a new TurnTime command. This command will turn your robot for a 12 | * desired rotational speed and time. 13 | */ 14 | public class TurnTime extends CommandBase { 15 | private final double m_duration; 16 | private final double m_rotationalSpeed; 17 | private final Drivetrain m_drive; 18 | private long m_startTime; 19 | 20 | /** 21 | * Creates a new TurnTime. 22 | * 23 | * @param speed The speed which the robot will turn. Negative is in reverse. 24 | * @param time How much time to turn in seconds 25 | * @param drive The drive subsystem on which this command will run 26 | */ 27 | public TurnTime(double speed, double time, Drivetrain drive) { 28 | m_rotationalSpeed = speed; 29 | m_duration = time * 1000; 30 | m_drive = drive; 31 | addRequirements(drive); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() { 37 | m_startTime = System.currentTimeMillis(); 38 | m_drive.arcadeDrive(0, 0); 39 | } 40 | 41 | // Called every time the scheduler runs while the command is scheduled. 42 | @Override 43 | public void execute() { 44 | m_drive.arcadeDrive(0, m_rotationalSpeed); 45 | } 46 | 47 | // Called once the command ends or is interrupted. 48 | @Override 49 | public void end(boolean interrupted) { 50 | m_drive.arcadeDrive(0, 0); 51 | } 52 | 53 | // Returns true when the command should end. 54 | @Override 55 | public boolean isFinished() { 56 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Project Code/Lesson 9/DriveStraight/src/main/java/frc/robot/commands/TurnTime.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | /* 11 | * Creates a new TurnTime command. This command will turn your robot for a 12 | * desired rotational speed and time. 13 | */ 14 | public class TurnTime extends CommandBase { 15 | private final double m_duration; 16 | private final double m_rotationalSpeed; 17 | private final Drivetrain m_drive; 18 | private long m_startTime; 19 | 20 | /** 21 | * Creates a new TurnTime. 22 | * 23 | * @param speed The speed which the robot will turn. Negative is in reverse. 24 | * @param time How much time to turn in seconds 25 | * @param drive The drive subsystem on which this command will run 26 | */ 27 | public TurnTime(double speed, double time, Drivetrain drive) { 28 | m_rotationalSpeed = speed; 29 | m_duration = time * 1000; 30 | m_drive = drive; 31 | addRequirements(drive); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() { 37 | m_startTime = System.currentTimeMillis(); 38 | m_drive.arcadeDrive(0, 0); 39 | } 40 | 41 | // Called every time the scheduler runs while the command is scheduled. 42 | @Override 43 | public void execute() { 44 | m_drive.arcadeDrive(0, m_rotationalSpeed); 45 | } 46 | 47 | // Called once the command ends or is interrupted. 48 | @Override 49 | public void end(boolean interrupted) { 50 | m_drive.arcadeDrive(0, 0); 51 | } 52 | 53 | // Returns true when the command should end. 54 | @Override 55 | public boolean isFinished() { 56 | return (System.currentTimeMillis() - m_startTime) >= m_duration; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Project Code/Lesson 2/Lesson2/src/main/java/frc/robot/commands/ArcadeDrive.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | import java.util.function.Supplier; 10 | 11 | public class ArcadeDrive extends CommandBase { 12 | private final Drivetrain m_drivetrain; 13 | private final Supplier m_xaxisSpeedSupplier; 14 | private final Supplier m_zaxisRotateSupplier; 15 | 16 | /** 17 | * Creates a new ArcadeDrive. This command will drive your robot according to the speed supplier 18 | * lambdas. This command does not terminate. 19 | * 20 | * @param drivetrain The drivetrain subsystem on which this command will run 21 | * @param xaxisSpeedSupplier Lambda supplier of forward/backward speed 22 | * @param zaxisRotateSupplier Lambda supplier of rotational speed 23 | */ 24 | public ArcadeDrive( 25 | Drivetrain drivetrain, 26 | Supplier xaxisSpeedSupplier, 27 | Supplier zaxisRotateSupplier) { 28 | m_drivetrain = drivetrain; 29 | m_xaxisSpeedSupplier = xaxisSpeedSupplier; 30 | m_zaxisRotateSupplier = zaxisRotateSupplier; 31 | addRequirements(drivetrain); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() {} 37 | 38 | // Called every time the scheduler runs while the command is scheduled. 39 | @Override 40 | public void execute() { 41 | m_drivetrain.arcadeDrive(m_xaxisSpeedSupplier.get(), m_zaxisRotateSupplier.get()); 42 | } 43 | 44 | // Called once the command ends or is interrupted. 45 | @Override 46 | public void end(boolean interrupted) {} 47 | 48 | // Returns true when the command should end. 49 | @Override 50 | public boolean isFinished() { 51 | return false; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Project Code/Lesson 3/Lesson3/src/main/java/frc/robot/commands/ArcadeDrive.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | import java.util.function.Supplier; 10 | 11 | public class ArcadeDrive extends CommandBase { 12 | private final Drivetrain m_drivetrain; 13 | private final Supplier m_xaxisSpeedSupplier; 14 | private final Supplier m_zaxisRotateSupplier; 15 | 16 | /** 17 | * Creates a new ArcadeDrive. This command will drive your robot according to the speed supplier 18 | * lambdas. This command does not terminate. 19 | * 20 | * @param drivetrain The drivetrain subsystem on which this command will run 21 | * @param xaxisSpeedSupplier Lambda supplier of forward/backward speed 22 | * @param zaxisRotateSupplier Lambda supplier of rotational speed 23 | */ 24 | public ArcadeDrive( 25 | Drivetrain drivetrain, 26 | Supplier xaxisSpeedSupplier, 27 | Supplier zaxisRotateSupplier) { 28 | m_drivetrain = drivetrain; 29 | m_xaxisSpeedSupplier = xaxisSpeedSupplier; 30 | m_zaxisRotateSupplier = zaxisRotateSupplier; 31 | addRequirements(drivetrain); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() {} 37 | 38 | // Called every time the scheduler runs while the command is scheduled. 39 | @Override 40 | public void execute() { 41 | m_drivetrain.arcadeDrive(m_xaxisSpeedSupplier.get(), m_zaxisRotateSupplier.get()); 42 | } 43 | 44 | // Called once the command ends or is interrupted. 45 | @Override 46 | public void end(boolean interrupted) {} 47 | 48 | // Returns true when the command should end. 49 | @Override 50 | public boolean isFinished() { 51 | return false; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Project Code/Lesson 10/Autonomous/src/main/java/frc/robot/commands/ArcadeDrive.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | import java.util.function.Supplier; 10 | 11 | public class ArcadeDrive extends CommandBase { 12 | private final Drivetrain m_drivetrain; 13 | private final Supplier m_xaxisSpeedSupplier; 14 | private final Supplier m_zaxisRotateSupplier; 15 | 16 | /** 17 | * Creates a new ArcadeDrive. This command will drive your robot according to the speed supplier 18 | * lambdas. This command does not terminate. 19 | * 20 | * @param drivetrain The drivetrain subsystem on which this command will run 21 | * @param xaxisSpeedSupplier Lambda supplier of forward/backward speed 22 | * @param zaxisRotateSupplier Lambda supplier of rotational speed 23 | */ 24 | public ArcadeDrive( 25 | Drivetrain drivetrain, 26 | Supplier xaxisSpeedSupplier, 27 | Supplier zaxisRotateSupplier) { 28 | m_drivetrain = drivetrain; 29 | m_xaxisSpeedSupplier = xaxisSpeedSupplier; 30 | m_zaxisRotateSupplier = zaxisRotateSupplier; 31 | addRequirements(drivetrain); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() {} 37 | 38 | // Called every time the scheduler runs while the command is scheduled. 39 | @Override 40 | public void execute() { 41 | m_drivetrain.arcadeDrive(m_xaxisSpeedSupplier.get(), m_zaxisRotateSupplier.get()); 42 | } 43 | 44 | // Called once the command ends or is interrupted. 45 | @Override 46 | public void end(boolean interrupted) {} 47 | 48 | // Returns true when the command should end. 49 | @Override 50 | public boolean isFinished() { 51 | return false; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Project Code/Lesson 5/CutPowerMode/src/main/java/frc/robot/commands/ArcadeDrive.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | import java.util.function.Supplier; 10 | 11 | public class ArcadeDrive extends CommandBase { 12 | private final Drivetrain m_drivetrain; 13 | private final Supplier m_xaxisSpeedSupplier; 14 | private final Supplier m_zaxisRotateSupplier; 15 | 16 | /** 17 | * Creates a new ArcadeDrive. This command will drive your robot according to the speed supplier 18 | * lambdas. This command does not terminate. 19 | * 20 | * @param drivetrain The drivetrain subsystem on which this command will run 21 | * @param xaxisSpeedSupplier Lambda supplier of forward/backward speed 22 | * @param zaxisRotateSupplier Lambda supplier of rotational speed 23 | */ 24 | public ArcadeDrive( 25 | Drivetrain drivetrain, 26 | Supplier xaxisSpeedSupplier, 27 | Supplier zaxisRotateSupplier) { 28 | m_drivetrain = drivetrain; 29 | m_xaxisSpeedSupplier = xaxisSpeedSupplier; 30 | m_zaxisRotateSupplier = zaxisRotateSupplier; 31 | addRequirements(drivetrain); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() {} 37 | 38 | // Called every time the scheduler runs while the command is scheduled. 39 | @Override 40 | public void execute() { 41 | m_drivetrain.arcadeDrive(m_xaxisSpeedSupplier.get(), m_zaxisRotateSupplier.get()); 42 | } 43 | 44 | // Called once the command ends or is interrupted. 45 | @Override 46 | public void end(boolean interrupted) {} 47 | 48 | // Returns true when the command should end. 49 | @Override 50 | public boolean isFinished() { 51 | return false; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Project Code/Lesson 6/GyroLights/src/main/java/frc/robot/commands/ArcadeDrive.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | import java.util.function.Supplier; 10 | 11 | public class ArcadeDrive extends CommandBase { 12 | private final Drivetrain m_drivetrain; 13 | private final Supplier m_xaxisSpeedSupplier; 14 | private final Supplier m_zaxisRotateSupplier; 15 | 16 | /** 17 | * Creates a new ArcadeDrive. This command will drive your robot according to the speed supplier 18 | * lambdas. This command does not terminate. 19 | * 20 | * @param drivetrain The drivetrain subsystem on which this command will run 21 | * @param xaxisSpeedSupplier Lambda supplier of forward/backward speed 22 | * @param zaxisRotateSupplier Lambda supplier of rotational speed 23 | */ 24 | public ArcadeDrive( 25 | Drivetrain drivetrain, 26 | Supplier xaxisSpeedSupplier, 27 | Supplier zaxisRotateSupplier) { 28 | m_drivetrain = drivetrain; 29 | m_xaxisSpeedSupplier = xaxisSpeedSupplier; 30 | m_zaxisRotateSupplier = zaxisRotateSupplier; 31 | addRequirements(drivetrain); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() {} 37 | 38 | // Called every time the scheduler runs while the command is scheduled. 39 | @Override 40 | public void execute() { 41 | m_drivetrain.arcadeDrive(m_xaxisSpeedSupplier.get(), m_zaxisRotateSupplier.get()); 42 | } 43 | 44 | // Called once the command ends or is interrupted. 45 | @Override 46 | public void end(boolean interrupted) {} 47 | 48 | // Returns true when the command should end. 49 | @Override 50 | public boolean isFinished() { 51 | return false; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Project Code/Lesson 7/GyroLights 2/src/main/java/frc/robot/commands/ArcadeDrive.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.Drivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | import java.util.function.Supplier; 10 | 11 | public class ArcadeDrive extends CommandBase { 12 | private final Drivetrain m_drivetrain; 13 | private final Supplier m_xaxisSpeedSupplier; 14 | private final Supplier m_zaxisRotateSupplier; 15 | 16 | /** 17 | * Creates a new ArcadeDrive. This command will drive your robot according to the speed supplier 18 | * lambdas. This command does not terminate. 19 | * 20 | * @param drivetrain The drivetrain subsystem on which this command will run 21 | * @param xaxisSpeedSupplier Lambda supplier of forward/backward speed 22 | * @param zaxisRotateSupplier Lambda supplier of rotational speed 23 | */ 24 | public ArcadeDrive( 25 | Drivetrain drivetrain, 26 | Supplier xaxisSpeedSupplier, 27 | Supplier zaxisRotateSupplier) { 28 | m_drivetrain = drivetrain; 29 | m_xaxisSpeedSupplier = xaxisSpeedSupplier; 30 | m_zaxisRotateSupplier = zaxisRotateSupplier; 31 | addRequirements(drivetrain); 32 | } 33 | 34 | // Called when the command is initially scheduled. 35 | @Override 36 | public void initialize() {} 37 | 38 | // Called every time the scheduler runs while the command is scheduled. 39 | @Override 40 | public void execute() { 41 | m_drivetrain.arcadeDrive(m_xaxisSpeedSupplier.get(), m_zaxisRotateSupplier.get()); 42 | } 43 | 44 | // Called once the command ends or is interrupted. 45 | @Override 46 | public void end(boolean interrupted) {} 47 | 48 | // Returns true when the command should end. 49 | @Override 50 | public boolean isFinished() { 51 | return false; 52 | } 53 | } 54 | --------------------------------------------------------------------------------