Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 1 | #ifndef Y2019_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_ |
| 2 | #define Y2019_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_ |
| 3 | |
| 4 | #include "aos/controls/control_loop.h" |
Theo Bafrali | 00e4227 | 2019-02-12 01:07:46 -0800 | [diff] [blame] | 5 | #include "frc971/control_loops/static_zeroing_single_dof_profiled_subsystem.h" |
| 6 | #include "y2019/constants.h" |
| 7 | #include "y2019/control_loops/superstructure/collision_avoidance.h" |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 8 | #include "y2019/control_loops/superstructure/superstructure.q.h" |
Theo Bafrali | 3274a18 | 2019-02-17 20:01:38 -0800 | [diff] [blame^] | 9 | #include "y2019/control_loops/superstructure/vacuum.h" |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 10 | |
| 11 | namespace y2019 { |
| 12 | namespace control_loops { |
| 13 | namespace superstructure { |
| 14 | |
| 15 | class Superstructure |
| 16 | : public ::aos::controls::ControlLoop<SuperstructureQueue> { |
| 17 | public: |
| 18 | explicit Superstructure( |
Austin Schuh | 55a13dc | 2019-01-27 22:39:03 -0800 | [diff] [blame] | 19 | ::aos::EventLoop *event_loop, |
| 20 | const ::std::string &name = |
| 21 | ".y2019.control_loops.superstructure.superstructure_queue"); |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 22 | |
Theo Bafrali | 00e4227 | 2019-02-12 01:07:46 -0800 | [diff] [blame] | 23 | using PotAndAbsoluteEncoderSubsystem = |
| 24 | ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem< |
| 25 | ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator, |
| 26 | ::frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus>; |
| 27 | using AbsoluteEncoderSubsystem = |
| 28 | ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem< |
| 29 | ::frc971::zeroing::AbsoluteEncoderZeroingEstimator, |
| 30 | ::frc971::control_loops::AbsoluteEncoderProfiledJointStatus>; |
| 31 | |
Theo Bafrali | 09517b9 | 2019-02-16 15:59:17 -0800 | [diff] [blame] | 32 | const PotAndAbsoluteEncoderSubsystem &elevator() const { return elevator_; } |
| 33 | const PotAndAbsoluteEncoderSubsystem &wrist() const { return wrist_; } |
| 34 | const AbsoluteEncoderSubsystem &intake() const { return intake_; } |
| 35 | const PotAndAbsoluteEncoderSubsystem &stilts() const { return stilts_; } |
Theo Bafrali | 3274a18 | 2019-02-17 20:01:38 -0800 | [diff] [blame^] | 36 | const Vacuum &vacuum() const { return vacuum_; } |
Theo Bafrali | 00e4227 | 2019-02-12 01:07:46 -0800 | [diff] [blame] | 37 | |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 38 | protected: |
Theo Bafrali | 00e4227 | 2019-02-12 01:07:46 -0800 | [diff] [blame] | 39 | virtual void RunIteration(const SuperstructureQueue::Goal *unsafe_goal, |
| 40 | const SuperstructureQueue::Position *position, |
| 41 | SuperstructureQueue::Output *output, |
| 42 | SuperstructureQueue::Status *status) override; |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 43 | |
| 44 | private: |
Theo Bafrali | 00e4227 | 2019-02-12 01:07:46 -0800 | [diff] [blame] | 45 | PotAndAbsoluteEncoderSubsystem elevator_; |
| 46 | PotAndAbsoluteEncoderSubsystem wrist_; |
| 47 | AbsoluteEncoderSubsystem intake_; |
| 48 | PotAndAbsoluteEncoderSubsystem stilts_; |
Theo Bafrali | 3274a18 | 2019-02-17 20:01:38 -0800 | [diff] [blame^] | 49 | Vacuum vacuum_; |
Theo Bafrali | 00e4227 | 2019-02-12 01:07:46 -0800 | [diff] [blame] | 50 | |
| 51 | CollisionAvoidance collision_avoidance_; |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 52 | |
Theo Bafrali | 09517b9 | 2019-02-16 15:59:17 -0800 | [diff] [blame] | 53 | static constexpr double kMinIntakeAngleForRollers = -0.7; |
| 54 | |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 55 | DISALLOW_COPY_AND_ASSIGN(Superstructure); |
| 56 | }; |
| 57 | |
| 58 | } // namespace superstructure |
| 59 | } // namespace control_loops |
| 60 | } // namespace y2019 |
| 61 | |
Austin Schuh | 55a13dc | 2019-01-27 22:39:03 -0800 | [diff] [blame] | 62 | #endif // Y2019_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_ |