blob: 57637dd3e5b40bb5fad7320c3d8896739d427d2f [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
41 // Treshold for deciding if we are moving
42 // TODO(austin): Figure out what this is actually measuring.
43 double zeroing_threshold;
Diana Vandenberg8fea6ea2017-02-18 17:24:45 -080044
45 // Buffer size for deciding if we are moving.
46 size_t moving_buffer_size;
Tyler Chatow61f77972017-02-04 17:41:14 -080047};
48
Brian Silvermanebca77a2016-02-14 22:14:00 -050049// Defines a range of motion for a subsystem.
50// These are all absolute positions in scaled units.
51struct Range {
52 double lower_hard;
53 double upper_hard;
54 double lower;
55 double upper;
56};
57
brians343bc112013-02-10 01:53:46 +000058} // namespace constants
59} // namespace frc971
Brian Silverman431500a2013-10-28 19:50:15 -070060
61#endif // FRC971_CONSTANTS_H_