blob: 91f80b463fbe10c64e7600b32b7d7a2adacfed68 [file] [log] [blame]
Henry Speiser354d2782022-07-22 13:56:48 -07001#ifndef Y2022_BOT3_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_
2#define Y2022_BOT3_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_
3
4#include "aos/events/event_loop.h"
5#include "frc971/control_loops/control_loop.h"
6#include "frc971/control_loops/drivetrain/drivetrain_status_generated.h"
7#include "y2022_bot3/constants.h"
8#include "y2022_bot3/control_loops/superstructure/superstructure_goal_generated.h"
9#include "y2022_bot3/control_loops/superstructure/superstructure_output_generated.h"
10#include "y2022_bot3/control_loops/superstructure/superstructure_position_generated.h"
11#include "y2022_bot3/control_loops/superstructure/superstructure_status_generated.h"
12
13namespace y2022_bot3 {
14namespace control_loops {
15namespace superstructure {
16
17class Superstructure
18 : public ::frc971::controls::ControlLoop<Goal, Position, Status, Output> {
19 public:
20 using RelativeEncoderSubsystem =
21 ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem<
22 ::frc971::zeroing::RelativeEncoderZeroingEstimator,
23 ::frc971::control_loops::RelativeEncoderProfiledJointStatus>;
24
25 using PotAndAbsoluteEncoderSubsystem =
26 ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem<
27 ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator,
28 ::frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus>;
29
30 explicit Superstructure(::aos::EventLoop *event_loop,
31 std::shared_ptr<const constants::Values> values,
32 const ::std::string &name = "/superstructure");
33
34 protected:
35 virtual void RunIteration(const Goal *unsafe_goal, const Position *position,
36 aos::Sender<Output>::Builder *output,
37 aos::Sender<Status>::Builder *status) override;
38
39 private:
40 std::shared_ptr<const constants::Values> values_;
41
42 aos::Fetcher<frc971::control_loops::drivetrain::Status>
43 drivetrain_status_fetcher_;
44 aos::Fetcher<aos::JoystickState> joystick_state_fetcher_;
45
46 aos::Alliance alliance_ = aos::Alliance::kInvalid;
47
48 DISALLOW_COPY_AND_ASSIGN(Superstructure);
49};
50
51} // namespace superstructure
52} // namespace control_loops
53} // namespace y2022_bot3
54
55#endif // Y2022_BOT3_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_