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