Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 1 | #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 Silverman | b601d89 | 2015-12-20 18:24:38 -0500 | [diff] [blame^] | 11 | namespace y2014 { |
Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 12 | namespace actors { |
| 13 | |
| 14 | class 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 ¶ms) 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 | |
| 43 | typedef ::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 Silverman | b601d89 | 2015-12-20 18:24:38 -0500 | [diff] [blame^] | 50 | } // namespace y2014 |
Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 51 | |
| 52 | #endif // Y2014_ACTORS_SHOOT_ACTOR_H_ |