Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 1 | #ifndef Y2016_CONSTANTS_H_ |
| 2 | #define Y2016_CONSTANTS_H_ |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 3 | |
| 4 | #include <stdint.h> |
| 5 | |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 6 | #include "frc971/control_loops/state_feedback_loop.h" |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame^] | 7 | #include "frc971/shifter_hall_effect.h" |
| 8 | #include "frc971/constants.h" |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 9 | |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 10 | namespace y2016 { |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 11 | namespace constants { |
| 12 | |
| 13 | using ::frc971::constants::ShifterHallEffect; |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame^] | 14 | using ::frc971::constants::ZeroingConstants; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 15 | |
| 16 | // Has all of the numbers that change for both robots and makes it easy to |
| 17 | // retrieve the values for the current one. |
| 18 | |
| 19 | // Everything is in SI units (volts, radians, meters, seconds, etc). |
| 20 | // Some of these values are related to the conversion between raw values |
| 21 | // (encoder counts, voltage, etc) to scaled units (radians, meters, etc). |
| 22 | |
| 23 | // This structure contains current values for all of the things that change. |
| 24 | struct Values { |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 25 | // The ratio from the encoder shaft to the drivetrain wheels. |
| 26 | double drivetrain_encoder_ratio; |
| 27 | |
| 28 | // The gear ratios from motor shafts to the drivetrain wheels for high and low |
| 29 | // gear. |
| 30 | double low_gear_ratio; |
| 31 | double high_gear_ratio; |
| 32 | ShifterHallEffect left_drive, right_drive; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 33 | |
| 34 | double turn_width; |
| 35 | |
| 36 | ::std::function<StateFeedbackLoop<2, 2, 2>()> make_v_drivetrain_loop; |
| 37 | ::std::function<StateFeedbackLoop<4, 2, 2>()> make_drivetrain_loop; |
| 38 | |
| 39 | double drivetrain_max_speed; |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame^] | 40 | |
| 41 | // Defines a range of motion for a subsystem. |
| 42 | // These are all absolute positions in scaled units. |
| 43 | struct Range { |
| 44 | double lower_hard; |
| 45 | double upper_hard; |
| 46 | double lower; |
| 47 | double upper; |
| 48 | }; |
| 49 | |
| 50 | struct Intake { |
| 51 | Range limits; |
| 52 | ZeroingConstants zeroing; |
| 53 | }; |
| 54 | Intake intake; |
| 55 | |
| 56 | struct Shoulder { |
| 57 | Range limits; |
| 58 | ZeroingConstants zeroing; |
| 59 | }; |
| 60 | Shoulder shoulder; |
| 61 | |
| 62 | struct Wrist { |
| 63 | Range limits; |
| 64 | ZeroingConstants zeroing; |
| 65 | }; |
| 66 | Wrist wrist; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | // Creates (once) a Values instance for ::aos::network::GetTeamNumber() and |
| 70 | // returns a reference to it. |
| 71 | const Values &GetValues(); |
| 72 | |
| 73 | // Creates Values instances for each team number it is called with and returns |
| 74 | // them. |
| 75 | const Values &GetValuesForTeam(uint16_t team_number); |
| 76 | |
| 77 | } // namespace constants |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 78 | } // namespace y2016 |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 79 | |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 80 | #endif // Y2016_CONSTANTS_H_ |