CanBot is a small WPILib Java robot project. It is intentionally simple and uses the WPILib command-based framework.
- The Xbox controller left joystick Y axis controls the left side of the drivetrain.
- The right joystick Y axis controls the right side.
- Both joystick outputs are limited to 50 percent speed.
- The robot has no camera or vision code.
- If no autonomous command is selected, the robot remains stopped in autonomous.
src/main/java/frc/robot/Robot.java— handles the lifecycle of robot modes.src/main/java/frc/robot/RobotContainer.java— creates subsystems and connects commands.src/main/java/frc/robot/subsystems/— code that controls physical robot hardware.src/main/java/frc/robot/commands/— code that describes robot behavior.src/main/java/frc/robot/RobotMap.java— motor CAN IDs and motor configuration.src/main/java/frc/robot/OI.java— controller setup and joystick values.
- Class: A blueprint for a type of object.
- Object: An instance created from a class.
- Method: An action or function belonging to a class.
- Subsystem: Code that owns a physical mechanism and controls its hardware safely.
- Command: Code that tells subsystems what to do over time.
- Supplier: A method object that provides a value when asked.
- CAN ID: The number that identifies a motor controller on the robot's CAN bus.
Edit the 0.50 values in OI.java. A value of 1.0 is full speed and 0.0 is stopped.
Edit the constants in RobotMap.java. Do not change CAN IDs until the physical
motor wiring and robot configuration have also been checked.
- Create a class in
src/main/java/frc/robot/subsystems/. - Extend
SubsystemBase. - Add its motor or sensor setup.
- Create it in
RobotContainer.java.
- Create a command in
src/main/java/frc/robot/commands/. - Declare every subsystem the command uses with
addRequirements(...). - Return the command from
RobotContainer.getAutonomousCommand().
On macOS or Linux:
./gradlew buildIf gradlew is not executable, run:
bash ./gradlew build