Sabina Davis | edf8947 | 2020-02-17 15:27:37 -0800 | [diff] [blame] | 1 | #ifndef Y2020_CONTROL_LOOPS_SHOOTER_SHOOTER_H_ |
| 2 | #define Y2020_CONTROL_LOOPS_SHOOTER_SHOOTER_H_ |
| 3 | |
James Kuszmaul | 6175066 | 2021-06-21 21:32:33 -0700 | [diff] [blame^] | 4 | #include "frc971/control_loops/control_loop.h" |
Sabina Davis | edf8947 | 2020-02-17 15:27:37 -0800 | [diff] [blame] | 5 | #include "frc971/control_loops/state_feedback_loop.h" |
| 6 | #include "y2020/control_loops/superstructure/shooter/flywheel_controller.h" |
| 7 | #include "y2020/control_loops/superstructure/superstructure_goal_generated.h" |
| 8 | #include "y2020/control_loops/superstructure/superstructure_output_generated.h" |
| 9 | #include "y2020/control_loops/superstructure/superstructure_position_generated.h" |
| 10 | #include "y2020/control_loops/superstructure/superstructure_status_generated.h" |
| 11 | |
| 12 | namespace y2020 { |
| 13 | namespace control_loops { |
| 14 | namespace superstructure { |
| 15 | namespace shooter { |
| 16 | |
| 17 | // Handles all flywheels together. |
| 18 | class Shooter { |
| 19 | public: |
| 20 | Shooter(); |
| 21 | |
| 22 | flatbuffers::Offset<ShooterStatus> RunIteration( |
| 23 | const ShooterGoal *goal, const ShooterPosition *position, |
Sabina Davis | 0f31d3f | 2020-02-20 20:41:00 -0800 | [diff] [blame] | 24 | flatbuffers::FlatBufferBuilder *fbb, OutputT *output, |
| 25 | const aos::monotonic_clock::time_point position_timestamp); |
| 26 | |
| 27 | bool ready() { return ready_; } |
Sabina Davis | edf8947 | 2020-02-17 15:27:37 -0800 | [diff] [blame] | 28 | |
Austin Schuh | 263dead | 2021-04-04 21:19:19 -0700 | [diff] [blame] | 29 | float finisher_goal() const { return finisher_.goal(); } |
| 30 | float accelerator_goal() const { return accelerator_left_.goal(); } |
| 31 | |
Sabina Davis | edf8947 | 2020-02-17 15:27:37 -0800 | [diff] [blame] | 32 | private: |
| 33 | FlywheelController finisher_, accelerator_left_, accelerator_right_; |
| 34 | |
Sabina Davis | 0f31d3f | 2020-02-20 20:41:00 -0800 | [diff] [blame] | 35 | bool UpToSpeed(const ShooterGoal *goal); |
| 36 | bool ready_ = false; |
| 37 | |
Sabina Davis | edf8947 | 2020-02-17 15:27:37 -0800 | [diff] [blame] | 38 | DISALLOW_COPY_AND_ASSIGN(Shooter); |
| 39 | }; |
| 40 | |
| 41 | } // namespace shooter |
| 42 | } // namespace superstructure |
| 43 | } // namespace control_loops |
| 44 | } // namespace y2020 |
| 45 | |
| 46 | #endif // Y2020_CONTROL_LOOPS_SHOOTER_SHOOTER_H_ |