blob: 4a0197c6061857697fc7f544b2a529cf1e2cd879 [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
Stephan Pleinesf63bde82024-01-13 15:59:33 -08004namespace frc971::constants {
Daniel Pettiaece37f2014-10-25 17:13:44 -07005
Sabina Davis415bb6c2017-10-16 23:30:52 -07006// Contains the constants for mapping the analog voltages that the shifter
7// sensors return to the shifter position. The code which uses this is trying
8// to sort out if we are in low gear, high gear, or neutral.
Daniel Pettiaece37f2014-10-25 17:13:44 -07009struct ShifterHallEffect {
Sabina Davis415bb6c2017-10-16 23:30:52 -070010 // low_gear_low is the voltage that the shifter position sensor reads when it
11 // is all the way in low gear. high_gear_high is the voltage that the shifter
12 // position sensor reads when it is all the way in high gear. These two
13 // values are used to calculate a position from 0 to 1, where we get 0 when
14 // the shifter is in low gear, and 1 when it is high gear.
15 double low_gear_low;
16 double high_gear_high;
Daniel Pettiaece37f2014-10-25 17:13:44 -070017
18 // The numbers for when the dog is clear of each gear.
Sabina Davis415bb6c2017-10-16 23:30:52 -070019 // We are in low gear when the position is less than clear_low, and in high
20 // gear when the shifter position is greater than clear_high.
Daniel Pettiaece37f2014-10-25 17:13:44 -070021 double clear_low, clear_high;
22};
23
Sabina Davis415bb6c2017-10-16 23:30:52 -070024struct DualHallShifterHallEffect {
25 ShifterHallEffect shifter_hall_effect;
26 double low_gear_middle;
27 double high_gear_middle;
28};
29
Stephan Pleinesf63bde82024-01-13 15:59:33 -080030} // namespace frc971::constants
Daniel Pettiaece37f2014-10-25 17:13:44 -070031
32#endif