blob: c9f3873c31e0a96318cb8e790fe0404f9df03ca0 [file] [log] [blame]
James Kuszmaulb1b2d8e2020-02-21 21:11:46 -08001#ifndef y2020_CONTROL_LOOPS_SUPERSTRUCTURE_TURRET_AIMING_H_
2#define y2020_CONTROL_LOOPS_SUPERSTRUCTURE_TURRET_AIMING_H_
3
4#include "aos/flatbuffers.h"
5#include "frc971/control_loops/drivetrain/drivetrain_status_generated.h"
6#include "frc971/control_loops/profiled_subsystem_generated.h"
7#include "y2020/control_loops/superstructure/superstructure_status_generated.h"
8
9namespace y2020 {
10namespace control_loops {
11namespace superstructure {
12namespace turret {
13
14// This class manages taking in drivetrain status messages and generating turret
15// goals so that it gets aimed at the goal.
16class Aimer {
17 public:
18 typedef frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemGoal
19 Goal;
20 typedef frc971::control_loops::drivetrain::Status Status;
21 Aimer();
22 void Update(const Status *status);
23 const Goal *TurretGoal() const { return &goal_.message(); }
24
25 flatbuffers::Offset<AimerStatus> PopulateStatus(
26 flatbuffers::FlatBufferBuilder *fbb) const;
27
28 private:
29 aos::FlatbufferDetachedBuffer<Goal> goal_;
30};
31
32} // namespace turret
33} // namespace superstructure
34} // namespace control_loops
35} // namespace y2020
36#endif // y2020_CONTROL_LOOPS_SUPERSTRUCTURE_TURRET_AIMING_H_