blob: 3ec82fac31d59fddfc90fd1de2b0fa17a8aa7823 [file] [log] [blame]
Austin Schuhbfb04122019-05-22 21:16:51 -07001#ifndef Y2014_ACTORS_AUTONOMOUS_ACTOR_H_
2#define Y2014_ACTORS_AUTONOMOUS_ACTOR_H_
3
4#include <chrono>
5#include <memory>
6
7#include "aos/actions/actions.h"
8#include "aos/actions/actor.h"
9#include "frc971/autonomous/base_autonomous_actor.h"
Austin Schuhbfb04122019-05-22 21:16:51 -070010#include "frc971/control_loops/drivetrain/drivetrain_config.h"
Austin Schuh1bf8a212019-05-26 22:13:14 -070011#include "y2014/actors/shoot_actor.h"
Alex Perrycb7da4b2019-08-28 19:35:56 -070012#include "y2014/control_loops/shooter/shooter_goal_generated.h"
13#include "y2014/queues/auto_mode_generated.h"
14#include "y2014/queues/hot_goal_generated.h"
Austin Schuhbfb04122019-05-22 21:16:51 -070015
Stephan Pleinesd99b1ee2024-02-02 20:56:44 -080016namespace y2014::actors {
Austin Schuhbfb04122019-05-22 21:16:51 -070017
18class AutonomousActor : public ::frc971::autonomous::BaseAutonomousActor {
19 public:
Austin Schuh1bf8a212019-05-26 22:13:14 -070020 explicit AutonomousActor(::aos::EventLoop *event_loop);
Austin Schuhbfb04122019-05-22 21:16:51 -070021
22 bool RunAction(
Alex Perrycb7da4b2019-08-28 19:35:56 -070023 const ::frc971::autonomous::AutonomousActionParams *params) override;
Austin Schuhbfb04122019-05-22 21:16:51 -070024
25 private:
26 void Reset() {
27 InitializeEncoders();
28 ResetDrivetrain();
29 }
30
31 void PositionClawVertically(double intake_power, double centering_power);
32 void PositionClawBackIntake();
33 void PositionClawUpClosed();
34 void PositionClawForShot();
35 void SetShotPower(double power);
36 void Shoot();
37
38 bool WaitUntilClawDone();
Austin Schuha3e576b2019-05-22 21:22:23 -070039
Austin Schuh7eed2de2019-05-25 14:34:40 -070040 ::aos::Fetcher<::y2014::sensors::AutoMode> auto_mode_fetcher_;
Austin Schuha3e576b2019-05-22 21:22:23 -070041 ::aos::Fetcher<::y2014::HotGoal> hot_goal_fetcher_;
Alex Perrycb7da4b2019-08-28 19:35:56 -070042 ::aos::Sender<::y2014::control_loops::claw::Goal> claw_goal_sender_;
43 ::aos::Fetcher<::y2014::control_loops::claw::Goal> claw_goal_fetcher_;
44 ::aos::Fetcher<::y2014::control_loops::claw::Status> claw_status_fetcher_;
45 ::aos::Sender<::y2014::control_loops::shooter::Goal> shooter_goal_sender_;
Austin Schuh1bf8a212019-05-26 22:13:14 -070046
47 actors::ShootActor::Factory shoot_action_factory_;
Austin Schuhbfb04122019-05-22 21:16:51 -070048};
49
Stephan Pleinesd99b1ee2024-02-02 20:56:44 -080050} // namespace y2014::actors
Austin Schuhbfb04122019-05-22 21:16:51 -070051
52#endif // Y2014_ACTORS_AUTONOMOUS_ACTOR_H_