Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 1 | #ifndef Y2023_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_ |
| 2 | #define Y2023_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_ |
| 3 | |
| 4 | #include "aos/events/event_loop.h" |
| 5 | #include "frc971/control_loops/control_loop.h" |
| 6 | #include "frc971/control_loops/drivetrain/drivetrain_status_generated.h" |
| 7 | #include "y2023/constants.h" |
milind-u | 01bbcf2 | 2023-02-20 18:00:28 -0800 | [diff] [blame^] | 8 | #include "y2023/control_loops/superstructure/arm/arm.h" |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 9 | #include "y2023/control_loops/superstructure/superstructure_goal_generated.h" |
| 10 | #include "y2023/control_loops/superstructure/superstructure_output_generated.h" |
| 11 | #include "y2023/control_loops/superstructure/superstructure_position_generated.h" |
| 12 | #include "y2023/control_loops/superstructure/superstructure_status_generated.h" |
| 13 | |
| 14 | namespace y2023 { |
| 15 | namespace control_loops { |
| 16 | namespace superstructure { |
| 17 | |
| 18 | class Superstructure |
| 19 | : public ::frc971::controls::ControlLoop<Goal, Position, Status, Output> { |
| 20 | public: |
| 21 | using RelativeEncoderSubsystem = |
| 22 | ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem< |
| 23 | ::frc971::zeroing::RelativeEncoderZeroingEstimator, |
| 24 | ::frc971::control_loops::RelativeEncoderProfiledJointStatus>; |
| 25 | |
| 26 | using PotAndAbsoluteEncoderSubsystem = |
| 27 | ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem< |
| 28 | ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator, |
| 29 | ::frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus>; |
| 30 | |
| 31 | explicit Superstructure(::aos::EventLoop *event_loop, |
| 32 | std::shared_ptr<const constants::Values> values, |
| 33 | const ::std::string &name = "/superstructure"); |
| 34 | |
| 35 | double robot_velocity() const; |
| 36 | |
| 37 | protected: |
| 38 | virtual void RunIteration(const Goal *unsafe_goal, const Position *position, |
| 39 | aos::Sender<Output>::Builder *output, |
| 40 | aos::Sender<Status>::Builder *status) override; |
| 41 | |
| 42 | private: |
| 43 | std::shared_ptr<const constants::Values> values_; |
| 44 | |
| 45 | aos::Fetcher<frc971::control_loops::drivetrain::Status> |
| 46 | drivetrain_status_fetcher_; |
| 47 | aos::Fetcher<aos::JoystickState> joystick_state_fetcher_; |
| 48 | |
milind-u | 01bbcf2 | 2023-02-20 18:00:28 -0800 | [diff] [blame^] | 49 | arm::Arm arm_; |
| 50 | |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 51 | aos::Alliance alliance_ = aos::Alliance::kInvalid; |
| 52 | |
| 53 | DISALLOW_COPY_AND_ASSIGN(Superstructure); |
| 54 | }; |
| 55 | |
| 56 | } // namespace superstructure |
| 57 | } // namespace control_loops |
| 58 | } // namespace y2023 |
| 59 | |
| 60 | #endif // Y2023_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_ |