Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 1 | #ifndef FRC971_CONSTANTS_H_ |
| 2 | #define FRC971_CONSTANTS_H_ |
Brian Silverman | 2c590c3 | 2013-11-04 18:08:54 -0800 | [diff] [blame] | 3 | |
Austin Schuh | 5f01f15 | 2017-02-11 21:34:08 -0800 | [diff] [blame^] | 4 | #include <cstddef> |
| 5 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 6 | namespace frc971 { |
| 7 | namespace constants { |
| 8 | |
Tyler Chatow | f8f0311 | 2017-02-05 14:31:34 -0800 | [diff] [blame] | 9 | struct PotAndIndexPulseZeroingConstants { |
Brian Silverman | b691f5e | 2015-08-02 11:37:55 -0700 | [diff] [blame] | 10 | // The number of samples in the moving average filter. |
Austin Schuh | 5f01f15 | 2017-02-11 21:34:08 -0800 | [diff] [blame^] | 11 | size_t average_filter_size; |
Brian Silverman | b691f5e | 2015-08-02 11:37:55 -0700 | [diff] [blame] | 12 | // The difference in scaled units between two index pulses. |
| 13 | double index_difference; |
| 14 | // The absolute position in scaled units of one of the index pulses. |
| 15 | double measured_index_position; |
| 16 | // Value between 0 and 1 which determines a fraction of the index_diff |
| 17 | // you want to use. |
| 18 | double allowable_encoder_error; |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 19 | }; |
| 20 | |
Tyler Chatow | 61f7797 | 2017-02-04 17:41:14 -0800 | [diff] [blame] | 21 | struct EncoderPlusIndexZeroingConstants { |
| 22 | // The amount of index pulses in the limb's range of motion. |
| 23 | int num_index_pulses; |
| 24 | }; |
| 25 | |
| 26 | struct PotAndAbsoluteEncoderZeroingConstants { |
Austin Schuh | 5f01f15 | 2017-02-11 21:34:08 -0800 | [diff] [blame^] | 27 | // The number of samples in the moving average filter. |
| 28 | size_t average_filter_size; |
Tyler Chatow | 61f7797 | 2017-02-04 17:41:14 -0800 | [diff] [blame] | 29 | // The distance that the absolute encoder needs to complete a full rotation. |
Austin Schuh | 5f01f15 | 2017-02-11 21:34:08 -0800 | [diff] [blame^] | 30 | double one_revolution_distance; |
| 31 | // Measured absolute position of the encoder when at zero. |
| 32 | double measured_absolute_position; |
| 33 | |
| 34 | // Treshold for deciding if we are moving |
| 35 | // TODO(austin): Figure out what this is actually measuring. |
| 36 | double zeroing_threshold; |
Tyler Chatow | 61f7797 | 2017-02-04 17:41:14 -0800 | [diff] [blame] | 37 | }; |
| 38 | |
Brian Silverman | ebca77a | 2016-02-14 22:14:00 -0500 | [diff] [blame] | 39 | // Defines a range of motion for a subsystem. |
| 40 | // These are all absolute positions in scaled units. |
| 41 | struct Range { |
| 42 | double lower_hard; |
| 43 | double upper_hard; |
| 44 | double lower; |
| 45 | double upper; |
| 46 | }; |
| 47 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 48 | } // namespace constants |
| 49 | } // namespace frc971 |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 50 | |
| 51 | #endif // FRC971_CONSTANTS_H_ |