Daniel Petti | aece37f | 2014-10-25 17:13:44 -0700 | [diff] [blame] | 1 | #ifndef FRC971_SHIFTER_HALL_EFFECT_H_ |
| 2 | #define FRC971_SHIFTER_HALL_EFFECT_H_ |
| 3 | |
| 4 | namespace frc971 { |
| 5 | namespace constants { |
| 6 | |
Sabina Davis | 415bb6c | 2017-10-16 23:30:52 -0700 | [diff] [blame] | 7 | // 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 Petti | aece37f | 2014-10-25 17:13:44 -0700 | [diff] [blame] | 10 | struct ShifterHallEffect { |
Sabina Davis | 415bb6c | 2017-10-16 23:30:52 -0700 | [diff] [blame] | 11 | // 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 Petti | aece37f | 2014-10-25 17:13:44 -0700 | [diff] [blame] | 18 | |
| 19 | // The numbers for when the dog is clear of each gear. |
Sabina Davis | 415bb6c | 2017-10-16 23:30:52 -0700 | [diff] [blame] | 20 | // 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 Petti | aece37f | 2014-10-25 17:13:44 -0700 | [diff] [blame] | 22 | double clear_low, clear_high; |
| 23 | }; |
| 24 | |
Sabina Davis | 415bb6c | 2017-10-16 23:30:52 -0700 | [diff] [blame] | 25 | struct 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 Petti | aece37f | 2014-10-25 17:13:44 -0700 | [diff] [blame] | 33 | |
| 34 | #endif |