blob: 6603080c31a93af7eca66e90f45250289a8edb1a [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"
6#include "frc971/autonomous/base_autonomous_actor.h"
7#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"
11#include "y2024/control_loops/superstructure/superstructure_goal_generated.h"
12#include "y2024/control_loops/superstructure/superstructure_status_generated.h"
13
14namespace y2024 {
15namespace autonomous {
16
17class AutonomousActor : public ::frc971::autonomous::BaseAutonomousActor {
18 public:
19 explicit AutonomousActor(::aos::EventLoop *event_loop);
20
21 bool RunAction(
22 const ::frc971::autonomous::AutonomousActionParams *params) override;
23
24 private:
25 void SendSuperstructureGoal();
26
27 void Reset();
28
29 void SendStartingPosition(const Eigen::Vector3d &start);
30 void MaybeSendStartingPosition();
31 void SplineAuto();
32 void Replan();
33
34 aos::Sender<frc971::control_loops::drivetrain::LocalizerControl>
35 localizer_control_sender_;
36 aos::Fetcher<aos::JoystickState> joystick_state_fetcher_;
37 aos::Fetcher<aos::RobotState> robot_state_fetcher_;
38
39 aos::TimerHandler *replan_timer_;
40 aos::TimerHandler *button_poll_;
41
42 aos::Alliance alliance_ = aos::Alliance::kInvalid;
43 AutonomousSplines auto_splines_;
44 bool user_indicated_safe_to_reset_ = false;
45 bool sent_starting_position_ = false;
46
47 bool is_planned_ = false;
48
49 std::optional<Eigen::Vector3d> starting_position_;
50
51 bool preloaded_ = false;
52
53 aos::Sender<control_loops::superstructure::Goal> superstructure_goal_sender_;
54 aos::Fetcher<y2024::control_loops::superstructure::Status>
55 superstructure_status_fetcher_;
56
57 std::optional<SplineHandle> test_spline_;
58
59 // List of arm angles from arm::PointsList
60 const ::std::vector<::Eigen::Matrix<double, 3, 1>> points_;
61};
62
63} // namespace autonomous
64} // namespace y2024
65
66#endif // Y2024_AUTONOMOUS_AUTONOMOUS_ACTOR_H_