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