James Kuszmaul | b1b2d8e | 2020-02-21 21:11:46 -0800 | [diff] [blame^] | 1 | #ifndef y2020_CONTROL_LOOPS_SUPERSTRUCTURE_TURRET_AIMING_H_ |
| 2 | #define y2020_CONTROL_LOOPS_SUPERSTRUCTURE_TURRET_AIMING_H_ |
| 3 | |
| 4 | #include "aos/flatbuffers.h" |
| 5 | #include "frc971/control_loops/drivetrain/drivetrain_status_generated.h" |
| 6 | #include "frc971/control_loops/profiled_subsystem_generated.h" |
| 7 | #include "y2020/control_loops/superstructure/superstructure_status_generated.h" |
| 8 | |
| 9 | namespace y2020 { |
| 10 | namespace control_loops { |
| 11 | namespace superstructure { |
| 12 | namespace turret { |
| 13 | |
| 14 | // This class manages taking in drivetrain status messages and generating turret |
| 15 | // goals so that it gets aimed at the goal. |
| 16 | class Aimer { |
| 17 | public: |
| 18 | typedef frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemGoal |
| 19 | Goal; |
| 20 | typedef frc971::control_loops::drivetrain::Status Status; |
| 21 | Aimer(); |
| 22 | void Update(const Status *status); |
| 23 | const Goal *TurretGoal() const { return &goal_.message(); } |
| 24 | |
| 25 | flatbuffers::Offset<AimerStatus> PopulateStatus( |
| 26 | flatbuffers::FlatBufferBuilder *fbb) const; |
| 27 | |
| 28 | private: |
| 29 | aos::FlatbufferDetachedBuffer<Goal> goal_; |
| 30 | }; |
| 31 | |
| 32 | } // namespace turret |
| 33 | } // namespace superstructure |
| 34 | } // namespace control_loops |
| 35 | } // namespace y2020 |
| 36 | #endif // y2020_CONTROL_LOOPS_SUPERSTRUCTURE_TURRET_AIMING_H_ |