blob: 3f28c7e6eafcbceb413c9ddc18c4554715060750 [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"
Alex Perrycb7da4b2019-08-28 19:35:56 -07008#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 Morshed2f7b4672016-01-23 14:27:34 +000011
Stephan Pleinesd99b1ee2024-02-02 20:56:44 -080012namespace y2016::actors {
Comran Morshed2f7b4672016-01-23 14:27:34 +000013
14class SuperstructureActor
Alex Perrycb7da4b2019-08-28 19:35:56 -070015 : public ::aos::common::actions::ActorBase<superstructure_action::Goal> {
Comran Morshed2f7b4672016-01-23 14:27:34 +000016 public:
Austin Schuh1bf8a212019-05-26 22:13:14 -070017 typedef ::aos::common::actions::TypedActionFactory<
Alex Perrycb7da4b2019-08-28 19:35:56 -070018 superstructure_action::Goal>
Austin Schuh1bf8a212019-05-26 22:13:14 -070019 Factory;
20
21 explicit SuperstructureActor(::aos::EventLoop *event_loop);
22
23 static Factory MakeFactory(::aos::EventLoop *event_loop) {
Alex Perrycb7da4b2019-08-28 19:35:56 -070024 return Factory(event_loop, "/superstructure_action");
Austin Schuh1bf8a212019-05-26 22:13:14 -070025 }
Comran Morshed2f7b4672016-01-23 14:27:34 +000026
Austin Schuh9481d0d2019-06-29 21:56:17 -070027 private:
Alex Perrycb7da4b2019-08-28 19:35:56 -070028 ::aos::Sender<::y2016::control_loops::superstructure::Goal>
Austin Schuh9481d0d2019-06-29 21:56:17 -070029 superstructure_goal_sender_;
Alex Perrycb7da4b2019-08-28 19:35:56 -070030 ::aos::Fetcher<::y2016::control_loops::superstructure::Status>
Austin Schuh9481d0d2019-06-29 21:56:17 -070031 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_;
Alex Perrycb7da4b2019-08-28 19:35:56 -070040 bool RunAction(
41 const superstructure_action::SuperstructureActionParams *params) override;
Austin Schuhfef64ac2016-04-24 19:08:01 -070042 void MoveSuperstructure(double shoulder, double shooter, bool unfold_climber);
Diana Vandenberg9cc9ab62016-04-20 21:27:47 -070043 void WaitForSuperstructure();
44 bool SuperstructureProfileDone();
45 bool SuperstructureDone();
Comran Morshed2f7b4672016-01-23 14:27:34 +000046};
47
Stephan Pleinesd99b1ee2024-02-02 20:56:44 -080048} // namespace y2016::actors
Comran Morshed2f7b4672016-01-23 14:27:34 +000049
50#endif // Y2016_ACTORS_SUPERSTRUCTURE_ACTOR_H_