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 | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 6 | #include "frc971/shifter_hall_effect.h" |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame^] | 7 | #include "frc971/control_loops/state_feedback_loop.h" |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 8 | |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame^] | 9 | namespace y2016 { |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 10 | namespace constants { |
| 11 | |
| 12 | using ::frc971::constants::ShifterHallEffect; |
| 13 | |
| 14 | // Has all of the numbers that change for both robots and makes it easy to |
| 15 | // retrieve the values for the current one. |
| 16 | |
| 17 | // Everything is in SI units (volts, radians, meters, seconds, etc). |
| 18 | // Some of these values are related to the conversion between raw values |
| 19 | // (encoder counts, voltage, etc) to scaled units (radians, meters, etc). |
| 20 | |
| 21 | // This structure contains current values for all of the things that change. |
| 22 | struct Values { |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 23 | // The ratio from the encoder shaft to the drivetrain wheels. |
| 24 | double drivetrain_encoder_ratio; |
| 25 | |
| 26 | // The gear ratios from motor shafts to the drivetrain wheels for high and low |
| 27 | // gear. |
| 28 | double low_gear_ratio; |
| 29 | double high_gear_ratio; |
| 30 | ShifterHallEffect left_drive, right_drive; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 31 | |
| 32 | double turn_width; |
| 33 | |
| 34 | ::std::function<StateFeedbackLoop<2, 2, 2>()> make_v_drivetrain_loop; |
| 35 | ::std::function<StateFeedbackLoop<4, 2, 2>()> make_drivetrain_loop; |
| 36 | |
| 37 | double drivetrain_max_speed; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | // Creates (once) a Values instance for ::aos::network::GetTeamNumber() and |
| 41 | // returns a reference to it. |
| 42 | const Values &GetValues(); |
| 43 | |
| 44 | // Creates Values instances for each team number it is called with and returns |
| 45 | // them. |
| 46 | const Values &GetValuesForTeam(uint16_t team_number); |
| 47 | |
| 48 | } // namespace constants |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame^] | 49 | } // namespace y2016 |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 50 | |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame^] | 51 | #endif // Y2016_CONSTANTS_H_ |