Comran Morshed | 2f7b467 | 2016-01-23 14:27:34 +0000 | [diff] [blame] | 1 | #ifndef Y2016_ACTORS_SUPERSTRUCTURE_ACTOR_H_ |
| 2 | #define Y2016_ACTORS_SUPERSTRUCTURE_ACTOR_H_ |
| 3 | |
| 4 | #include <memory> |
| 5 | |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 6 | #include "aos/actions/actions.h" |
Austin Schuh | 9481d0d | 2019-06-29 21:56:17 -0700 | [diff] [blame^] | 7 | #include "aos/actions/actor.h" |
Comran Morshed | 2f7b467 | 2016-01-23 14:27:34 +0000 | [diff] [blame] | 8 | #include "y2016/actors/superstructure_action.q.h" |
Austin Schuh | 9481d0d | 2019-06-29 21:56:17 -0700 | [diff] [blame^] | 9 | #include "y2016/control_loops/superstructure/superstructure.q.h" |
Comran Morshed | 2f7b467 | 2016-01-23 14:27:34 +0000 | [diff] [blame] | 10 | |
| 11 | namespace y2016 { |
| 12 | namespace actors { |
| 13 | |
| 14 | class SuperstructureActor |
| 15 | : public ::aos::common::actions::ActorBase<SuperstructureActionQueueGroup> { |
| 16 | public: |
Austin Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 17 | typedef ::aos::common::actions::TypedActionFactory< |
| 18 | SuperstructureActionQueueGroup> |
| 19 | Factory; |
| 20 | |
| 21 | explicit SuperstructureActor(::aos::EventLoop *event_loop); |
| 22 | |
| 23 | static Factory MakeFactory(::aos::EventLoop *event_loop) { |
| 24 | return Factory(event_loop, ".y2016.actors.superstructure_action"); |
| 25 | } |
Comran Morshed | 2f7b467 | 2016-01-23 14:27:34 +0000 | [diff] [blame] | 26 | |
Austin Schuh | 9481d0d | 2019-06-29 21:56:17 -0700 | [diff] [blame^] | 27 | private: |
| 28 | ::aos::Sender<::y2016::control_loops::SuperstructureQueue::Goal> |
| 29 | superstructure_goal_sender_; |
| 30 | ::aos::Fetcher<::y2016::control_loops::SuperstructureQueue::Status> |
| 31 | superstructure_status_fetcher_; |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 32 | // Internal struct holding superstructure goals sent by autonomous to the |
| 33 | // loop. |
| 34 | struct SuperstructureGoal { |
| 35 | double intake; |
| 36 | double shoulder; |
| 37 | double wrist; |
| 38 | }; |
| 39 | SuperstructureGoal superstructure_goal_; |
| 40 | bool RunAction(const actors::SuperstructureActionParams ¶ms) override; |
Austin Schuh | fef64ac | 2016-04-24 19:08:01 -0700 | [diff] [blame] | 41 | void MoveSuperstructure(double shoulder, double shooter, bool unfold_climber); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 42 | void WaitForSuperstructure(); |
| 43 | bool SuperstructureProfileDone(); |
| 44 | bool SuperstructureDone(); |
Comran Morshed | 2f7b467 | 2016-01-23 14:27:34 +0000 | [diff] [blame] | 45 | }; |
| 46 | |
Comran Morshed | 2f7b467 | 2016-01-23 14:27:34 +0000 | [diff] [blame] | 47 | } // namespace actors |
| 48 | } // namespace y2016 |
| 49 | |
| 50 | #endif // Y2016_ACTORS_SUPERSTRUCTURE_ACTOR_H_ |