Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 1 | #ifndef FRC971_CONSTANTS_H_ |
| 2 | #define FRC971_CONSTANTS_H_ |
| 3 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 4 | #include <stdint.h> |
| 5 | |
Brian Silverman | 2c590c3 | 2013-11-04 18:08:54 -0800 | [diff] [blame^] | 6 | #include "frc971/control_loops/state_feedback_loop.h" |
| 7 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 8 | namespace frc971 { |
| 9 | namespace 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. |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 13 | |
Brian Silverman | c8e2151 | 2013-11-03 15:53:11 -0800 | [diff] [blame] | 14 | const uint16_t kCompTeamNumber = 8971; |
Brian Silverman | 63783c4 | 2013-09-28 21:57:41 -0700 | [diff] [blame] | 15 | const uint16_t kPracticeTeamNumber = 971; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 16 | |
Brian Silverman | 6eb51f1 | 2013-11-02 14:39:01 -0700 | [diff] [blame] | 17 | // Contains the voltages for an analog hall effect sensor on a shifter. |
| 18 | struct ShifterHallEffect { |
Brian Silverman | c8e2151 | 2013-11-03 15:53:11 -0800 | [diff] [blame] | 19 | // The numbers to use for scaling raw voltages to 0-1. |
Brian Silverman | 6eb51f1 | 2013-11-02 14:39:01 -0700 | [diff] [blame] | 20 | double high, low; |
| 21 | |
Brian Silverman | c8e2151 | 2013-11-03 15:53:11 -0800 | [diff] [blame] | 22 | // The numbers for when the dog is clear of each gear. |
Brian Silverman | 6eb51f1 | 2013-11-02 14:39:01 -0700 | [diff] [blame] | 23 | double clear_high, clear_low; |
| 24 | }; |
| 25 | |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 26 | // This structure contains current values for all of the things that change. |
| 27 | struct 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 Schuh | fa03369 | 2013-02-24 01:00:55 -0800 | [diff] [blame] | 32 | |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 33 | // 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 Schuh | dd3bc41 | 2013-03-16 17:02:40 -0700 | [diff] [blame] | 37 | |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 38 | // Physical limits. These are here for testing. |
| 39 | double wrist_upper_physical_limit; |
| 40 | double wrist_lower_physical_limit; |
James Kuszmaul | 4a4622b | 2013-03-02 16:28:29 -0800 | [diff] [blame] | 41 | |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 42 | // 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 Schuh | fa03369 | 2013-02-24 01:00:55 -0800 | [diff] [blame] | 47 | |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 48 | // 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 Silverman | 3cb1d80 | 2013-08-30 15:41:49 -0700 | [diff] [blame] | 52 | |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 53 | // 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 Silverman | 656789c | 2013-09-21 23:53:35 -0700 | [diff] [blame] | 59 | |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 60 | // 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 Silverman | 1a6590d | 2013-11-04 14:46:46 -0800 | [diff] [blame] | 68 | // 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 Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 75 | |
Brian Silverman | 6eb51f1 | 2013-11-02 14:39:01 -0700 | [diff] [blame] | 76 | ShifterHallEffect left_drive, right_drive; |
| 77 | |
Brian Silverman | 1a6590d | 2013-11-04 14:46:46 -0800 | [diff] [blame] | 78 | bool clutch_transmission; |
| 79 | |
Brian Silverman | 2c590c3 | 2013-11-04 18:08:54 -0800 | [diff] [blame^] | 80 | ::std::function<StateFeedbackLoop<2, 2, 2>()> make_v_drivetrain_loop; |
| 81 | ::std::function<StateFeedbackLoop<4, 2, 2>()> make_drivetrain_loop; |
| 82 | |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 83 | // 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. |
| 89 | const Values &GetValues(); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 90 | |
| 91 | } // namespace constants |
| 92 | } // namespace frc971 |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 93 | |
| 94 | #endif // FRC971_CONSTANTS_H_ |