blob: 7b4cb470be0883207c2f06cf8105cb8d724b7bc3 [file] [log] [blame]
Brian Silverman431500a2013-10-28 19:50:15 -07001#ifndef FRC971_CONSTANTS_H_
2#define FRC971_CONSTANTS_H_
Brian Silverman2c590c32013-11-04 18:08:54 -08003
Austin Schuh5f01f152017-02-11 21:34:08 -08004#include <cstddef>
5
brians343bc112013-02-10 01:53:46 +00006namespace frc971 {
7namespace constants {
8
Tyler Chatowf8f03112017-02-05 14:31:34 -08009struct PotAndIndexPulseZeroingConstants {
Brian Silvermanb691f5e2015-08-02 11:37:55 -070010 // The number of samples in the moving average filter.
Austin Schuh5f01f152017-02-11 21:34:08 -080011 size_t average_filter_size;
Brian Silvermanb691f5e2015-08-02 11:37:55 -070012 // 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 Silverman431500a2013-10-28 19:50:15 -070019};
20
Tyler Chatow61f77972017-02-04 17:41:14 -080021struct EncoderPlusIndexZeroingConstants {
Isaac Wilcove0851ffd2017-02-16 04:13:14 +000022 // 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 Chatow61f77972017-02-04 17:41:14 -080031};
32
33struct PotAndAbsoluteEncoderZeroingConstants {
Austin Schuh5f01f152017-02-11 21:34:08 -080034 // The number of samples in the moving average filter.
35 size_t average_filter_size;
Tyler Chatow61f77972017-02-04 17:41:14 -080036 // The distance that the absolute encoder needs to complete a full rotation.
Austin Schuh5f01f152017-02-11 21:34:08 -080037 double one_revolution_distance;
38 // Measured absolute position of the encoder when at zero.
39 double measured_absolute_position;
40
Brian Silvermana10d20a2017-02-19 14:28:53 -080041 // Treshold for deciding if we are moving. moving_buffer_size samples need to
42 // be within this distance of each other before we use the middle one to zero.
Austin Schuh5f01f152017-02-11 21:34:08 -080043 double zeroing_threshold;
Diana Vandenberg8fea6ea2017-02-18 17:24:45 -080044 // Buffer size for deciding if we are moving.
45 size_t moving_buffer_size;
Brian Silvermana10d20a2017-02-19 14:28:53 -080046
47 // Value between 0 and 1 indicating what fraction of one_revolution_distance
48 // it is acceptable for the offset to move.
49 double allowable_encoder_error;
Tyler Chatow61f77972017-02-04 17:41:14 -080050};
51
Brian Silvermanebca77a2016-02-14 22:14:00 -050052// Defines a range of motion for a subsystem.
53// These are all absolute positions in scaled units.
54struct Range {
55 double lower_hard;
56 double upper_hard;
57 double lower;
58 double upper;
59};
60
brians343bc112013-02-10 01:53:46 +000061} // namespace constants
62} // namespace frc971
Brian Silverman431500a2013-10-28 19:50:15 -070063
64#endif // FRC971_CONSTANTS_H_