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 { |
Brian Silverman | 1a6590d | 2013-11-04 14:46:46 -0800 | [diff] [blame] | 28 | // 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; |
Ben Fredrickson | edf0e09 | 2014-02-16 10:46:50 +0000 | [diff] [blame^] | 35 | |
| 36 | // Three hall effects are known as front, calib and back |
| 37 | struct Pair { |
| 38 | double lower_limit; |
| 39 | double upper_limit; |
| 40 | }; |
| 41 | |
| 42 | struct ShooterLimits { |
| 43 | double lower_limit; |
| 44 | double upper_limit; |
| 45 | Pair plunger_back; |
| 46 | Pair pusher_distal; |
| 47 | Pair pusher_proximal; |
| 48 | }; |
| 49 | |
| 50 | ShooterLimits shooter; |
joe | 93778a6 | 2014-02-15 13:22:14 -0800 | [diff] [blame] | 51 | |
joe | 3779d0c | 2014-02-15 19:41:22 -0800 | [diff] [blame] | 52 | double shooter_voltage; |
Ben Fredrickson | edf0e09 | 2014-02-16 10:46:50 +0000 | [diff] [blame^] | 53 | double shooter_total_length; |
joe | 93778a6 | 2014-02-15 13:22:14 -0800 | [diff] [blame] | 54 | double shooter_hall_effect_start_position; |
| 55 | double shooter_zeroing_off_speed; |
| 56 | double shooter_zeroing_speed; |
joe | 3779d0c | 2014-02-15 19:41:22 -0800 | [diff] [blame] | 57 | double position; |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 58 | |
Brian Silverman | 6eb51f1 | 2013-11-02 14:39:01 -0700 | [diff] [blame] | 59 | ShifterHallEffect left_drive, right_drive; |
| 60 | |
Brian Silverman | 1a6590d | 2013-11-04 14:46:46 -0800 | [diff] [blame] | 61 | bool clutch_transmission; |
| 62 | |
Brian Silverman | 2c590c3 | 2013-11-04 18:08:54 -0800 | [diff] [blame] | 63 | ::std::function<StateFeedbackLoop<2, 2, 2>()> make_v_drivetrain_loop; |
| 64 | ::std::function<StateFeedbackLoop<4, 2, 2>()> make_drivetrain_loop; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 65 | |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 66 | double claw_zeroing_off_speed; |
| 67 | double claw_zeroing_speed; |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 68 | |
| 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 Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 74 | 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 Fredrickson | 9b38842 | 2014-02-13 06:15:31 +0000 | [diff] [blame] | 87 | |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 88 | Claw upper_claw; |
| 89 | Claw lower_claw; |
Ben Fredrickson | 9b38842 | 2014-02-13 06:15:31 +0000 | [diff] [blame] | 90 | |
| 91 | double claw_unimportant_epsilon; |
| 92 | double start_fine_tune_pos; |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 93 | }; |
| 94 | |
| 95 | // Creates (once) a Values instance and returns a reference to it. |
| 96 | const Values &GetValues(); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 97 | |
| 98 | } // namespace constants |
| 99 | } // namespace frc971 |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 100 | |
| 101 | #endif // FRC971_CONSTANTS_H_ |