blob: cf6c183cf9684f95cd5471eb91f125b995a8cb52 [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
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.
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