blob: 56c5f426d503df295beb5afbeaa6c9dd310f99ca [file] [log] [blame]
James Kuszmaulc0568f22014-03-05 20:33:00 -08001#include "frc971/actions/catch_action.q.h"
2#include "frc971/actions/action.h"
3#include "aos/common/time.h"
4
5namespace frc971 {
6namespace actions {
7
James Kuszmaul9d9b7982014-03-05 21:15:13 -08008class CatchAction : public ActionBase<CatchActionGroup> {
James Kuszmaulc0568f22014-03-05 20:33:00 -08009 public:
10
James Kuszmaul9d9b7982014-03-05 21:15:13 -080011 explicit CatchAction(CatchActionGroup* s);
James Kuszmaulc0568f22014-03-05 20:33:00 -080012
13 // Actually executes the action of moving the claw into position and closing
14 // it.
Austin Schuh80ff2e12014-03-08 12:06:19 -080015 virtual void RunAction();
James Kuszmaulc0568f22014-03-05 20:33:00 -080016
Austin Schuha719bf12014-03-09 00:45:02 -080017 static constexpr double kCatchSeparation = 0.8;
18 static constexpr double kCatchMinSeparation = 0.65;
James Kuszmaulc0568f22014-03-05 20:33:00 -080019 static constexpr double kCatchIntake = 12.0;
Austin Schuha719bf12014-03-09 00:45:02 -080020 static constexpr double kSonarTriggerDist = 0.725;
James Kuszmaulc0568f22014-03-05 20:33:00 -080021 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 Schuha719bf12014-03-09 00:45:02 -080035
36 private:
37 int close_count_;
James Kuszmaulc0568f22014-03-05 20:33:00 -080038};
39
40} // namespace actions
41} // namespace frc971
42