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 | |
Daniel Petti | ab27423 | 2015-02-16 19:15:34 -0800 | [diff] [blame] | 24 | // The internal state of a zeroing estimator. |
| 25 | struct EstimatorState { |
| 26 | // If true, there has been a fatal error for the estimator. |
| 27 | bool error; |
| 28 | // If the joint has seen an index pulse and is zeroed. |
| 29 | bool zeroed; |
| 30 | // The estimated position of the joint. |
| 31 | double position; |
| 32 | }; |
| 33 | |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame] | 34 | // A left/right pair of PotAndIndexPositions. |
| 35 | struct PotAndIndexPair { |
| 36 | PotAndIndexPosition left; |
| 37 | PotAndIndexPosition right; |
Austin Schuh | 60c5666 | 2014-02-17 14:37:19 -0800 | [diff] [blame] | 38 | }; |