blob: 0740de3796f386c495222457c1d58d10f4c21de5 [file] [log] [blame]
Maxwell Hendersonad312342023-01-10 12:07:47 -08001#ifndef Y2023_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_
2#define Y2023_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 "y2023/constants.h"
8#include "y2023/control_loops/superstructure/superstructure_goal_generated.h"
9#include "y2023/control_loops/superstructure/superstructure_output_generated.h"
10#include "y2023/control_loops/superstructure/superstructure_position_generated.h"
11#include "y2023/control_loops/superstructure/superstructure_status_generated.h"
12
13namespace y2023 {
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 double robot_velocity() const;
35
36 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:
42 std::shared_ptr<const constants::Values> values_;
43
44 aos::Fetcher<frc971::control_loops::drivetrain::Status>
45 drivetrain_status_fetcher_;
46 aos::Fetcher<aos::JoystickState> joystick_state_fetcher_;
47
48 aos::Alliance alliance_ = aos::Alliance::kInvalid;
49
50 DISALLOW_COPY_AND_ASSIGN(Superstructure);
51};
52
53} // namespace superstructure
54} // namespace control_loops
55} // namespace y2023
56
57#endif // Y2023_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_