blob: c3e53f2b9a94c1cedd536a8982c449f41835e440 [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"
9
10namespace y2019 {
11namespace control_loops {
12namespace superstructure {
13
14class Superstructure
15 : public ::aos::controls::ControlLoop<SuperstructureQueue> {
16 public:
17 explicit Superstructure(
Austin Schuh55a13dc2019-01-27 22:39:03 -080018 ::aos::EventLoop *event_loop,
19 const ::std::string &name =
20 ".y2019.control_loops.superstructure.superstructure_queue");
Tyler Chatowe51334a2019-01-20 16:58:16 -080021
Theo Bafrali00e42272019-02-12 01:07:46 -080022 using PotAndAbsoluteEncoderSubsystem =
23 ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem<
24 ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator,
25 ::frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus>;
26 using AbsoluteEncoderSubsystem =
27 ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem<
28 ::frc971::zeroing::AbsoluteEncoderZeroingEstimator,
29 ::frc971::control_loops::AbsoluteEncoderProfiledJointStatus>;
30
Theo Bafrali09517b92019-02-16 15:59:17 -080031 const PotAndAbsoluteEncoderSubsystem &elevator() const { return elevator_; }
32 const PotAndAbsoluteEncoderSubsystem &wrist() const { return wrist_; }
33 const AbsoluteEncoderSubsystem &intake() const { return intake_; }
34 const PotAndAbsoluteEncoderSubsystem &stilts() const { return stilts_; }
Theo Bafrali00e42272019-02-12 01:07:46 -080035
Tyler Chatowe51334a2019-01-20 16:58:16 -080036 protected:
Theo Bafrali00e42272019-02-12 01:07:46 -080037 virtual void RunIteration(const SuperstructureQueue::Goal *unsafe_goal,
38 const SuperstructureQueue::Position *position,
39 SuperstructureQueue::Output *output,
40 SuperstructureQueue::Status *status) override;
Tyler Chatowe51334a2019-01-20 16:58:16 -080041
42 private:
Theo Bafrali00e42272019-02-12 01:07:46 -080043 PotAndAbsoluteEncoderSubsystem elevator_;
44 PotAndAbsoluteEncoderSubsystem wrist_;
45 AbsoluteEncoderSubsystem intake_;
46 PotAndAbsoluteEncoderSubsystem stilts_;
47
48 CollisionAvoidance collision_avoidance_;
Tyler Chatowe51334a2019-01-20 16:58:16 -080049
Theo Bafrali09517b92019-02-16 15:59:17 -080050 static constexpr double kMinIntakeAngleForRollers = -0.7;
51
Tyler Chatowe51334a2019-01-20 16:58:16 -080052 DISALLOW_COPY_AND_ASSIGN(Superstructure);
53};
54
55} // namespace superstructure
56} // namespace control_loops
57} // namespace y2019
58
Austin Schuh55a13dc2019-01-27 22:39:03 -080059#endif // Y2019_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_