blob: 838bb35cd780eb8275919fc07ef3c5682095c706 [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 {
28 // Wrist hall effect positive and negative edges.
29 // How many radians from horizontal to the location of interest.
30 double wrist_hall_effect_start_angle;
31 double wrist_hall_effect_stop_angle;
Austin Schuhfa033692013-02-24 01:00:55 -080032
Brian Silverman431500a2013-10-28 19:50:15 -070033 // Upper and lower extreme limits of travel for the wrist.
34 // These are the soft stops for up and down.
35 double wrist_upper_limit;
36 double wrist_lower_limit;
Austin Schuhdd3bc412013-03-16 17:02:40 -070037
Brian Silverman431500a2013-10-28 19:50:15 -070038 // Physical limits. These are here for testing.
39 double wrist_upper_physical_limit;
40 double wrist_lower_physical_limit;
James Kuszmaul4a4622b2013-03-02 16:28:29 -080041
Brian Silverman431500a2013-10-28 19:50:15 -070042 // Zeroing speed.
43 // The speed to move the wrist at when zeroing in rad/sec
44 double wrist_zeroing_speed;
45 // Zeroing off speed (in rad/sec).
46 double wrist_zeroing_off_speed;
Austin Schuhfa033692013-02-24 01:00:55 -080047
Brian Silverman431500a2013-10-28 19:50:15 -070048 // AngleAdjust hall effect positive and negative edges.
49 // These are the soft stops for up and down.
50 const double (&angle_adjust_hall_effect_start_angle)[2];
51 const double (&angle_adjust_hall_effect_stop_angle)[2];
Brian Silverman3cb1d802013-08-30 15:41:49 -070052
Brian Silverman431500a2013-10-28 19:50:15 -070053 // Upper and lower extreme limits of travel for the angle adjust.
54 double angle_adjust_upper_limit;
55 double angle_adjust_lower_limit;
56 // Physical limits. These are here for testing.
57 double angle_adjust_upper_physical_limit;
58 double angle_adjust_lower_physical_limit;
Brian Silverman656789c2013-09-21 23:53:35 -070059
Brian Silverman431500a2013-10-28 19:50:15 -070060 // The speed to move the angle adjust when zeroing, in rad/sec
61 double angle_adjust_zeroing_speed;
62 // Zeroing off speed.
63 double angle_adjust_zeroing_off_speed;
64
65 // Deadband voltage.
66 double angle_adjust_deadband;
67
Brian Silverman1a6590d2013-11-04 14:46:46 -080068 // The ratio from the encoder shaft to the drivetrain wheels.
69 double drivetrain_encoder_ratio;
70
71 // The gear ratios from motor shafts to the drivetrain wheels for high and low
72 // gear.
73 double low_gear_ratio;
74 double high_gear_ratio;
Brian Silverman431500a2013-10-28 19:50:15 -070075
Brian Silverman6eb51f12013-11-02 14:39:01 -070076 ShifterHallEffect left_drive, right_drive;
77
Brian Silverman1a6590d2013-11-04 14:46:46 -080078 bool clutch_transmission;
79
Brian Silverman2c590c32013-11-04 18:08:54 -080080 ::std::function<StateFeedbackLoop<2, 2, 2>()> make_v_drivetrain_loop;
81 ::std::function<StateFeedbackLoop<4, 2, 2>()> make_drivetrain_loop;
82
Brian Silverman431500a2013-10-28 19:50:15 -070083 // How many pixels off center the vertical line
84 // on the camera view is.
85 int camera_center;
86};
87
88// Creates (once) a Values instance and returns a reference to it.
89const Values &GetValues();
brians343bc112013-02-10 01:53:46 +000090
91} // namespace constants
92} // namespace frc971
Brian Silverman431500a2013-10-28 19:50:15 -070093
94#endif // FRC971_CONSTANTS_H_