blob: 2df9026fcab06f01d2c351605ab2372fe4a2123e [file] [log] [blame]
Tyler Chatowe51334a2019-01-20 16:58:16 -08001#ifndef Y2019_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_
2#define Y2019_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_
3
4#include "aos/controls/control_loop.h"
Theo Bafrali00e42272019-02-12 01:07:46 -08005#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 Chatowe51334a2019-01-20 16:58:16 -08008#include "y2019/control_loops/superstructure/superstructure.q.h"
Theo Bafrali3274a182019-02-17 20:01:38 -08009#include "y2019/control_loops/superstructure/vacuum.h"
Tyler Chatowe51334a2019-01-20 16:58:16 -080010
11namespace y2019 {
12namespace control_loops {
13namespace superstructure {
14
15class Superstructure
16 : public ::aos::controls::ControlLoop<SuperstructureQueue> {
17 public:
18 explicit Superstructure(
Austin Schuh55a13dc2019-01-27 22:39:03 -080019 ::aos::EventLoop *event_loop,
20 const ::std::string &name =
21 ".y2019.control_loops.superstructure.superstructure_queue");
Tyler Chatowe51334a2019-01-20 16:58:16 -080022
Theo Bafrali00e42272019-02-12 01:07:46 -080023 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 Bafrali09517b92019-02-16 15:59:17 -080032 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 Bafrali3274a182019-02-17 20:01:38 -080036 const Vacuum &vacuum() const { return vacuum_; }
Theo Bafrali00e42272019-02-12 01:07:46 -080037
Tyler Chatowe51334a2019-01-20 16:58:16 -080038 protected:
Theo Bafrali00e42272019-02-12 01:07:46 -080039 virtual void RunIteration(const SuperstructureQueue::Goal *unsafe_goal,
40 const SuperstructureQueue::Position *position,
41 SuperstructureQueue::Output *output,
42 SuperstructureQueue::Status *status) override;
Tyler Chatowe51334a2019-01-20 16:58:16 -080043
44 private:
Theo Bafrali00e42272019-02-12 01:07:46 -080045 PotAndAbsoluteEncoderSubsystem elevator_;
46 PotAndAbsoluteEncoderSubsystem wrist_;
47 AbsoluteEncoderSubsystem intake_;
48 PotAndAbsoluteEncoderSubsystem stilts_;
Theo Bafrali3274a182019-02-17 20:01:38 -080049 Vacuum vacuum_;
Theo Bafrali00e42272019-02-12 01:07:46 -080050
51 CollisionAvoidance collision_avoidance_;
Tyler Chatowe51334a2019-01-20 16:58:16 -080052
Austin Schuh194c43c2019-03-22 20:40:53 -070053 int line_blink_count_ = 0;
54
Theo Bafrali09517b92019-02-16 15:59:17 -080055 static constexpr double kMinIntakeAngleForRollers = -0.7;
56
Tyler Chatowe51334a2019-01-20 16:58:16 -080057 DISALLOW_COPY_AND_ASSIGN(Superstructure);
58};
59
60} // namespace superstructure
61} // namespace control_loops
62} // namespace y2019
63
Austin Schuh55a13dc2019-01-27 22:39:03 -080064#endif // Y2019_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_