Add y2024 Autonomous Actor Functions
Signed-off-by: Niko Sohmers <nikolai@sohmers.com>
Change-Id: I6f5392055e3cde1e86a53edca7ae8c3d0b2a7cc3
diff --git a/y2024/autonomous/autonomous_actor.h b/y2024/autonomous/autonomous_actor.h
index c3d7d79..6796c94 100644
--- a/y2024/autonomous/autonomous_actor.h
+++ b/y2024/autonomous/autonomous_actor.h
@@ -3,62 +3,70 @@
#include "aos/actions/actions.h"
#include "aos/actions/actor.h"
-#include "frc971/autonomous/base_autonomous_actor.h"
+#include "frc971/autonomous/user_button_localized_autonomous_actor.h"
#include "frc971/control_loops/control_loops_generated.h"
#include "frc971/control_loops/drivetrain/drivetrain_config.h"
#include "frc971/control_loops/drivetrain/localizer_generated.h"
#include "y2024/autonomous/auto_splines.h"
-#include "y2024/control_loops/superstructure/superstructure_goal_generated.h"
-#include "y2024/control_loops/superstructure/superstructure_status_generated.h"
+#include "y2024/control_loops/superstructure/superstructure_goal_static.h"
+#include "y2024/control_loops/superstructure/superstructure_status_static.h"
namespace y2024::autonomous {
-class AutonomousActor : public ::frc971::autonomous::BaseAutonomousActor {
+class AutonomousActor
+ : public ::frc971::autonomous::UserButtonLocalizedAutonomousActor {
public:
explicit AutonomousActor(::aos::EventLoop *event_loop);
- bool RunAction(
- const ::frc971::autonomous::AutonomousActionParams *params) override;
-
private:
+ void set_intake_goal(control_loops::superstructure::IntakeGoal intake_goal) {
+ intake_goal_ = intake_goal;
+ }
+ void set_note_goal(control_loops::superstructure::NoteGoal note_goal) {
+ note_goal_ = note_goal;
+ }
+ void set_auto_aim(bool auto_aim) { auto_aim_ = auto_aim; }
+ void set_fire(bool fire) { fire_ = fire; }
+ void set_preloaded(bool preloaded) { preloaded_ = preloaded; }
+
+ bool Run(const ::frc971::autonomous::AutonomousActionParams *params) override;
+ void Replan() override;
+ void SendStartingPosition(const Eigen::Vector3d &start) override;
+ void Reset() override;
+
+ void SplineAuto();
void SendSuperstructureGoal();
- void Reset();
+ void Intake();
+ void Aim();
+ void Shoot();
- void SendStartingPosition(const Eigen::Vector3d &start);
- void MaybeSendStartingPosition();
- void SplineAuto();
- void Replan();
+ [[nodiscard]] bool WaitForPreloaded();
aos::Sender<frc971::control_loops::drivetrain::LocalizerControl>
localizer_control_sender_;
- aos::Fetcher<aos::JoystickState> joystick_state_fetcher_;
- aos::Fetcher<aos::RobotState> robot_state_fetcher_;
- aos::TimerHandler *replan_timer_;
- aos::TimerHandler *button_poll_;
+ aos::Sender<control_loops::superstructure::GoalStatic>
+ superstructure_goal_sender_;
- aos::Alliance alliance_ = aos::Alliance::kInvalid;
- AutonomousSplines auto_splines_;
- bool user_indicated_safe_to_reset_ = false;
- bool sent_starting_position_ = false;
-
- bool is_planned_ = false;
-
- std::optional<Eigen::Vector3d> starting_position_;
-
- bool preloaded_ = false;
-
- aos::Sender<control_loops::superstructure::Goal> superstructure_goal_sender_;
aos::Fetcher<y2024::control_loops::superstructure::Status>
superstructure_status_fetcher_;
+ AutonomousSplines auto_splines_;
+
std::optional<SplineHandle> test_spline_;
- // List of arm angles from arm::PointsList
- const ::std::vector<::Eigen::Matrix<double, 3, 1>> points_;
+ control_loops::superstructure::IntakeGoal intake_goal_ =
+ control_loops::superstructure::IntakeGoal::NONE;
+
+ control_loops::superstructure::NoteGoal note_goal_ =
+ control_loops::superstructure::NoteGoal::NONE;
+
+ bool auto_aim_ = false;
+ bool fire_ = false;
+ bool preloaded_ = false;
};
} // namespace y2024::autonomous
-#endif // Y2024_AUTONOMOUS_AUTONOMOUS_ACTOR_H_
+#endif // Y2024_AUTONOMOUS_AUTONOMOUS_ACTOR_H_
\ No newline at end of file