blob: b3ab37e06a63561bbee18e52d3369231da805889 [file] [log] [blame]
Niko Sohmers3860f8a2024-01-12 21:05:19 -08001#ifndef Y2024_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_
2#define Y2024_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_
3
4#include "aos/events/event_loop.h"
5#include "aos/json_to_flatbuffer.h"
6#include "frc971/constants/constants_sender_lib.h"
7#include "frc971/control_loops/control_loop.h"
8#include "frc971/control_loops/drivetrain/drivetrain_can_position_generated.h"
9#include "frc971/control_loops/drivetrain/drivetrain_status_generated.h"
10#include "frc971/zeroing/absolute_encoder.h"
11#include "frc971/zeroing/pot_and_absolute_encoder.h"
12#include "y2024/constants.h"
13#include "y2024/constants/constants_generated.h"
14#include "y2024/control_loops/superstructure/superstructure_goal_generated.h"
15#include "y2024/control_loops/superstructure/superstructure_output_generated.h"
16#include "y2024/control_loops/superstructure/superstructure_position_generated.h"
17#include "y2024/control_loops/superstructure/superstructure_status_generated.h"
18
Maxwell Henderson09a4b022024-01-19 21:39:51 -080019namespace y2024::control_loops::superstructure {
Niko Sohmers3860f8a2024-01-12 21:05:19 -080020
21class Superstructure
22 : public ::frc971::controls::ControlLoop<Goal, Position, Status, Output> {
23 public:
24 explicit Superstructure(::aos::EventLoop *event_loop,
25 std::shared_ptr<const constants::Values> values,
26 const ::std::string &name = "/superstructure");
27
28 double robot_velocity() const;
29
30 protected:
31 virtual void RunIteration(const Goal *unsafe_goal, const Position *position,
32 aos::Sender<Output>::Builder *output,
33 aos::Sender<Status>::Builder *status) override;
34
35 private:
36 std::shared_ptr<const constants::Values> values_;
37 frc971::constants::ConstantsFetcher<Constants> constants_fetcher_;
38
39 aos::Fetcher<frc971::control_loops::drivetrain::Status>
40 drivetrain_status_fetcher_;
41 aos::Fetcher<aos::JoystickState> joystick_state_fetcher_;
42
43 aos::Alliance alliance_ = aos::Alliance::kInvalid;
44
45 DISALLOW_COPY_AND_ASSIGN(Superstructure);
46};
47
Maxwell Henderson09a4b022024-01-19 21:39:51 -080048} // namespace y2024::control_loops::superstructure
Niko Sohmers3860f8a2024-01-12 21:05:19 -080049
50#endif // Y2024_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_