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 | |
| 14 | namespace y2023_bot3 { |
| 15 | namespace autonomous { |
| 16 | |
| 17 | class 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: |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 25 | void SendSuperstructureGoal(); |
| 26 | |
| 27 | void Reset(); |
| 28 | |
| 29 | void SendStartingPosition(const Eigen::Vector3d &start); |
| 30 | void MaybeSendStartingPosition(); |
| 31 | void Replan(); |
Filip Kujawa | ef68715 | 2023-11-14 22:11:32 -0800 | [diff] [blame] | 32 | void ChargedUp(); |
| 33 | void ChargedUpMiddle(); |
| 34 | void OnePieceMiddle(); |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 35 | |
| 36 | aos::Sender<frc971::control_loops::drivetrain::LocalizerControl> |
| 37 | localizer_control_sender_; |
| 38 | aos::Fetcher<aos::JoystickState> joystick_state_fetcher_; |
| 39 | aos::Fetcher<aos::RobotState> robot_state_fetcher_; |
| 40 | |
| 41 | aos::TimerHandler *replan_timer_; |
| 42 | aos::TimerHandler *button_poll_; |
| 43 | |
| 44 | aos::Alliance alliance_ = aos::Alliance::kInvalid; |
| 45 | AutonomousSplines auto_splines_; |
| 46 | bool user_indicated_safe_to_reset_ = false; |
| 47 | bool sent_starting_position_ = false; |
| 48 | |
| 49 | bool is_planned_ = false; |
| 50 | |
| 51 | std::optional<Eigen::Vector3d> starting_position_; |
| 52 | |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 53 | aos::Sender<control_loops::superstructure::Goal> superstructure_goal_sender_; |
| 54 | aos::Fetcher<y2023_bot3::control_loops::superstructure::Status> |
| 55 | superstructure_status_fetcher_; |
| 56 | |
| 57 | std::optional<SplineHandle> test_spline_; |
Filip Kujawa | ef68715 | 2023-11-14 22:11:32 -0800 | [diff] [blame] | 58 | std::optional<std::array<SplineHandle, 4>> charged_up_splines_; |
| 59 | std::optional<std::array<SplineHandle, 1>> charged_up_middle_splines_; |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | } // namespace autonomous |
| 63 | } // namespace y2023_bot3 |
| 64 | |
| 65 | #endif // Y2023_AUTONOMOUS_AUTONOMOUS_ACTOR_H_ |