State-Based Roller Subsystems
What is a Roller Subsystem?
A roller subsystem controls motors that intake, outtake, or hold game pieces using spinning rollers. These subsystems vary from simple single-motor controllers to more complex ones managing multiple motors working together.
There are two main patterns in our codebase for roller subsystems:
Basic Single-Motor Roller Subsystems
Composite Multi-Motor Roller Subsystems
We no longer use these patterns, will update when I have time (Although it is fairly similar). See RobotController.java‘s endEffectorRollers for Basic roller subsystem replacement. See IntakeRollers.java for a composite Subsytsem replacement.
1. Basic Roller Subsystems
Example: EndEffectorRollers
EndEffectorRollersThe EndEffectorRollers class is a simple roller subsystem controlling one motor. It extends the base class:
class EndEffectorRollers extends BasicStateBasedRollerSubsystem<EndEffectorRollers.State>Each state in
EndEffectorRollers.Staterepresents a voltage to apply to the motor.The control mode is usually
VOLTAGE, directly controlling motor output.
enum State implements BasicRollerState {
IDLE(0.0),
HOLD(-2.0),
CORAL_INTAKE(-4.0),
// other states...
}When to use: This pattern is ideal for simple rollers with straightforward control requirements, like a single flywheel or a roller that only needs on/off/hold states.
2. Composite Roller Subsystems
Example: IntakeRollers
IntakeRollersIntakeRollers is an example of a multi-motor roller subsystem that controls several motors as one logical unit:
class IntakeRollers extends StateBasedRollerSubsystem<IntakeRollers.State>Controls three motors: intake roller, indexer bottom, and indexer sides.
Each state provides an array of voltages for all three motors.
enum State implements RollerState {
IDLE(0,0,0),
INTAKING(10.0, 2.5, 8),
EXHAUST(-6, -6, -6),
// other states...
}Each motor can have its own voltage, but they are managed together as a single subsystem.
Benefits:
Centralizes control logic for related motors.
Simplifies coordination and reduces complexity in the superstructure.
Ensures all intake and indexing rollers work in sync.
3. Control Modes
Our roller subsystems primarily use three common control modes:
ControlState.VOLTAGEDirectly controls motor output voltage. Most common for rollers because it’s simple and effective for on/off or variable speed control.ControlState.VELOCITYUses closed-loop velocity control with feedback (e.g., encoders) to maintain a target roller speed. Useful for precise speed regulation during intaking or shooting.ControlState.OPEN_LOOPSends raw motor power commands without feedback or PID control. Good for very simple or manual control scenarios.
Last updated