blob: c6990bc16c30fdb722c9af20f1f4974dd78c7e90 [file] [log] [blame]
Adam Snaider79900c22017-02-08 20:23:15 -08001#ifndef Y2017_CONTROL_LOOPS_SUPERSTRUCTURE_INTAKE_INTAKE_H_
2#define Y2017_CONTROL_LOOPS_SUPERSTRUCTURE_INTAKE_INTAKE_H_
3
4#include "frc971/control_loops/profiled_subsystem.h"
5#include "y2017/control_loops/superstructure/superstructure.q.h"
6
7namespace y2017 {
8namespace control_loops {
9namespace superstructure {
10namespace intake {
11
12class Intake {
13 public:
Ojas Upadhye3abe8862017-02-11 17:06:53 -080014 Intake();
15 double goal(int row, int col) const {
16 return profiled_subsystem_.goal(row, col);
17 }
Adam Snaider79900c22017-02-08 20:23:15 -080018
Ojas Upadhye3abe8862017-02-11 17:06:53 -080019 // The zeroing and operating voltages.
20 static constexpr double kZeroingVoltage = 2.5;
21 static constexpr double kOperatingVoltage = 12.0;
Adam Snaider79900c22017-02-08 20:23:15 -080022
Ojas Upadhye3abe8862017-02-11 17:06:53 -080023 void Iterate(const control_loops::IntakeGoal *unsafe_goal,
24 const ::frc971::PotAndAbsolutePosition *position, double *output,
25 ::frc971::control_loops::AbsoluteProfiledJointStatus *status);
Adam Snaider79900c22017-02-08 20:23:15 -080026
Ojas Upadhye3abe8862017-02-11 17:06:53 -080027 void Reset();
Adam Snaider79900c22017-02-08 20:23:15 -080028
Ojas Upadhye3abe8862017-02-11 17:06:53 -080029 enum class State : int32_t {
30 UNINITIALIZED,
31 DISABLED_INITIALIZED,
32 ZEROING,
33 RUNNING,
34 ESTOP,
35 };
Adam Snaider79900c22017-02-08 20:23:15 -080036
Ojas Upadhye3abe8862017-02-11 17:06:53 -080037 State state() const { return state_; }
Adam Snaider79900c22017-02-08 20:23:15 -080038
Ojas Upadhye3abe8862017-02-11 17:06:53 -080039 private:
40 State state_;
Adam Snaider79900c22017-02-08 20:23:15 -080041
Ojas Upadhye3abe8862017-02-11 17:06:53 -080042 ::frc971::control_loops::SingleDOFProfiledSubsystem<
43 ::frc971::zeroing::PotAndAbsEncoderZeroingEstimator> profiled_subsystem_;
Adam Snaider79900c22017-02-08 20:23:15 -080044};
45
46} // namespace intake
47} // namespace superstructure
48} // namespace control_loops
49} // namespace y2017
50
51#endif // Y2017_CONTROL_LOOPS_SUPERSTRUCTURE_INTAKE_INTAKE_H_