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 { |
Isaac Wilcove | 0851ffd | 2017-02-16 04:13:14 +0000 | [diff] [blame] | 22 | // The amount of index pulses in the joint's range of motion. |
| 23 | int index_pulse_count; |
| 24 | // The difference in scaled units between two index pulses. |
| 25 | double index_difference; |
| 26 | // The absolute position in scaled units of one of the index pulses. |
| 27 | double measured_index_position; |
| 28 | // The index pulse that is known, going from lowest in the range of motion to |
| 29 | // highest (Starting at 0). |
| 30 | int known_index_pulse; |
Tyler Chatow | 61f7797 | 2017-02-04 17:41:14 -0800 | [diff] [blame] | 31 | }; |
| 32 | |
| 33 | struct PotAndAbsoluteEncoderZeroingConstants { |
Austin Schuh | 5f01f15 | 2017-02-11 21:34:08 -0800 | [diff] [blame] | 34 | // The number of samples in the moving average filter. |
| 35 | size_t average_filter_size; |
Tyler Chatow | 61f7797 | 2017-02-04 17:41:14 -0800 | [diff] [blame] | 36 | // The distance that the absolute encoder needs to complete a full rotation. |
Austin Schuh | 5f01f15 | 2017-02-11 21:34:08 -0800 | [diff] [blame] | 37 | double one_revolution_distance; |
| 38 | // Measured absolute position of the encoder when at zero. |
| 39 | double measured_absolute_position; |
| 40 | |
| 41 | // Treshold for deciding if we are moving |
| 42 | // TODO(austin): Figure out what this is actually measuring. |
| 43 | double zeroing_threshold; |
Diana Vandenberg | 8fea6ea | 2017-02-18 17:24:45 -0800 | [diff] [blame] | 44 | |
| 45 | // Buffer size for deciding if we are moving. |
| 46 | size_t moving_buffer_size; |
Tyler Chatow | 61f7797 | 2017-02-04 17:41:14 -0800 | [diff] [blame] | 47 | }; |
| 48 | |
Brian Silverman | ebca77a | 2016-02-14 22:14:00 -0500 | [diff] [blame] | 49 | // Defines a range of motion for a subsystem. |
| 50 | // These are all absolute positions in scaled units. |
| 51 | struct Range { |
| 52 | double lower_hard; |
| 53 | double upper_hard; |
| 54 | double lower; |
| 55 | double upper; |
| 56 | }; |
| 57 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 58 | } // namespace constants |
| 59 | } // namespace frc971 |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 60 | |
| 61 | #endif // FRC971_CONSTANTS_H_ |