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