blob: ab84db5420bb64ae704262114b8aac099aea7951 [file] [log] [blame]
Comran Morshed2f7b4672016-01-23 14:27:34 +00001#ifndef Y2016_ACTORS_SUPERSTRUCTURE_ACTOR_H_
2#define Y2016_ACTORS_SUPERSTRUCTURE_ACTOR_H_
3
4#include <memory>
5
John Park33858a32018-09-28 23:05:48 -07006#include "aos/actions/actions.h"
Austin Schuh9481d0d2019-06-29 21:56:17 -07007#include "aos/actions/actor.h"
Comran Morshed2f7b4672016-01-23 14:27:34 +00008#include "y2016/actors/superstructure_action.q.h"
Austin Schuh9481d0d2019-06-29 21:56:17 -07009#include "y2016/control_loops/superstructure/superstructure.q.h"
Comran Morshed2f7b4672016-01-23 14:27:34 +000010
11namespace y2016 {
12namespace actors {
13
14class SuperstructureActor
15 : public ::aos::common::actions::ActorBase<SuperstructureActionQueueGroup> {
16 public:
Austin Schuh1bf8a212019-05-26 22:13:14 -070017 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 Morshed2f7b4672016-01-23 14:27:34 +000026
Austin Schuh9481d0d2019-06-29 21:56:17 -070027 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 Vandenberg9cc9ab62016-04-20 21:27:47 -070032 // 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 &params) override;
Austin Schuhfef64ac2016-04-24 19:08:01 -070041 void MoveSuperstructure(double shoulder, double shooter, bool unfold_climber);
Diana Vandenberg9cc9ab62016-04-20 21:27:47 -070042 void WaitForSuperstructure();
43 bool SuperstructureProfileDone();
44 bool SuperstructureDone();
Comran Morshed2f7b4672016-01-23 14:27:34 +000045};
46
Comran Morshed2f7b4672016-01-23 14:27:34 +000047} // namespace actors
48} // namespace y2016
49
50#endif // Y2016_ACTORS_SUPERSTRUCTURE_ACTOR_H_