blob: b5a89ddefba1530cae1c76a04d22b86adb6ca2a3 [file] [log] [blame]
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -07001#ifndef Y2024_SWERVE_CONSTANTS_H
2#define Y2024_SWERVE_CONSTANTS_H
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -07003
4#ifndef M_PI
5#define M_PI 3.14159265358979323846
6#endif
7
8#include <cstdint>
9
10#include "frc971/constants.h"
11
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -070012namespace y2024_swerve::constants {
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070013struct 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
James Kuszmaul3f1bbf52024-06-22 15:57:44 -070027 static constexpr double kRotationModuleRatio() {
28 return 9.0 / 24.0 * 14.0 / 72.0;
29 }
30
31 static constexpr double kTranslationModuleRatio() {
32 return 1.0 / 6.75 * 2.0 * .0254;
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070033 }
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.
47Values MakeValues(uint16_t team);
48
49// Calls MakeValues with aos::network::GetTeamNumber()
50Values MakeValues();
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -070051} // namespace y2024_swerve::constants
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070052
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -070053#endif // Y2024_SWERVE_CONSTANTS_H