James (Peilun) Li | a70e575 | 2024-09-18 20:43:00 -0700 | [diff] [blame] | 1 | #ifndef Y2024_BOT3_CONSTANTS_H_ |
| 2 | #define Y2024_BOT3_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 "frc971/zeroing/absolute_encoder.h" |
| 12 | #include "frc971/zeroing/pot_and_absolute_encoder.h" |
| 13 | #include "y2024_bot3/constants/constants_generated.h" |
| 14 | |
| 15 | namespace y2024_bot3::constants { |
| 16 | |
| 17 | constexpr uint16_t kThirdRobotTeamNumber = 9971; |
| 18 | |
| 19 | struct Values { |
| 20 | static const int kSuperstructureCANWriterPriority = 35; |
| 21 | |
| 22 | struct PotAndAbsEncoderConstants { |
| 23 | ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemParams< |
| 24 | ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator> |
| 25 | subsystem_params; |
| 26 | double potentiometer_offset; |
| 27 | }; |
| 28 | |
| 29 | struct AbsoluteEncoderConstants { |
| 30 | ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemParams< |
| 31 | ::frc971::zeroing::AbsoluteEncoderZeroingEstimator> |
| 32 | subsystem_params; |
| 33 | }; |
| 34 | |
| 35 | struct PotConstants { |
| 36 | ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemParams< |
| 37 | ::frc971::zeroing::RelativeEncoderZeroingEstimator> |
| 38 | subsystem_params; |
| 39 | double potentiometer_offset; |
| 40 | }; |
| 41 | }; |
| 42 | |
| 43 | // Creates and returns a Values instance for the constants. |
| 44 | // Should be called before realtime because this allocates memory. |
| 45 | // Only the first call to either of these will be used. |
| 46 | constants::Values MakeValues(uint16_t team); |
| 47 | |
| 48 | // Calls MakeValues with aos::network::GetTeamNumber() |
| 49 | constants::Values MakeValues(); |
| 50 | |
| 51 | } // namespace y2024_bot3::constants |
| 52 | |
| 53 | #endif // Y2024_BOT3_CONSTANTS_H_ |