Filip Kujawa | ef68715 | 2023-11-14 22:11:32 -0800 | [diff] [blame] | 1 | #ifndef Y2023_BOT3_AUTONOMOUS_AUTONOMOUS_ACTOR_H_ |
| 2 | #define Y2023_BOT3_AUTONOMOUS_AUTONOMOUS_ACTOR_H_ |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 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 "y2023_bot3/autonomous/auto_splines.h" |
| 11 | #include "y2023_bot3/control_loops/superstructure/superstructure_goal_generated.h" |
| 12 | #include "y2023_bot3/control_loops/superstructure/superstructure_status_generated.h" |
| 13 | |
Stephan Pleines | d99b1ee | 2024-02-02 20:56:44 -0800 | [diff] [blame^] | 14 | namespace y2023_bot3::autonomous { |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 15 | |
| 16 | class AutonomousActor : public ::frc971::autonomous::BaseAutonomousActor { |
| 17 | public: |
| 18 | explicit AutonomousActor(::aos::EventLoop *event_loop); |
| 19 | |
| 20 | bool RunAction( |
| 21 | const ::frc971::autonomous::AutonomousActionParams *params) override; |
| 22 | |
| 23 | private: |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 24 | void SendSuperstructureGoal(); |
| 25 | |
| 26 | void Reset(); |
| 27 | |
| 28 | void SendStartingPosition(const Eigen::Vector3d &start); |
| 29 | void MaybeSendStartingPosition(); |
| 30 | void Replan(); |
Filip Kujawa | ef68715 | 2023-11-14 22:11:32 -0800 | [diff] [blame] | 31 | void ChargedUp(); |
| 32 | void ChargedUpMiddle(); |
| 33 | void OnePieceMiddle(); |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 34 | |
| 35 | aos::Sender<frc971::control_loops::drivetrain::LocalizerControl> |
| 36 | localizer_control_sender_; |
| 37 | aos::Fetcher<aos::JoystickState> joystick_state_fetcher_; |
| 38 | aos::Fetcher<aos::RobotState> robot_state_fetcher_; |
| 39 | |
| 40 | aos::TimerHandler *replan_timer_; |
| 41 | aos::TimerHandler *button_poll_; |
| 42 | |
| 43 | aos::Alliance alliance_ = aos::Alliance::kInvalid; |
| 44 | AutonomousSplines auto_splines_; |
| 45 | bool user_indicated_safe_to_reset_ = false; |
| 46 | bool sent_starting_position_ = false; |
| 47 | |
| 48 | bool is_planned_ = false; |
| 49 | |
| 50 | std::optional<Eigen::Vector3d> starting_position_; |
| 51 | |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 52 | aos::Sender<control_loops::superstructure::Goal> superstructure_goal_sender_; |
| 53 | aos::Fetcher<y2023_bot3::control_loops::superstructure::Status> |
| 54 | superstructure_status_fetcher_; |
| 55 | |
| 56 | std::optional<SplineHandle> test_spline_; |
Filip Kujawa | ef68715 | 2023-11-14 22:11:32 -0800 | [diff] [blame] | 57 | std::optional<std::array<SplineHandle, 4>> charged_up_splines_; |
| 58 | std::optional<std::array<SplineHandle, 1>> charged_up_middle_splines_; |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
Stephan Pleines | d99b1ee | 2024-02-02 20:56:44 -0800 | [diff] [blame^] | 61 | } // namespace y2023_bot3::autonomous |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 62 | |
| 63 | #endif // Y2023_AUTONOMOUS_AUTONOMOUS_ACTOR_H_ |