Brian Silverman | e0a9546 | 2014-02-17 00:41:09 -0800 | [diff] [blame] | 1 | package frc971; |
| 2 | |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame^] | 3 | // Represents all of the data for a single potentiometer and indexed encoder |
| 4 | // pair. |
| 5 | // The units on all of the positions are the same. |
| 6 | // All encoder values are relative to where the encoder was at some arbitrary |
| 7 | // point in time. All potentiometer values are relative to some arbitrary 0 |
| 8 | // position which varies with each robot. |
| 9 | struct PotAndIndexPosition { |
| 10 | // Current position read from the encoder. |
| 11 | double encoder; |
| 12 | // Current position read from the potentiometer. |
| 13 | double pot; |
| 14 | |
| 15 | // Position from the encoder latched at the last index pulse. |
| 16 | double latched_encoder; |
| 17 | // Position from the potentiometer latched at the last index pulse. |
| 18 | double latched_pot; |
| 19 | |
| 20 | // How many index pulses we've seen since startup. Starts at 0. |
| 21 | uint32_t index_pulses; |
Brian Silverman | e0a9546 | 2014-02-17 00:41:09 -0800 | [diff] [blame] | 22 | }; |
Brian Silverman | 5b433df | 2014-02-17 11:57:37 -0800 | [diff] [blame] | 23 | |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame^] | 24 | // A left/right pair of PotAndIndexPositions. |
| 25 | struct PotAndIndexPair { |
| 26 | PotAndIndexPosition left; |
| 27 | PotAndIndexPosition right; |
Austin Schuh | 60c5666 | 2014-02-17 14:37:19 -0800 | [diff] [blame] | 28 | }; |