blob: 2bc0cdad0ead0ce15b97df4e6ec9638ce16155b5 [file] [log] [blame]
Stephan Massaltd021f972020-01-05 20:41:23 -08001#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"
John Park0a245a02020-02-02 14:10:15 -080011#include "y2020/control_loops/superstructure/climber.h"
Stephan Massaltd021f972020-01-05 20:41:23 -080012
13namespace y2020 {
14namespace control_loops {
15namespace superstructure {
16
17class Superstructure
18 : public ::aos::controls::ControlLoop<Goal, Position, Status, Output> {
19 public:
20 explicit Superstructure(::aos::EventLoop *event_loop,
21 const ::std::string &name = "/superstructure");
22
Kai Tinkessfb460372020-02-08 14:05:48 -080023 using PotAndAbsoluteEncoderSubsystem =
24 ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem<
25 ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator,
26 ::frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus>;
Sabina Daviscf08b152020-01-31 22:12:09 -080027 using AbsoluteEncoderSubsystem =
28 ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem<
29 ::frc971::zeroing::AbsoluteEncoderZeroingEstimator,
30 ::frc971::control_loops::AbsoluteEncoderProfiledJointStatus>;
31
32 const AbsoluteEncoderSubsystem &hood() const { return hood_; }
Sabina Davis0f2d38c2020-02-08 17:01:21 -080033 const AbsoluteEncoderSubsystem &intake_joint() const { return intake_joint_; }
Kai Tinkessfb460372020-02-08 14:05:48 -080034 const PotAndAbsoluteEncoderSubsystem &turret() const { return turret_; }
Sabina Daviscf08b152020-01-31 22:12:09 -080035
Stephan Massaltd021f972020-01-05 20:41:23 -080036 protected:
37 virtual void RunIteration(const Goal *unsafe_goal, const Position *position,
38 aos::Sender<Output>::Builder *output,
39 aos::Sender<Status>::Builder *status) override;
40
41 private:
Sabina Daviscf08b152020-01-31 22:12:09 -080042 AbsoluteEncoderSubsystem hood_;
Sabina Davis0f2d38c2020-02-08 17:01:21 -080043 AbsoluteEncoderSubsystem intake_joint_;
Kai Tinkessfb460372020-02-08 14:05:48 -080044 PotAndAbsoluteEncoderSubsystem turret_;
Sabina Daviscf08b152020-01-31 22:12:09 -080045
John Park0a245a02020-02-02 14:10:15 -080046 Climber climber_;
Stephan Massaltd021f972020-01-05 20:41:23 -080047 DISALLOW_COPY_AND_ASSIGN(Superstructure);
48};
49
50} // namespace superstructure
51} // namespace control_loops
52} // namespace y2020
53
54#endif // y2020_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_