blob: 2e8af5aadb52164fc6b9bd3774c6fcfd6e6b7667 [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 Silverman1a6590d2013-11-04 14:46:46 -080028 // The ratio from the encoder shaft to the drivetrain wheels.
29 double drivetrain_encoder_ratio;
30
31 // The gear ratios from motor shafts to the drivetrain wheels for high and low
32 // gear.
33 double low_gear_ratio;
34 double high_gear_ratio;
Brian Silverman431500a2013-10-28 19:50:15 -070035
Brian Silverman6eb51f12013-11-02 14:39:01 -070036 ShifterHallEffect left_drive, right_drive;
37
Brian Silverman1a6590d2013-11-04 14:46:46 -080038 bool clutch_transmission;
39
Brian Silverman2c590c32013-11-04 18:08:54 -080040 ::std::function<StateFeedbackLoop<2, 2, 2>()> make_v_drivetrain_loop;
41 ::std::function<StateFeedbackLoop<4, 2, 2>()> make_drivetrain_loop;
Austin Schuh3bb9a442014-02-02 16:01:45 -080042
Austin Schuhcc0bf312014-02-09 00:39:29 -080043 double upper_claw_lower_limit;
44 double upper_claw_upper_limit;
45 double lower_claw_lower_limit;
46 double lower_claw_upper_limit;
Austin Schuh3bb9a442014-02-02 16:01:45 -080047 double claw_zeroing_off_speed;
48 double claw_zeroing_speed;
Austin Schuhcc0bf312014-02-09 00:39:29 -080049
50 // claw seperation that would be considered a collision
51 double claw_min_seperation;
52 double claw_max_seperation;
53
54 // Three hall effects are known as front, calib and back
55 double upper_claw_front_heffect_lower_angle;
56 double upper_claw_front_heffect_upper_angle;
57 double upper_claw_calib_heffect_lower_angle;
58 double upper_claw_calib_heffect_upper_angle;
59 double upper_claw_back_heffect_lower_angle;
60 double upper_claw_back_heffect_upper_angle;
61 double lower_claw_front_heffect_lower_angle;
62 double lower_claw_front_heffect_upper_angle;
63 double lower_claw_calib_heffect_lower_angle;
64 double lower_claw_calib_heffect_upper_angle;
65 double lower_claw_back_heffect_lower_angle;
66 double lower_claw_back_heffect_upper_angle;
Brian Silverman431500a2013-10-28 19:50:15 -070067};
68
69// Creates (once) a Values instance and returns a reference to it.
70const Values &GetValues();
brians343bc112013-02-10 01:53:46 +000071
72} // namespace constants
73} // namespace frc971
Brian Silverman431500a2013-10-28 19:50:15 -070074
75#endif // FRC971_CONSTANTS_H_