Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame^] | 1 | #ifndef Y2023_BOT4_CONSTANTS_H |
| 2 | #define Y2023_BOT4_CONSTANTS_H |
| 3 | |
| 4 | #ifndef M_PI |
| 5 | #define M_PI 3.14159265358979323846 |
| 6 | #endif |
| 7 | |
| 8 | #include <cstdint> |
| 9 | |
| 10 | #include "frc971/constants.h" |
| 11 | |
| 12 | namespace y2023_bot4 { |
| 13 | namespace constants { |
| 14 | struct Values { |
| 15 | static const int kZeroingSampleSize = 200; |
| 16 | |
| 17 | static const int kDrivetrainWriterPriority = 35; |
| 18 | static const int kDrivetrainTxPriority = 36; |
| 19 | static const int kDrivetrainRxPriority = 36; |
| 20 | |
| 21 | // TODO (maxwell): Make this the real value; |
| 22 | static constexpr double kDrivetrainCyclesPerRevolution() { return 512.0; } |
| 23 | static constexpr double kDrivetrainEncoderRatio() { return 1.0; } |
| 24 | |
| 25 | static constexpr double kDrivetrainStatorCurrentLimit() { return 35.0; } |
| 26 | static constexpr double kDrivetrainSupplyCurrentLimit() { return 60.0; } |
| 27 | |
| 28 | // TODO (maxwell): Make this the real value |
| 29 | static constexpr double kFollowerWheelCountsPerRevolution() { return 512.0; } |
| 30 | static constexpr double kFollowerWheelEncoderRatio() { return 1.0; } |
| 31 | static constexpr double kFollowerWheelRadius() { return 3.25 / 2 * 0.0254; } |
| 32 | static constexpr double kDrivetrainEncoderCountsPerRevolution() { |
| 33 | return 2048.0; |
| 34 | } |
| 35 | |
| 36 | static constexpr double kMaxDrivetrainEncoderPulsesPerSecond() { |
| 37 | return 1200000; |
| 38 | } |
| 39 | |
| 40 | frc971::constants::ContinuousAbsoluteEncoderZeroingConstants |
| 41 | front_left_zeroing_constants, |
| 42 | front_right_zeroing_constants, back_left_zeroing_constants, |
| 43 | back_right_zeroing_constants; |
| 44 | }; |
| 45 | // Creates and returns a Values instance for the constants. |
| 46 | // Should be called before realtime because this allocates memory. |
| 47 | // Only the first call to either of these will be used. |
| 48 | Values MakeValues(uint16_t team); |
| 49 | |
| 50 | // Calls MakeValues with aos::network::GetTeamNumber() |
| 51 | Values MakeValues(); |
| 52 | } // namespace constants |
| 53 | } // namespace y2023_bot4 |
| 54 | |
| 55 | #endif // Y2023_BOT4_CONSTANTS_H |