Adam Snaider | 79900c2 | 2017-02-08 20:23:15 -0800 | [diff] [blame] | 1 | #ifndef Y2017_CONTROL_LOOPS_SUPERSTRUCTURE_INTAKE_INTAKE_H_ |
| 2 | #define Y2017_CONTROL_LOOPS_SUPERSTRUCTURE_INTAKE_INTAKE_H_ |
| 3 | |
| 4 | #include "frc971/control_loops/profiled_subsystem.h" |
| 5 | #include "y2017/control_loops/superstructure/superstructure.q.h" |
| 6 | |
| 7 | namespace y2017 { |
| 8 | namespace control_loops { |
| 9 | namespace superstructure { |
| 10 | namespace intake { |
| 11 | |
| 12 | class Intake { |
| 13 | public: |
Ojas Upadhye | 3abe886 | 2017-02-11 17:06:53 -0800 | [diff] [blame^] | 14 | Intake(); |
| 15 | double goal(int row, int col) const { |
| 16 | return profiled_subsystem_.goal(row, col); |
| 17 | } |
Adam Snaider | 79900c2 | 2017-02-08 20:23:15 -0800 | [diff] [blame] | 18 | |
Ojas Upadhye | 3abe886 | 2017-02-11 17:06:53 -0800 | [diff] [blame^] | 19 | // The zeroing and operating voltages. |
| 20 | static constexpr double kZeroingVoltage = 2.5; |
| 21 | static constexpr double kOperatingVoltage = 12.0; |
Adam Snaider | 79900c2 | 2017-02-08 20:23:15 -0800 | [diff] [blame] | 22 | |
Ojas Upadhye | 3abe886 | 2017-02-11 17:06:53 -0800 | [diff] [blame^] | 23 | void Iterate(const control_loops::IntakeGoal *unsafe_goal, |
| 24 | const ::frc971::PotAndAbsolutePosition *position, double *output, |
| 25 | ::frc971::control_loops::AbsoluteProfiledJointStatus *status); |
Adam Snaider | 79900c2 | 2017-02-08 20:23:15 -0800 | [diff] [blame] | 26 | |
Ojas Upadhye | 3abe886 | 2017-02-11 17:06:53 -0800 | [diff] [blame^] | 27 | void Reset(); |
Adam Snaider | 79900c2 | 2017-02-08 20:23:15 -0800 | [diff] [blame] | 28 | |
Ojas Upadhye | 3abe886 | 2017-02-11 17:06:53 -0800 | [diff] [blame^] | 29 | enum class State : int32_t { |
| 30 | UNINITIALIZED, |
| 31 | DISABLED_INITIALIZED, |
| 32 | ZEROING, |
| 33 | RUNNING, |
| 34 | ESTOP, |
| 35 | }; |
Adam Snaider | 79900c2 | 2017-02-08 20:23:15 -0800 | [diff] [blame] | 36 | |
Ojas Upadhye | 3abe886 | 2017-02-11 17:06:53 -0800 | [diff] [blame^] | 37 | State state() const { return state_; } |
Adam Snaider | 79900c2 | 2017-02-08 20:23:15 -0800 | [diff] [blame] | 38 | |
Ojas Upadhye | 3abe886 | 2017-02-11 17:06:53 -0800 | [diff] [blame^] | 39 | private: |
| 40 | State state_; |
Adam Snaider | 79900c2 | 2017-02-08 20:23:15 -0800 | [diff] [blame] | 41 | |
Ojas Upadhye | 3abe886 | 2017-02-11 17:06:53 -0800 | [diff] [blame^] | 42 | ::frc971::control_loops::SingleDOFProfiledSubsystem< |
| 43 | ::frc971::zeroing::PotAndAbsEncoderZeroingEstimator> profiled_subsystem_; |
Adam Snaider | 79900c2 | 2017-02-08 20:23:15 -0800 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | } // namespace intake |
| 47 | } // namespace superstructure |
| 48 | } // namespace control_loops |
| 49 | } // namespace y2017 |
| 50 | |
| 51 | #endif // Y2017_CONTROL_LOOPS_SUPERSTRUCTURE_INTAKE_INTAKE_H_ |