Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 1 | #ifndef y2020_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_ |
| 2 | #define y2020_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_ |
| 3 | |
| 4 | #include "aos/controls/control_loop.h" |
| 5 | #include "aos/events/event_loop.h" |
| 6 | #include "y2020/constants.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 | |
| 16 | class Superstructure |
| 17 | : public ::aos::controls::ControlLoop<Goal, Position, Status, Output> { |
| 18 | public: |
| 19 | explicit Superstructure(::aos::EventLoop *event_loop, |
| 20 | const ::std::string &name = "/superstructure"); |
| 21 | |
Kai Tinkess | fb46037 | 2020-02-08 14:05:48 -0800 | [diff] [blame] | 22 | using PotAndAbsoluteEncoderSubsystem = |
| 23 | ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem< |
| 24 | ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator, |
| 25 | ::frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus>; |
Sabina Davis | cf08b15 | 2020-01-31 22:12:09 -0800 | [diff] [blame] | 26 | using AbsoluteEncoderSubsystem = |
| 27 | ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem< |
| 28 | ::frc971::zeroing::AbsoluteEncoderZeroingEstimator, |
| 29 | ::frc971::control_loops::AbsoluteEncoderProfiledJointStatus>; |
| 30 | |
| 31 | const AbsoluteEncoderSubsystem &hood() const { return hood_; } |
Sabina Davis | 0f2d38c | 2020-02-08 17:01:21 -0800 | [diff] [blame] | 32 | const AbsoluteEncoderSubsystem &intake_joint() const { return intake_joint_; } |
Kai Tinkess | fb46037 | 2020-02-08 14:05:48 -0800 | [diff] [blame] | 33 | const PotAndAbsoluteEncoderSubsystem &turret() const { return turret_; } |
Sabina Davis | cf08b15 | 2020-01-31 22:12:09 -0800 | [diff] [blame] | 34 | |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 35 | protected: |
| 36 | virtual void RunIteration(const Goal *unsafe_goal, const Position *position, |
| 37 | aos::Sender<Output>::Builder *output, |
| 38 | aos::Sender<Status>::Builder *status) override; |
| 39 | |
| 40 | private: |
Sabina Davis | cf08b15 | 2020-01-31 22:12:09 -0800 | [diff] [blame] | 41 | AbsoluteEncoderSubsystem hood_; |
Sabina Davis | 0f2d38c | 2020-02-08 17:01:21 -0800 | [diff] [blame] | 42 | AbsoluteEncoderSubsystem intake_joint_; |
Kai Tinkess | fb46037 | 2020-02-08 14:05:48 -0800 | [diff] [blame] | 43 | PotAndAbsoluteEncoderSubsystem turret_; |
Sabina Davis | cf08b15 | 2020-01-31 22:12:09 -0800 | [diff] [blame] | 44 | |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 45 | DISALLOW_COPY_AND_ASSIGN(Superstructure); |
| 46 | }; |
| 47 | |
| 48 | } // namespace superstructure |
| 49 | } // namespace control_loops |
| 50 | } // namespace y2020 |
| 51 | |
| 52 | #endif // y2020_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_ |