blob: 4ede8888afc2fd1016eca555185d3d9ae9dfcfaf [file] [log] [blame]
Brian Silverman17f503e2015-08-02 18:17:18 -07001#ifndef Y2014_ACTORS_SHOOT_ACTOR_H_
2#define Y2014_ACTORS_SHOOT_ACTOR_H_
3
4#include <memory>
5
6#include "aos/common/actions/actor.h"
7#include "aos/common/actions/actions.h"
8
9#include "y2014/actors/shoot_action.q.h"
10
Brian Silvermanb601d892015-12-20 18:24:38 -050011namespace y2014 {
Brian Silverman17f503e2015-08-02 18:17:18 -070012namespace actors {
13
14class ShootActor
15 : public ::aos::common::actions::ActorBase<actors::ShootActionQueueGroup> {
16 public:
17 explicit ShootActor(actors::ShootActionQueueGroup* s);
18
19 // Actually execute the action of moving the claw and shooter into position
20 // and actually firing them.
21 bool RunAction(const double &params) override;
22 void InnerRunAction();
23
24 // calc an offset to our requested shot based on robot speed
25 double SpeedToAngleOffset(double speed);
26
27 static constexpr double kOffsetRadians = 0.4;
28 static constexpr double kClawShootingSeparation = 0.10;
29 static constexpr double kClawShootingSeparationGoal = 0.10;
30
31 protected:
32 // completed shot
33 bool DoneShot();
34 // ready for shot
35 bool DonePreShotOpen();
36 // in the right place
37 bool DoneSetupShot();
38
39 // to track when shot is complete
40 int previous_shots_;
41};
42
43typedef ::aos::common::actions::TypedAction<actors::ShootActionQueueGroup>
44 ShootAction;
45
46// Makes a new ShootActor action.
47::std::unique_ptr<ShootAction> MakeShootAction();
48
49} // namespace actors
Brian Silvermanb601d892015-12-20 18:24:38 -050050} // namespace y2014
Brian Silverman17f503e2015-08-02 18:17:18 -070051
52#endif // Y2014_ACTORS_SHOOT_ACTOR_H_