Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 1 | #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 | |
Maxwell Henderson | 09a4b02 | 2024-01-19 21:39:51 -0800 | [diff] [blame] | 14 | namespace y2024::autonomous { |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [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: |
| 24 | void SendSuperstructureGoal(); |
| 25 | |
| 26 | void Reset(); |
| 27 | |
| 28 | void SendStartingPosition(const Eigen::Vector3d &start); |
| 29 | void MaybeSendStartingPosition(); |
| 30 | void SplineAuto(); |
| 31 | void Replan(); |
| 32 | |
| 33 | aos::Sender<frc971::control_loops::drivetrain::LocalizerControl> |
| 34 | localizer_control_sender_; |
| 35 | aos::Fetcher<aos::JoystickState> joystick_state_fetcher_; |
| 36 | aos::Fetcher<aos::RobotState> robot_state_fetcher_; |
| 37 | |
| 38 | aos::TimerHandler *replan_timer_; |
| 39 | aos::TimerHandler *button_poll_; |
| 40 | |
| 41 | aos::Alliance alliance_ = aos::Alliance::kInvalid; |
| 42 | AutonomousSplines auto_splines_; |
| 43 | bool user_indicated_safe_to_reset_ = false; |
| 44 | bool sent_starting_position_ = false; |
| 45 | |
| 46 | bool is_planned_ = false; |
| 47 | |
| 48 | std::optional<Eigen::Vector3d> starting_position_; |
| 49 | |
| 50 | bool preloaded_ = false; |
| 51 | |
| 52 | aos::Sender<control_loops::superstructure::Goal> superstructure_goal_sender_; |
| 53 | aos::Fetcher<y2024::control_loops::superstructure::Status> |
| 54 | superstructure_status_fetcher_; |
| 55 | |
| 56 | std::optional<SplineHandle> test_spline_; |
| 57 | |
| 58 | // List of arm angles from arm::PointsList |
| 59 | const ::std::vector<::Eigen::Matrix<double, 3, 1>> points_; |
| 60 | }; |
| 61 | |
Maxwell Henderson | 09a4b02 | 2024-01-19 21:39:51 -0800 | [diff] [blame] | 62 | } // namespace y2024::autonomous |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 63 | |
| 64 | #endif // Y2024_AUTONOMOUS_AUTONOMOUS_ACTOR_H_ |