Austin Schuh | bfb0412 | 2019-05-22 21:16:51 -0700 | [diff] [blame] | 1 | #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 Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 12 | #include "y2014/actors/shoot_actor.h" |
Austin Schuh | b2461f4 | 2019-06-29 18:17:06 -0700 | [diff] [blame] | 13 | #include "y2014/control_loops/shooter/shooter.q.h" |
Austin Schuh | 7eed2de | 2019-05-25 14:34:40 -0700 | [diff] [blame] | 14 | #include "y2014/queues/auto_mode.q.h" |
Austin Schuh | a3e576b | 2019-05-22 21:22:23 -0700 | [diff] [blame] | 15 | #include "y2014/queues/hot_goal.q.h" |
Austin Schuh | bfb0412 | 2019-05-22 21:16:51 -0700 | [diff] [blame] | 16 | |
| 17 | namespace y2014 { |
| 18 | namespace actors { |
| 19 | |
| 20 | class AutonomousActor : public ::frc971::autonomous::BaseAutonomousActor { |
| 21 | public: |
Austin Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 22 | explicit AutonomousActor(::aos::EventLoop *event_loop); |
Austin Schuh | bfb0412 | 2019-05-22 21:16:51 -0700 | [diff] [blame] | 23 | |
| 24 | bool RunAction( |
| 25 | const ::frc971::autonomous::AutonomousActionParams ¶ms) 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 Schuh | a3e576b | 2019-05-22 21:22:23 -0700 | [diff] [blame] | 41 | |
Austin Schuh | 7eed2de | 2019-05-25 14:34:40 -0700 | [diff] [blame] | 42 | ::aos::Fetcher<::y2014::sensors::AutoMode> auto_mode_fetcher_; |
Austin Schuh | a3e576b | 2019-05-22 21:22:23 -0700 | [diff] [blame] | 43 | ::aos::Fetcher<::y2014::HotGoal> hot_goal_fetcher_; |
Austin Schuh | b2461f4 | 2019-06-29 18:17:06 -0700 | [diff] [blame] | 44 | ::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 Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 50 | |
| 51 | actors::ShootActor::Factory shoot_action_factory_; |
Austin Schuh | bfb0412 | 2019-05-22 21:16:51 -0700 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | } // namespace actors |
| 55 | } // namespace y2014 |
| 56 | |
| 57 | #endif // Y2014_ACTORS_AUTONOMOUS_ACTOR_H_ |