What's already done for you:
- Swerve drivetrain (fully configured and driveable)
- Motor objects created and wired to correct ports
- PID values tuned for the wrist mechanism
- State machine framework (base classes provided)
- Controller input handling
What you need to implement:
- Define states for the robot and subsystems (~4 states each, 4 enums)
- Define motor speeds and wrist positions (~4 constants each, 2 files)
- Implement motor control methods in subsystems (2 files)
- Wire up state machine transitions in RobotManager
- Create commands and bind them to controller buttons
Estimated effort: This is designed for a single-day hackathon. Start with designing your state machine on paper, then work through the files in order.
Welcome to the FRC Robot Programming Hackathon! This project provides a skeleton codebase for programming an FRC robot with an intake mechanism. Your task is to design and implement the control logic to make the robot functional.
This robot has two main subsystems you'll be working with:
- Intake Rollers - Motors that spin to intake and eject game pieces
- Intake Wrist - A pivoting arm that positions the intake at different angles
The robot uses a state machine architecture to coordinate these subsystems. This means the robot can be in different "states" (like IDLE, INTAKE, SCORE), and each subsystem behaves differently depending on the current state.
Look for TODO comments throughout the codebase. These mark the areas where you need to add code. The files contain example comments showing values and patterns from a previous robot implementation.
Before writing any code, think about what states your robot needs. Consider:
- What positions does the intake need to be in?
- What actions does the robot perform? (intaking, scoring, idling, etc.)
- What triggers transitions between states?
Files to modify:
src/main/java/frc/robot/stateMachine/RobotState.java- Define high-level robot statessrc/main/java/frc/robot/stateMachine/RobotFlag.java- Define input flags that trigger transitionssrc/main/java/frc/robot/subsystems/intakeRollers/IntakeRollersState.java- Define roller statessrc/main/java/frc/robot/subsystems/intakeWrist/IntakeWristState.java- Define wrist states
These enum files are currently empty. Add the states your robot needs based on your design.
Files to modify:
src/main/java/frc/robot/subsystems/intakeRollers/IntakeRollersSpeeds.javasrc/main/java/frc/robot/subsystems/intakeWrist/IntakeWristPositions.java
These files contain example values in comments. Define constants for:
- Intake speed (how fast to spin when picking up game pieces)
- Scoring speed (how fast to spin when ejecting)
- Idle speed (should the motors hold position or coast?)
- Wrist positions for each state
Files to modify:
src/main/java/frc/robot/subsystems/intakeRollers/IntakeRollersSubsystem.javasrc/main/java/frc/robot/subsystems/intakeWrist/IntakeWristSubsystem.java
For each subsystem, you need to:
- Set the initial state in the constructor
- Configure the motors (PID, motion magic, etc.)
- Implement
setIntakeRollerSpeeds()/setIntakePosition()to command the motors - Implement
atGoal()to check if the mechanism has reached its target - Implement
afterTransition()to set the correct speed/position for each state - Implement
hasCoral()for game piece detection (IntakeRollers only)
Files to modify:
src/main/java/frc/robot/stateMachine/RobotManager.java
The RobotManager coordinates the overall robot state. You need to:
- Set the initial state in the constructor
- Implement flag-triggered transitions in
getNextState() - Implement automatic transitions (e.g., move to INTAKE state when wrist reaches position)
- Set subsystem states in
afterTransition() - Define request methods for each flag (e.g.,
intakeRequest(),scoreRequest())
Files to modify:
src/main/java/frc/robot/commands/RobotCommands.java- Define commands that trigger state changessrc/main/java/frc/robot/Controls.java- Bind controller buttons to commands
src/main/java/frc/robot/
├── Robot.java # Main robot class
├── Controls.java # Controller button mappings
├── Constants.java # Robot constants (PID values, etc.)
├── Ports.java # Motor and sensor port numbers
├── commands/
│ └── RobotCommands.java # Command definitions
├── stateMachine/
│ ├── StateMachine.java # Base state machine class (provided)
│ ├── FlagManager.java # Flag management (provided)
│ ├── RobotManager.java # Main robot state machine
│ ├── RobotState.java # Robot state enum (empty - you define)
│ └── RobotFlag.java # Input flags enum (empty - you define)
├── subsystems/
│ ├── intakeRollers/
│ │ ├── IntakeRollersSubsystem.java
│ │ ├── IntakeRollersState.java # (empty - you define)
│ │ └── IntakeRollersSpeeds.java # (empty - you define)
│ ├── intakeWrist/
│ │ ├── IntakeWristSubsystem.java
│ │ ├── IntakeWristState.java # (empty - you define)
│ │ └── IntakeWristPositions.java # (empty - you define)
│ └── drivetrain/ # Swerve drive (already configured)
└── drivers/
└── Xbox.java # Xbox controller wrapper
- Controller inputs trigger flags (e.g., pressing a button calls
robot.intakeRequest()) - RobotManager checks flags in
getNextState()and determines the next state - When the state changes,
afterTransition()is called afterTransition()tells each subsystem what state to be in- Each subsystem's
afterTransition()sets its motors based on its state
- Start by determining your state machines before writing code
- Implement one subsystem at a time
- Use the Driver Station and SmartDashboard/DogLog to debug
- Check the example comments in each file for guidance
- Ask mentors for help with hardware-specific values (motor directions, gear ratios, etc.)
Good luck!