blob: b8ad33a3d120dd7afe958ef0dd07d0753042a8c5 [file] [log] [blame]
Comran Morshed2f7b4672016-01-23 14:27:34 +00001#include "y2016/actors/superstructure_actor.h"
2
3#include "aos/common/util/phased_loop.h"
4#include "aos/common/logging/logging.h"
5#include "y2016/actors/superstructure_actor.h"
6#include "y2016/control_loops/superstructure/superstructure.q.h"
7
8namespace y2016 {
9namespace actors {
10
11SuperstructureActor::SuperstructureActor(
12 actors::SuperstructureActionQueueGroup* s)
13 : aos::common::actions::ActorBase<actors::SuperstructureActionQueueGroup>(
14 s) {}
15
16bool SuperstructureActor::RunAction(
17 const actors::SuperstructureActionParams& params) {
18 LOG(INFO, "Starting superstructure action with value %f", params.value);
19
20 while (true) {
21 control_loops::superstructure_queue.status.FetchLatest();
22 ::aos::time::PhasedLoop phased_loop(::aos::time::Time::InMS(5),
23 ::aos::time::Time::InMS(5) / 2);
24 break;
25 }
26
27 return true;
28}
29
30::std::unique_ptr<SuperstructureAction> MakeSuperstructureAction(
31 const ::y2016::actors::SuperstructureActionParams& params) {
32 return ::std::unique_ptr<SuperstructureAction>(new SuperstructureAction(
33 &::y2016::actors::superstructure_action, params));
34}
35
36} // namespace actors
37} // namespace y2016