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 | |
Austin Schuh | e7f90d1 | 2014-02-17 00:48:25 -0800 | [diff] [blame] | 14 | const uint16_t kCompTeamNumber = 971; |
| 15 | const uint16_t kPracticeTeamNumber = 8971; |
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 | 2c79371 | 2014-02-16 19:32:32 -0800 | [diff] [blame] | 28 | // This is useful for representing the 2 sides of a hall effect sensor etc. |
Brian Silverman | aae236a | 2014-02-17 01:49:39 -0800 | [diff] [blame] | 29 | struct AnglePair { |
| 30 | double lower_angle; |
| 31 | double upper_angle; |
Brian Silverman | 2c79371 | 2014-02-16 19:32:32 -0800 | [diff] [blame] | 32 | }; |
| 33 | |
Brian Silverman | 1a6590d | 2013-11-04 14:46:46 -0800 | [diff] [blame] | 34 | // 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; |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 41 | |
Brian Silverman | 6eb51f1 | 2013-11-02 14:39:01 -0700 | [diff] [blame] | 42 | ShifterHallEffect left_drive, right_drive; |
| 43 | |
Brian Silverman | 1a6590d | 2013-11-04 14:46:46 -0800 | [diff] [blame] | 44 | bool clutch_transmission; |
| 45 | |
Brian Silverman | 2c590c3 | 2013-11-04 18:08:54 -0800 | [diff] [blame] | 46 | ::std::function<StateFeedbackLoop<2, 2, 2>()> make_v_drivetrain_loop; |
| 47 | ::std::function<StateFeedbackLoop<4, 2, 2>()> make_drivetrain_loop; |
Brian Silverman | dfdcd58 | 2014-02-16 20:50:09 -0800 | [diff] [blame] | 48 | |
Austin Schuh | 60c5666 | 2014-02-17 14:37:19 -0800 | [diff] [blame^] | 49 | struct Shooter { |
Ben Fredrickson | edf0e09 | 2014-02-16 10:46:50 +0000 | [diff] [blame] | 50 | double lower_limit; |
| 51 | double upper_limit; |
Brian Silverman | aae236a | 2014-02-17 01:49:39 -0800 | [diff] [blame] | 52 | AnglePair plunger_back; |
| 53 | AnglePair pusher_distal; |
| 54 | AnglePair pusher_proximal; |
Austin Schuh | 60c5666 | 2014-02-17 14:37:19 -0800 | [diff] [blame^] | 55 | double zeroing_off_speed; |
| 56 | double zeroing_speed; |
Ben Fredrickson | edf0e09 | 2014-02-16 10:46:50 +0000 | [diff] [blame] | 57 | }; |
| 58 | |
Austin Schuh | 60c5666 | 2014-02-17 14:37:19 -0800 | [diff] [blame^] | 59 | Shooter shooter; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 60 | |
Austin Schuh | d27931c | 2014-02-16 19:18:20 -0800 | [diff] [blame] | 61 | struct Claws { |
| 62 | double claw_zeroing_off_speed; |
| 63 | double claw_zeroing_speed; |
| 64 | double claw_zeroing_separation; |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 65 | |
Austin Schuh | d27931c | 2014-02-16 19:18:20 -0800 | [diff] [blame] | 66 | // claw seperation that would be considered a collision |
Austin Schuh | 069143b | 2014-02-17 02:46:26 -0800 | [diff] [blame] | 67 | double claw_min_separation; |
| 68 | double claw_max_separation; |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 69 | |
Austin Schuh | d27931c | 2014-02-16 19:18:20 -0800 | [diff] [blame] | 70 | // Three hall effects are known as front, calib and back |
Brian Silverman | aae236a | 2014-02-17 01:49:39 -0800 | [diff] [blame] | 71 | typedef Values::AnglePair AnglePair; |
Austin Schuh | d27931c | 2014-02-16 19:18:20 -0800 | [diff] [blame] | 72 | |
| 73 | struct Claw { |
| 74 | double lower_hard_limit; |
| 75 | double upper_hard_limit; |
| 76 | double lower_limit; |
| 77 | double upper_limit; |
| 78 | AnglePair front; |
| 79 | AnglePair calibration; |
| 80 | AnglePair back; |
| 81 | }; |
| 82 | |
| 83 | Claw upper_claw; |
| 84 | Claw lower_claw; |
| 85 | |
| 86 | double claw_unimportant_epsilon; |
| 87 | double start_fine_tune_pos; |
Austin Schuh | 4cb047f | 2014-02-16 21:10:19 -0800 | [diff] [blame] | 88 | double max_zeroing_voltage; |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 89 | }; |
Austin Schuh | d27931c | 2014-02-16 19:18:20 -0800 | [diff] [blame] | 90 | Claws claw; |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | // Creates (once) a Values instance and returns a reference to it. |
| 94 | const Values &GetValues(); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 95 | |
| 96 | } // namespace constants |
| 97 | } // namespace frc971 |
Brian Silverman | 431500a | 2013-10-28 19:50:15 -0700 | [diff] [blame] | 98 | |
| 99 | #endif // FRC971_CONSTANTS_H_ |