Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame^] | 1 | #ifndef y2020_CONSTANTS_H_ |
| 2 | #define y2020_CONSTANTS_H_ |
| 3 | |
| 4 | #include <math.h> |
| 5 | #include <stdint.h> |
| 6 | |
| 7 | #include <array> |
| 8 | |
| 9 | #include "frc971/constants.h" |
| 10 | #include "frc971/control_loops/pose.h" |
| 11 | #include "frc971/control_loops/static_zeroing_single_dof_profiled_subsystem.h" |
| 12 | #include "y2020/control_loops/drivetrain/drivetrain_dog_motor_plant.h" |
| 13 | |
| 14 | namespace y2020 { |
| 15 | namespace constants { |
| 16 | |
| 17 | struct Values { |
| 18 | static const int kZeroingSampleSize = 200; |
| 19 | |
| 20 | static constexpr double kDrivetrainCyclesPerRevolution() { return 512.0; } |
| 21 | static constexpr double kDrivetrainEncoderCountsPerRevolution() { |
| 22 | return kDrivetrainCyclesPerRevolution() * 4; |
| 23 | } |
| 24 | static constexpr double kDrivetrainEncoderRatio() { return (24.0 / 52.0); } |
| 25 | static constexpr double kMaxDrivetrainEncoderPulsesPerSecond() { |
| 26 | return control_loops::drivetrain::kFreeSpeed / (2.0 * M_PI) * |
| 27 | control_loops::drivetrain::kHighOutputRatio / |
| 28 | constants::Values::kDrivetrainEncoderRatio() * |
| 29 | kDrivetrainEncoderCountsPerRevolution(); |
| 30 | } |
| 31 | }; |
| 32 | |
| 33 | // Creates (once) a Values instance for ::aos::network::GetTeamNumber() and |
| 34 | // returns a reference to it. |
| 35 | const Values &GetValues(); |
| 36 | |
| 37 | // Creates Values instances for each team number it is called with and returns |
| 38 | // them. |
| 39 | const Values &GetValuesForTeam(uint16_t team_number); |
| 40 | |
| 41 | } // namespace constants |
| 42 | } // namespace y2020 |
| 43 | |
| 44 | #endif // y2020_CONSTANTS_H_ |