blob: 3adfe310e58bc3f0e99cda0a896997cc133c8d88 [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
11namespace frc971 {
12namespace 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
50} // namespace frc971
51
52#endif // Y2014_ACTORS_SHOOT_ACTOR_H_