blob: e8329802308f1cceb2a61cd9f49300b2493893dd [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"
10#include "frc971/control_loops/drivetrain/drivetrain.q.h"
11#include "frc971/control_loops/drivetrain/drivetrain_config.h"
Austin Schuh1bf8a212019-05-26 22:13:14 -070012#include "y2014/actors/shoot_actor.h"
Austin Schuhb2461f42019-06-29 18:17:06 -070013#include "y2014/control_loops/shooter/shooter.q.h"
Austin Schuh7eed2de2019-05-25 14:34:40 -070014#include "y2014/queues/auto_mode.q.h"
Austin Schuha3e576b2019-05-22 21:22:23 -070015#include "y2014/queues/hot_goal.q.h"
Austin Schuhbfb04122019-05-22 21:16:51 -070016
17namespace y2014 {
18namespace actors {
19
20class AutonomousActor : public ::frc971::autonomous::BaseAutonomousActor {
21 public:
Austin Schuh1bf8a212019-05-26 22:13:14 -070022 explicit AutonomousActor(::aos::EventLoop *event_loop);
Austin Schuhbfb04122019-05-22 21:16:51 -070023
24 bool RunAction(
25 const ::frc971::autonomous::AutonomousActionParams &params) override;
26
27 private:
28 void Reset() {
29 InitializeEncoders();
30 ResetDrivetrain();
31 }
32
33 void PositionClawVertically(double intake_power, double centering_power);
34 void PositionClawBackIntake();
35 void PositionClawUpClosed();
36 void PositionClawForShot();
37 void SetShotPower(double power);
38 void Shoot();
39
40 bool WaitUntilClawDone();
Austin Schuha3e576b2019-05-22 21:22:23 -070041
Austin Schuh7eed2de2019-05-25 14:34:40 -070042 ::aos::Fetcher<::y2014::sensors::AutoMode> auto_mode_fetcher_;
Austin Schuha3e576b2019-05-22 21:22:23 -070043 ::aos::Fetcher<::y2014::HotGoal> hot_goal_fetcher_;
Austin Schuhb2461f42019-06-29 18:17:06 -070044 ::aos::Sender<::y2014::control_loops::ClawQueue::Goal> claw_goal_sender_;
45 ::aos::Fetcher<::y2014::control_loops::ClawQueue::Goal> claw_goal_fetcher_;
46 ::aos::Fetcher<::y2014::control_loops::ClawQueue::Status>
47 claw_status_fetcher_;
48 ::aos::Sender<::y2014::control_loops::ShooterQueue::Goal>
49 shooter_goal_sender_;
Austin Schuh1bf8a212019-05-26 22:13:14 -070050
51 actors::ShootActor::Factory shoot_action_factory_;
Austin Schuhbfb04122019-05-22 21:16:51 -070052};
53
54} // namespace actors
55} // namespace y2014
56
57#endif // Y2014_ACTORS_AUTONOMOUS_ACTOR_H_