blob: 6796c942c69ad73efc9a30bbef36fbf5bd06a70e [file] [log] [blame]
Niko Sohmers3860f8a2024-01-12 21:05:19 -08001#ifndef Y2024_AUTONOMOUS_AUTONOMOUS_ACTOR_H_
2#define Y2024_AUTONOMOUS_AUTONOMOUS_ACTOR_H_
3
4#include "aos/actions/actions.h"
5#include "aos/actions/actor.h"
Filip Kujawa58ffbf32024-02-24 18:28:34 -08006#include "frc971/autonomous/user_button_localized_autonomous_actor.h"
Niko Sohmers3860f8a2024-01-12 21:05:19 -08007#include "frc971/control_loops/control_loops_generated.h"
8#include "frc971/control_loops/drivetrain/drivetrain_config.h"
9#include "frc971/control_loops/drivetrain/localizer_generated.h"
10#include "y2024/autonomous/auto_splines.h"
Filip Kujawa58ffbf32024-02-24 18:28:34 -080011#include "y2024/control_loops/superstructure/superstructure_goal_static.h"
12#include "y2024/control_loops/superstructure/superstructure_status_static.h"
Niko Sohmers3860f8a2024-01-12 21:05:19 -080013
Maxwell Henderson09a4b022024-01-19 21:39:51 -080014namespace y2024::autonomous {
Niko Sohmers3860f8a2024-01-12 21:05:19 -080015
Filip Kujawa58ffbf32024-02-24 18:28:34 -080016class AutonomousActor
17 : public ::frc971::autonomous::UserButtonLocalizedAutonomousActor {
Niko Sohmers3860f8a2024-01-12 21:05:19 -080018 public:
19 explicit AutonomousActor(::aos::EventLoop *event_loop);
20
Niko Sohmers3860f8a2024-01-12 21:05:19 -080021 private:
Filip Kujawa58ffbf32024-02-24 18:28:34 -080022 void set_intake_goal(control_loops::superstructure::IntakeGoal intake_goal) {
23 intake_goal_ = intake_goal;
24 }
25 void set_note_goal(control_loops::superstructure::NoteGoal note_goal) {
26 note_goal_ = note_goal;
27 }
28 void set_auto_aim(bool auto_aim) { auto_aim_ = auto_aim; }
29 void set_fire(bool fire) { fire_ = fire; }
30 void set_preloaded(bool preloaded) { preloaded_ = preloaded; }
31
32 bool Run(const ::frc971::autonomous::AutonomousActionParams *params) override;
33 void Replan() override;
34 void SendStartingPosition(const Eigen::Vector3d &start) override;
35 void Reset() override;
36
37 void SplineAuto();
Niko Sohmers3860f8a2024-01-12 21:05:19 -080038 void SendSuperstructureGoal();
39
Filip Kujawa58ffbf32024-02-24 18:28:34 -080040 void Intake();
41 void Aim();
42 void Shoot();
Niko Sohmers3860f8a2024-01-12 21:05:19 -080043
Filip Kujawa58ffbf32024-02-24 18:28:34 -080044 [[nodiscard]] bool WaitForPreloaded();
Niko Sohmers3860f8a2024-01-12 21:05:19 -080045
46 aos::Sender<frc971::control_loops::drivetrain::LocalizerControl>
47 localizer_control_sender_;
Niko Sohmers3860f8a2024-01-12 21:05:19 -080048
Filip Kujawa58ffbf32024-02-24 18:28:34 -080049 aos::Sender<control_loops::superstructure::GoalStatic>
50 superstructure_goal_sender_;
Niko Sohmers3860f8a2024-01-12 21:05:19 -080051
Niko Sohmers3860f8a2024-01-12 21:05:19 -080052 aos::Fetcher<y2024::control_loops::superstructure::Status>
53 superstructure_status_fetcher_;
54
Filip Kujawa58ffbf32024-02-24 18:28:34 -080055 AutonomousSplines auto_splines_;
56
Niko Sohmers3860f8a2024-01-12 21:05:19 -080057 std::optional<SplineHandle> test_spline_;
58
Filip Kujawa58ffbf32024-02-24 18:28:34 -080059 control_loops::superstructure::IntakeGoal intake_goal_ =
60 control_loops::superstructure::IntakeGoal::NONE;
61
62 control_loops::superstructure::NoteGoal note_goal_ =
63 control_loops::superstructure::NoteGoal::NONE;
64
65 bool auto_aim_ = false;
66 bool fire_ = false;
67 bool preloaded_ = false;
Niko Sohmers3860f8a2024-01-12 21:05:19 -080068};
69
Maxwell Henderson09a4b022024-01-19 21:39:51 -080070} // namespace y2024::autonomous
Niko Sohmers3860f8a2024-01-12 21:05:19 -080071
Filip Kujawa58ffbf32024-02-24 18:28:34 -080072#endif // Y2024_AUTONOMOUS_AUTONOMOUS_ACTOR_H_