2022-Robot
Robot code for 2022 FRC Season by Argos, FRC team #1756
Loading...
Searching...
No Matches
intake_subsystem.h
Go to the documentation of this file.
1
4
5#pragma once
6
7#include <frc2/command/SubsystemBase.h>
8
9#include <TMD37003.h>
10#include <TimeOfFlight.h>
11
17#include "ctre/Phoenix.h"
18#include "frc/Solenoid.h"
19
24class IntakeSubsystem : public frc2::SubsystemBase {
25 public:
27
33
37 void Disable();
38
46
54
63 bool GetIsBallTeamColor();
64
68 void Periodic() override;
69
74 void Intake();
75
81 void SlowIntake();
82
87 void StopIntake();
88
93 void DumpBall();
94
99 void Shoot();
100
105 void StopShoot();
106
113 void ElevatorCycle(bool direction, bool cycleLength);
114
115 private:
118
119 // Components (e.g. motor controllers and sensors) should generally be
120 // declared private and exposed only through public methods.
121 // MOTORS
122 WPI_TalonSRX
124 WPI_TalonSRX m_intakeDrive;
125
126 // SOLENOIDS
127 frc::Solenoid m_intakeDeploy;
128
129 // SENSORS
130 frc::TimeOfFlight m_ballPresentIntake;
131 frc::TimeOfFlight m_ballPresentShooter;
132 // frc::TMD37003 m_ballColor; ///< at intake
133
134 // CARGO MANAGEMENT
135
137
144
147
152
154};
Controls the Intake of the robot and provides internal ball position state info.
Definition: intake_subsystem.h:24
bool GetBallPresentIntake()
Determines whether ball is present at intake.
Definition: intake_subsystem.cpp:134
void Disable()
Handle robot disabling.
Definition: intake_subsystem.cpp:57
const argos_lib::CANAddress m_beltDriveAddr
Definition: intake_subsystem.h:116
WPI_TalonSRX m_intakeDrive
Motor for the intake rollers (Positive is in, Negative is out)
Definition: intake_subsystem.h:124
bool m_intakeButtonPressed
True if intake button is pressed.
Definition: intake_subsystem.h:138
argos_lib::EdgeDetector m_ShooterEdgeDetector
an edge detector used for detecting a ball leaving the shooter
Definition: intake_subsystem.h:145
argos_lib::HysteresisFilter< units::inch_t > m_hysteresisShooter
Filter for converting from ball distance to bool, True when TOF sensor reads a ball in front.
Definition: intake_subsystem.h:151
void ElevatorCycle(bool direction, bool cycleLength)
Cycle the elevator to load or dump balls.
Definition: intake_subsystem.cpp:185
const argos_lib::CANAddress m_intakeDriveAddr
Definition: intake_subsystem.h:117
argos_lib::HysteresisFilter< units::inch_t > m_hysteresisIntake
Filter for converting from ball distance to bool, True when TOF sensor reads a ball in front.
Definition: intake_subsystem.h:149
bool m_shooterButtonPressed
True if the shooter button is pressed.
Definition: intake_subsystem.h:141
bool m_outtakeButtonPressed
True if the outake button is pressed.
Definition: intake_subsystem.h:140
void SlowIntake()
Deploys intake and starts rollers inwards at slow speed. Handles elevator logic of cycling balls....
Definition: intake_subsystem.cpp:158
bool m_firstShotMode
True if there was NOT a ball in the shooter.
Definition: intake_subsystem.h:142
void DumpBall()
Reverses the intake to dump balls.
Definition: intake_subsystem.cpp:170
frc::TimeOfFlight m_ballPresentShooter
TOF sensor capable of detecting ball at shooter.
Definition: intake_subsystem.h:131
bool GetBallPresentShooter()
Determines whether ball is present at shooter.
Definition: intake_subsystem.cpp:139
argos_lib::Debouncer m_shooterTimeDebouncer
Simple de-bouncer for delaying shooter shots.
Definition: intake_subsystem.h:153
void Intake()
Deploys intake and starts rollers inwards. Handles elevator logic of cycling balls.
Definition: intake_subsystem.cpp:164
bool m_slowIntakeRequested
True if a slow intake is needed.
Definition: intake_subsystem.h:139
argos_lib::SwappableControllersSubsystem * m_pControllers
The driver and operator controllers.
Definition: intake_subsystem.h:143
bool GetIsBallTeamColor()
Determines whether ball is team color.
Definition: intake_subsystem.cpp:148
IntakeState m_intakeState
Current intake state.
Definition: intake_subsystem.h:136
argos_lib::EdgeDetector m_IntakeEdgeDetector
Edge detector detecting a ball entering the intake.
Definition: intake_subsystem.h:146
void Periodic() override
Definition: intake_subsystem.cpp:63
void StopIntake()
Retracts intake. Does not run rollers.
Definition: intake_subsystem.cpp:152
IntakeState
Possible intake states.
Definition: intake_subsystem.h:32
frc::TimeOfFlight m_ballPresentIntake
TOF sensor capable of detecting ball at intake.
Definition: intake_subsystem.h:130
frc::Solenoid m_intakeDeploy
Solenoid for intake actuation (True is extend, False is retract)
Definition: intake_subsystem.h:127
WPI_TalonSRX m_beltDrive
Motor that drives the belts on the elevator (Positive towards shooter, Negative away from shooter)
Definition: intake_subsystem.h:123
void StopShoot()
Stop shooter.
Definition: intake_subsystem.cpp:181
void Shoot()
Shoots ball.
Definition: intake_subsystem.cpp:176
Definition: debouncer.h:14
Definition: edge_detector.h:11
A simple hysteresis filter for giving a bool output for a threshold.
Definition: hysteresis_filter.h:15
Allows two controllers to swap between "Driver" and "Operator" control schemes on the fly by swapping...
Definition: swappable_controllers_subsystem.h:18
RobotInstance
Differentiates between practice robot and competition robot.
Definition: config_types.h:13
Definition: config_types.h:25