blob: 991386dbeae8a41ff74ee044e124874a0814aa12 [file] [log] [blame]
Daniel Pettiaece37f2014-10-25 17:13:44 -07001#ifndef FRC971_SHIFTER_HALL_EFFECT_H_
2#define FRC971_SHIFTER_HALL_EFFECT_H_
3
4namespace frc971 {
5namespace constants {
6
Sabina Davis415bb6c2017-10-16 23:30:52 -07007// Contains the constants for mapping the analog voltages that the shifter
8// sensors return to the shifter position. The code which uses this is trying
9// to sort out if we are in low gear, high gear, or neutral.
Daniel Pettiaece37f2014-10-25 17:13:44 -070010struct ShifterHallEffect {
Sabina Davis415bb6c2017-10-16 23:30:52 -070011 // low_gear_low is the voltage that the shifter position sensor reads when it
12 // is all the way in low gear. high_gear_high is the voltage that the shifter
13 // position sensor reads when it is all the way in high gear. These two
14 // values are used to calculate a position from 0 to 1, where we get 0 when
15 // the shifter is in low gear, and 1 when it is high gear.
16 double low_gear_low;
17 double high_gear_high;
Daniel Pettiaece37f2014-10-25 17:13:44 -070018
19 // The numbers for when the dog is clear of each gear.
Sabina Davis415bb6c2017-10-16 23:30:52 -070020 // We are in low gear when the position is less than clear_low, and in high
21 // gear when the shifter position is greater than clear_high.
Daniel Pettiaece37f2014-10-25 17:13:44 -070022 double clear_low, clear_high;
23};
24
Sabina Davis415bb6c2017-10-16 23:30:52 -070025struct DualHallShifterHallEffect {
26 ShifterHallEffect shifter_hall_effect;
27 double low_gear_middle;
28 double high_gear_middle;
29};
30
31} // namespace constants
32} // namespace frc971
Daniel Pettiaece37f2014-10-25 17:13:44 -070033
34#endif