blob: 21d427a59603f60ab8b961274b54cfc891c4010b [file] [log] [blame]
Niko Sohmersc4d2c502024-02-19 19:35:35 -08001#ifndef Y2024_CONTROL_LOOPS_SUPERSTRUCTURE_AIMING_H_
2#define Y2024_CONTROL_LOOPS_SUPERSTRUCTURE_AIMING_H_
3
4#include "frc971/control_loops/aiming/aiming.h"
5#include "frc971/control_loops/drivetrain/drivetrain_status_generated.h"
6#include "frc971/control_loops/pose.h"
7#include "frc971/control_loops/static_zeroing_single_dof_profiled_subsystem.h"
8#include "frc971/shooter_interpolation/interpolation.h"
9#include "y2024/constants.h"
10#include "y2024/constants/constants_generated.h"
11#include "y2024/control_loops/drivetrain/drivetrain_base.h"
12#include "y2024/control_loops/superstructure/superstructure_status_generated.h"
13
14using y2024::control_loops::superstructure::AimerStatus;
15
16namespace y2024::control_loops::superstructure {
17
18class Aimer {
19 public:
20 Aimer(aos::EventLoop *event_loop, const Constants *robot_constants);
21
22 void Update(
23 const frc971::control_loops::drivetrain::Status *status,
24 frc971::control_loops::aiming::ShotMode shot_mode,
25 frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemGoalStatic
26 *turret_goal);
27
28 double DistanceToGoal() const { return current_goal_.virtual_shot_distance; }
29
30 flatbuffers::Offset<AimerStatus> PopulateStatus(
31 flatbuffers::FlatBufferBuilder *fbb) const;
32
33 private:
34 aos::EventLoop *event_loop_;
35
36 const Constants *robot_constants_;
37
38 frc971::control_loops::drivetrain::DrivetrainConfig<double>
39 drivetrain_config_;
40
41 frc971::shooter_interpolation::InterpolationTable<
42 y2024::constants::Values::ShotParams>
43 interpolation_table_;
44
45 aos::Fetcher<aos::JoystickState> joystick_state_fetcher_;
46
47 frc971::control_loops::aiming::TurretGoal current_goal_;
48};
49
50} // namespace y2024::control_loops::superstructure
51#endif // Y2024_CONTROL_LOOPS_SUPERSTRUCTURE_TURRET_AIMING_H_