Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame^] | 1 | #ifndef Y2024_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_ |
| 2 | #define Y2024_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_ |
| 3 | |
| 4 | #include "aos/events/event_loop.h" |
| 5 | #include "aos/json_to_flatbuffer.h" |
| 6 | #include "frc971/constants/constants_sender_lib.h" |
| 7 | #include "frc971/control_loops/control_loop.h" |
| 8 | #include "frc971/control_loops/drivetrain/drivetrain_can_position_generated.h" |
| 9 | #include "frc971/control_loops/drivetrain/drivetrain_status_generated.h" |
| 10 | #include "frc971/zeroing/absolute_encoder.h" |
| 11 | #include "frc971/zeroing/pot_and_absolute_encoder.h" |
| 12 | #include "y2024/constants.h" |
| 13 | #include "y2024/constants/constants_generated.h" |
| 14 | #include "y2024/control_loops/superstructure/superstructure_goal_generated.h" |
| 15 | #include "y2024/control_loops/superstructure/superstructure_output_generated.h" |
| 16 | #include "y2024/control_loops/superstructure/superstructure_position_generated.h" |
| 17 | #include "y2024/control_loops/superstructure/superstructure_status_generated.h" |
| 18 | |
| 19 | namespace y2024 { |
| 20 | namespace control_loops { |
| 21 | namespace superstructure { |
| 22 | |
| 23 | class Superstructure |
| 24 | : public ::frc971::controls::ControlLoop<Goal, Position, Status, Output> { |
| 25 | public: |
| 26 | explicit Superstructure(::aos::EventLoop *event_loop, |
| 27 | std::shared_ptr<const constants::Values> values, |
| 28 | const ::std::string &name = "/superstructure"); |
| 29 | |
| 30 | double robot_velocity() const; |
| 31 | |
| 32 | protected: |
| 33 | virtual void RunIteration(const Goal *unsafe_goal, const Position *position, |
| 34 | aos::Sender<Output>::Builder *output, |
| 35 | aos::Sender<Status>::Builder *status) override; |
| 36 | |
| 37 | private: |
| 38 | std::shared_ptr<const constants::Values> values_; |
| 39 | frc971::constants::ConstantsFetcher<Constants> constants_fetcher_; |
| 40 | |
| 41 | aos::Fetcher<frc971::control_loops::drivetrain::Status> |
| 42 | drivetrain_status_fetcher_; |
| 43 | aos::Fetcher<aos::JoystickState> joystick_state_fetcher_; |
| 44 | |
| 45 | aos::Alliance alliance_ = aos::Alliance::kInvalid; |
| 46 | |
| 47 | DISALLOW_COPY_AND_ASSIGN(Superstructure); |
| 48 | }; |
| 49 | |
| 50 | } // namespace superstructure |
| 51 | } // namespace control_loops |
| 52 | } // namespace y2024 |
| 53 | |
| 54 | #endif // Y2024_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_ |