James Kuszmaul | c0568f2 | 2014-03-05 20:33:00 -0800 | [diff] [blame] | 1 | #include "frc971/actions/catch_action.q.h" |
| 2 | #include "frc971/actions/action.h" |
| 3 | #include "aos/common/time.h" |
| 4 | |
| 5 | namespace frc971 { |
| 6 | namespace actions { |
| 7 | |
James Kuszmaul | 9d9b798 | 2014-03-05 21:15:13 -0800 | [diff] [blame] | 8 | class CatchAction : public ActionBase<CatchActionGroup> { |
James Kuszmaul | c0568f2 | 2014-03-05 20:33:00 -0800 | [diff] [blame] | 9 | public: |
| 10 | |
James Kuszmaul | 9d9b798 | 2014-03-05 21:15:13 -0800 | [diff] [blame] | 11 | explicit CatchAction(CatchActionGroup* s); |
James Kuszmaul | c0568f2 | 2014-03-05 20:33:00 -0800 | [diff] [blame] | 12 | |
| 13 | // Actually executes the action of moving the claw into position and closing |
| 14 | // it. |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 15 | virtual void RunAction(); |
James Kuszmaul | c0568f2 | 2014-03-05 20:33:00 -0800 | [diff] [blame] | 16 | |
Austin Schuh | a719bf1 | 2014-03-09 00:45:02 -0800 | [diff] [blame] | 17 | static constexpr double kCatchSeparation = 0.8; |
| 18 | static constexpr double kCatchMinSeparation = 0.65; |
James Kuszmaul | c0568f2 | 2014-03-05 20:33:00 -0800 | [diff] [blame] | 19 | static constexpr double kCatchIntake = 12.0; |
Austin Schuh | a719bf1 | 2014-03-09 00:45:02 -0800 | [diff] [blame] | 20 | static constexpr double kSonarTriggerDist = 0.725; |
James Kuszmaul | c0568f2 | 2014-03-05 20:33:00 -0800 | [diff] [blame] | 21 | static constexpr double kCatchCentering = 12.0; |
| 22 | static constexpr double kFinishAngle = 0.2; |
| 23 | |
| 24 | protected: |
| 25 | // ready for shot |
| 26 | bool DonePreShotOpen(); |
| 27 | // in the right place |
| 28 | bool DoneSetupCatch(); |
| 29 | // sonar is in valid range to close |
| 30 | bool DoneFoundSonar(); |
| 31 | // Claw reports it is done |
| 32 | bool DoneClawWithBall(); |
| 33 | // hall effect reports the ball is in |
| 34 | bool DoneBallIn(); |
Austin Schuh | a719bf1 | 2014-03-09 00:45:02 -0800 | [diff] [blame] | 35 | |
| 36 | private: |
| 37 | int close_count_; |
James Kuszmaul | c0568f2 | 2014-03-05 20:33:00 -0800 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | } // namespace actions |
| 41 | } // namespace frc971 |
| 42 | |