-
Notifications
You must be signed in to change notification settings - Fork 1
Control Panel Documentation
Ben Maydan edited this page Feb 8, 2020
·
1 revision
ControlPanelSubsystem
- Constructor - creates a half list of all the colors on the control panel (don’t need a full list because they repeat)
- PistonStateEnum - an enumeration of the two states of the piston, extended and retracted
- getPistonState - returns the current state of the piston (extended/retracted)
- extendPiston - extends the piston forward using the DoubleSolenoid class and puts debug values of SmartDashboard
- retractPiston - retracts the piston backward using the DoubleSolenoid class and puts debug values of SmartDashboard
- halfRotation - returns true or false for if the motor has completed a half rotation of the control panel game piece
- Position - returns the direction (negative or positive) and how many colors the motor should spin to in order to get to the target color
- updateCurrentColor - gets the color that the sensor is outputting and attempts to match it to one of the target colors (blue, red, green, or yellow)
- setMotorSpeed - sets the control panel motor speed to the parameter given (a constant in Constants.Colors. The only reason it is passed as a parameter is because it can be negative)
- getTargetColor - returns the target color the motor should spin to from network tables
- getCurrentColor - returns the current color the color sensor is outputting
- periodic - Prints the current color RGB values to the console and the most likely color in a string to the console. Puts the RGB values of the current color, the IR, and the proximity to SmartDashboard
ControlPanelCommand
- Constructor - initializes the control panel subsystem and adds requirements
- Initialize - checks what mode the control panel command is on and either initializes variables to turn 3 - 5 rotations or initializes variables to rotate to the nearest color
- Execute - if the mode is rotating 3 - 5 times, checks when to stop turning the motor
- isFinished - checks variables to see if we should stop running motors for the current mode
- End - sets the motor speed to 0
Piston Extension Command
- Initialize - either extends or retracts based on the mode
- Execute - nothing
- End - nothing
Constants.Colors
- Creates final strings for all of the colors plus a string for if the color sensor is outputting does not match the other sensors or if they did not put the target color in network tables