- Motor (
intakeNeo1
): Brushless motor that drives the intake mechanism. - Inverted: The motor is not inverted, meaning it operates in its normal direction.
- Idle Mode: The motor is set to brake mode to stop when power is cut.
Encoder Initialization
A relative encoder is attached to the motor to monitor its velocity:
This allows the motor’s speed to be monitored and adjusted if needed.
Object Detection
Beam Break Sensors
Two DigitalInput
beam break sensors are used to detect objects in the intake:
- Beam Break 1 (Overshoot): Detects whether an object has fully passed through the intake.
- Beam Break 2 (Note): Detects whether an object is currently being intaken.
These sensors are used to control the logic of whether an object is being collected or has passed through the intake.
Object Detection Logic
getOvershootBeam()
: Returns the state of the overshoot sensor, which indicates whether the object has been fully collected.getNoteBeam()
: Returns the state of the note sensor, which indicates whether the object is currently in the process of being intaken.
Object State Methods
getRing()
: Returns whether the intake has an object (hasRing
flag).ringTrue()
: Sets thehasRing
flag totrue
, indicating the presence of an object.ringFalse()
: Sets thehasRing
flag tofalse
, indicating no object is present.
Movement Control
move(double speed)
Sets the intake motor speed, allowing for manual control of the intake mechanism:
stopIntake()
Stops the intake motor by setting its speed to zero:
These methods provide simple control for the intake mechanism, enabling the intake motor to run at a specific speed or stop completely.
Telemetry
The subsystem uses the SmartDashboard
to display telemetry data for debugging and tuning:
- Beam Break Overshoot: Displays whether the overshoot beam is triggered.
- Has Ring: Displays whether the system has detected an object.
- Beam Break Intaking: Displays whether the intake is currently intaking an object.
Periodic Functions
periodic()
This method runs every scheduler cycle and updates the state of the sensors and SmartDashboard telemetry:
The periodic()
method continually checks the state of the beam break sensors and updates the status of whether an object is detected or being intaken.
simulationPeriodic()
This method is used when running simulations.
Future Enhancements
- Integrate additional logic for controlling the intake speed based on object detection.
- Use encoder feedback to implement speed control for more consistent intake performance.
- Further enhance the SmartDashboard telemetry with additional intake status information.
This documentation provides a clear explanation of the Intake subsystem, including its movement control, object detection via beam break sensors, and telemetry integration. It also suggests future enhancements for improving performance and control.