milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame^] | 1 | #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 | |
| 13 | namespace y2022 { |
| 14 | namespace constants { |
| 15 | |
| 16 | struct 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 | } |
| 23 | static constexpr double kDrivetrainEncoderRatio() { return (24.0 / 52.0); } |
| 24 | static constexpr double kMaxDrivetrainEncoderPulsesPerSecond() { |
| 25 | return control_loops::drivetrain::kFreeSpeed / (2.0 * M_PI) * |
| 26 | control_loops::drivetrain::kHighOutputRatio / |
| 27 | constants::Values::kDrivetrainEncoderRatio() * |
| 28 | kDrivetrainEncoderCountsPerRevolution(); |
| 29 | } |
| 30 | static constexpr double kRollerSupplyCurrentLimit() { return 30.0; } |
| 31 | static constexpr double kRollerStatorCurrentLimit() { return 40.0; } |
| 32 | |
| 33 | // Climber |
| 34 | static constexpr double kClimberSupplyCurrentLimit() { return 60.0; } |
| 35 | }; |
| 36 | |
| 37 | // Creates (once) a Values instance for ::aos::network::GetTeamNumber(). Should |
| 38 | // be called before realtime because this allocates memory. |
| 39 | void InitValues(); |
| 40 | |
| 41 | // Returns a reference to the Values instance for |
| 42 | // ::aos::network::GetTeamNumber(). Values must be initialized through |
| 43 | // InitValues() before calling this. |
| 44 | const Values &GetValues(); |
| 45 | |
| 46 | } // namespace constants |
| 47 | } // namespace y2022 |
| 48 | |
| 49 | #endif // Y2022_CONSTANTS_H_ |