blob: 01648f56c90a41a0acd9b7ff0b07db5626e9e093 [file] [log] [blame]
Brian Silverman431500a2013-10-28 19:50:15 -07001#ifndef FRC971_CONSTANTS_H_
2#define FRC971_CONSTANTS_H_
3
brians343bc112013-02-10 01:53:46 +00004#include <stdint.h>
5
Brian Silverman2c590c32013-11-04 18:08:54 -08006#include "frc971/control_loops/state_feedback_loop.h"
7
brians343bc112013-02-10 01:53:46 +00008namespace frc971 {
9namespace constants {
10
11// Has all of the numbers that change for both robots and makes it easy to
12// retrieve the values for the current one.
brians343bc112013-02-10 01:53:46 +000013
Brian Silvermanc8e21512013-11-03 15:53:11 -080014const uint16_t kCompTeamNumber = 8971;
Brian Silverman63783c42013-09-28 21:57:41 -070015const uint16_t kPracticeTeamNumber = 971;
brians343bc112013-02-10 01:53:46 +000016
Brian Silverman6eb51f12013-11-02 14:39:01 -070017// Contains the voltages for an analog hall effect sensor on a shifter.
18struct ShifterHallEffect {
Brian Silvermanc8e21512013-11-03 15:53:11 -080019 // The numbers to use for scaling raw voltages to 0-1.
Brian Silverman6eb51f12013-11-02 14:39:01 -070020 double high, low;
21
Brian Silvermanc8e21512013-11-03 15:53:11 -080022 // The numbers for when the dog is clear of each gear.
Brian Silverman6eb51f12013-11-02 14:39:01 -070023 double clear_high, clear_low;
24};
25
Brian Silverman431500a2013-10-28 19:50:15 -070026// This structure contains current values for all of the things that change.
27struct Values {
Brian Silverman2c793712014-02-16 19:32:32 -080028 // This is useful for representing the 2 sides of a hall effect sensor etc.
29 struct Pair {
30 double lower_limit;
31 double upper_limit;
32 };
33
Brian Silverman1a6590d2013-11-04 14:46:46 -080034 // The ratio from the encoder shaft to the drivetrain wheels.
35 double drivetrain_encoder_ratio;
36
37 // The gear ratios from motor shafts to the drivetrain wheels for high and low
38 // gear.
39 double low_gear_ratio;
40 double high_gear_ratio;
Ben Fredricksonedf0e092014-02-16 10:46:50 +000041
Brian Silverman2c793712014-02-16 19:32:32 -080042 ShifterHallEffect left_drive, right_drive;
43
44 bool clutch_transmission;
45
46 ::std::function<StateFeedbackLoop<2, 2, 2>()> make_v_drivetrain_loop;
47 ::std::function<StateFeedbackLoop<4, 2, 2>()> make_drivetrain_loop;
Ben Fredricksonedf0e092014-02-16 10:46:50 +000048
49 struct ShooterLimits {
50 double lower_limit;
51 double upper_limit;
52 Pair plunger_back;
53 Pair pusher_distal;
54 Pair pusher_proximal;
55 };
56
57 ShooterLimits shooter;
joe93778a62014-02-15 13:22:14 -080058
joe3779d0c2014-02-15 19:41:22 -080059 double shooter_voltage;
Ben Fredricksonedf0e092014-02-16 10:46:50 +000060 double shooter_total_length;
joe93778a62014-02-15 13:22:14 -080061 double shooter_hall_effect_start_position;
62 double shooter_zeroing_off_speed;
63 double shooter_zeroing_speed;
joe3779d0c2014-02-15 19:41:22 -080064 double position;
Brian Silverman431500a2013-10-28 19:50:15 -070065
Austin Schuh3bb9a442014-02-02 16:01:45 -080066 double claw_zeroing_off_speed;
67 double claw_zeroing_speed;
Austin Schuhcc0bf312014-02-09 00:39:29 -080068
69 // claw seperation that would be considered a collision
70 double claw_min_seperation;
71 double claw_max_seperation;
72
73 // Three hall effects are known as front, calib and back
Austin Schuh4b7b5d02014-02-10 21:20:34 -080074 struct AnglePair {
75 double lower_angle;
76 double upper_angle;
77 };
78
79 struct Claw {
80 double lower_limit;
81 double upper_limit;
82 AnglePair front;
83 AnglePair calibration;
84 AnglePair back;
85 };
86
Ben Fredrickson9b388422014-02-13 06:15:31 +000087
Austin Schuh4b7b5d02014-02-10 21:20:34 -080088 Claw upper_claw;
89 Claw lower_claw;
Ben Fredrickson9b388422014-02-13 06:15:31 +000090
91 double claw_unimportant_epsilon;
92 double start_fine_tune_pos;
Brian Silverman431500a2013-10-28 19:50:15 -070093};
94
95// Creates (once) a Values instance and returns a reference to it.
96const Values &GetValues();
brians343bc112013-02-10 01:53:46 +000097
98} // namespace constants
99} // namespace frc971
Brian Silverman431500a2013-10-28 19:50:15 -0700100
101#endif // FRC971_CONSTANTS_H_