blob: 050a3638c408b30ef35cbad998a4290f45d624a9 [file] [log] [blame]
milind-u086d7262022-01-19 20:44:18 -08001#ifndef Y2022_CONSTANTS_H_
2#define Y2022_CONSTANTS_H_
3
4#include <array>
5#include <cmath>
6#include <cstdint>
7
8#include "frc971/constants.h"
9#include "frc971/control_loops/pose.h"
10#include "frc971/control_loops/static_zeroing_single_dof_profiled_subsystem.h"
11#include "y2022/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
12
13namespace y2022 {
14namespace constants {
15
16struct Values {
17 static const int kZeroingSampleSize = 200;
18
19 static constexpr double kDrivetrainCyclesPerRevolution() { return 512.0; }
20 static constexpr double kDrivetrainEncoderCountsPerRevolution() {
21 return kDrivetrainCyclesPerRevolution() * 4;
22 }
Griffin Bui6f27af22022-01-30 13:47:28 -080023 static constexpr double kDrivetrainEncoderRatio() {
24 return (14.0 / 54.0) * (22.0 / 56.0);
25 }
milind-u086d7262022-01-19 20:44:18 -080026 static constexpr double kMaxDrivetrainEncoderPulsesPerSecond() {
27 return control_loops::drivetrain::kFreeSpeed / (2.0 * M_PI) *
28 control_loops::drivetrain::kHighOutputRatio /
29 constants::Values::kDrivetrainEncoderRatio() *
30 kDrivetrainEncoderCountsPerRevolution();
31 }
32 static constexpr double kRollerSupplyCurrentLimit() { return 30.0; }
33 static constexpr double kRollerStatorCurrentLimit() { return 40.0; }
34
35 // Climber
36 static constexpr double kClimberSupplyCurrentLimit() { return 60.0; }
Milo Lin6b5e4582022-01-29 14:51:37 -080037
38 // Intake
39 // two encoders with same gear ratio for intake
40 static constexpr double kIntakeEncoderCountsPerRevolution() { return 512.0; }
41
42 static constexpr double kIntakeEncoderRatio() {
43 return ((16.0 / 60.0) * (18.0 / 62.0));
44 }
45
46 // TODO(Milo): Also need to add specific PPR (Pulse per revolution)
milind-u086d7262022-01-19 20:44:18 -080047};
48
49// Creates (once) a Values instance for ::aos::network::GetTeamNumber(). Should
50// be called before realtime because this allocates memory.
51void InitValues();
52
53// Returns a reference to the Values instance for
54// ::aos::network::GetTeamNumber(). Values must be initialized through
55// InitValues() before calling this.
56const Values &GetValues();
57
58} // namespace constants
59} // namespace y2022
60
61#endif // Y2022_CONSTANTS_H_