milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 1 | #include "y2022/constants.h" |
| 2 | |
| 3 | #include <cinttypes> |
| 4 | #include <map> |
| 5 | |
| 6 | #if __has_feature(address_sanitizer) |
| 7 | #include "sanitizer/lsan_interface.h" |
| 8 | #endif |
| 9 | |
| 10 | #include "absl/base/call_once.h" |
Philipp Schrader | 790cb54 | 2023-07-05 21:06:52 -0700 | [diff] [blame] | 11 | #include "glog/logging.h" |
| 12 | |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 13 | #include "aos/mutex/mutex.h" |
| 14 | #include "aos/network/team_number.h" |
Nathan Leong | 342b85e | 2023-01-08 13:49:33 -0800 | [diff] [blame] | 15 | #include "frc971/wpilib/wpilib_utils.h" |
James Kuszmaul | ec635d2 | 2023-08-12 18:39:24 -0700 | [diff] [blame^] | 16 | #include "frc971/zeroing/pot_and_absolute_encoder.h" |
Austin Schuh | 39f26f6 | 2022-02-24 21:34:46 -0800 | [diff] [blame] | 17 | #include "y2022/control_loops/superstructure/catapult/integral_catapult_plant.h" |
Siddhant Kanwar | 0e37f59 | 2022-02-21 19:26:50 -0800 | [diff] [blame] | 18 | #include "y2022/control_loops/superstructure/climber/integral_climber_plant.h" |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 19 | #include "y2022/control_loops/superstructure/intake/integral_intake_plant.h" |
| 20 | #include "y2022/control_loops/superstructure/turret/integral_turret_plant.h" |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 21 | |
| 22 | namespace y2022 { |
| 23 | namespace constants { |
| 24 | |
| 25 | const int Values::kZeroingSampleSize; |
| 26 | |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 27 | Values MakeValues(uint16_t team) { |
| 28 | LOG(INFO) << "creating a Constants for team: " << team; |
| 29 | |
| 30 | Values r; |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 31 | |
Yash Chainani | 997a749 | 2022-01-29 15:48:56 -0800 | [diff] [blame] | 32 | // Intake constants. |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 33 | auto *const intake_front = &r.intake_front; |
| 34 | auto *const intake_back = &r.intake_back; |
Yash Chainani | 997a749 | 2022-01-29 15:48:56 -0800 | [diff] [blame] | 35 | |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 36 | ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemParams< |
| 37 | ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator> |
| 38 | intake_params; |
| 39 | |
| 40 | intake_params.zeroing_voltage = 3.0; |
| 41 | intake_params.operating_voltage = 12.0; |
| 42 | intake_params.zeroing_profile_params = {0.5, 3.0}; |
| 43 | intake_params.default_profile_params = {6.0, 30.0}; |
| 44 | intake_params.range = Values::kIntakeRange(); |
| 45 | intake_params.make_integral_loop = |
Yash Chainani | 997a749 | 2022-01-29 15:48:56 -0800 | [diff] [blame] | 46 | control_loops::superstructure::intake::MakeIntegralIntakeLoop; |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 47 | intake_params.zeroing_constants.average_filter_size = |
| 48 | Values::kZeroingSampleSize; |
| 49 | intake_params.zeroing_constants.one_revolution_distance = |
Yash Chainani | 997a749 | 2022-01-29 15:48:56 -0800 | [diff] [blame] | 50 | M_PI * 2.0 * constants::Values::kIntakeEncoderRatio(); |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 51 | intake_params.zeroing_constants.zeroing_threshold = 0.0005; |
| 52 | intake_params.zeroing_constants.moving_buffer_size = 20; |
| 53 | intake_params.zeroing_constants.allowable_encoder_error = 0.9; |
| 54 | intake_params.zeroing_constants.measured_absolute_position = 0.0; |
Yash Chainani | 997a749 | 2022-01-29 15:48:56 -0800 | [diff] [blame] | 55 | |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 56 | intake_front->subsystem_params = intake_params; |
| 57 | intake_back->subsystem_params = intake_params; |
Yash Chainani | 997a749 | 2022-01-29 15:48:56 -0800 | [diff] [blame] | 58 | |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 59 | // Turret constants. |
| 60 | auto *const turret = &r.turret; |
| 61 | auto *const turret_params = &turret->subsystem_params; |
Milind Upadhyay | e9075d1 | 2022-04-12 22:45:16 -0700 | [diff] [blame] | 62 | auto *turret_range = &r.turret_range; |
| 63 | |
| 64 | *turret_range = ::frc971::constants::Range{ |
| 65 | .lower_hard = -7.0, // Back Hard |
| 66 | .upper_hard = 3.4, // Front Hard |
| 67 | .lower = -6.5, // Back Soft |
| 68 | .upper = 3.15 // Front Soft |
| 69 | }; |
Yash Chainani | 997a749 | 2022-01-29 15:48:56 -0800 | [diff] [blame] | 70 | |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 71 | turret_params->zeroing_voltage = 4.0; |
Austin Schuh | 798be92 | 2022-03-12 12:00:41 -0800 | [diff] [blame] | 72 | turret_params->operating_voltage = 12.0; |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 73 | turret_params->zeroing_profile_params = {0.5, 2.0}; |
milind-u | c63d094 | 2022-04-15 12:07:42 -0700 | [diff] [blame] | 74 | turret_params->default_profile_params = {10.0, 20.0}; |
Milind Upadhyay | e9075d1 | 2022-04-12 22:45:16 -0700 | [diff] [blame] | 75 | turret_params->default_profile_params = {15.0, 20.0}; |
| 76 | turret_params->range = *turret_range; |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 77 | turret_params->make_integral_loop = |
| 78 | control_loops::superstructure::turret::MakeIntegralTurretLoop; |
| 79 | turret_params->zeroing_constants.average_filter_size = |
| 80 | Values::kZeroingSampleSize; |
| 81 | turret_params->zeroing_constants.one_revolution_distance = |
| 82 | M_PI * 2.0 * constants::Values::kTurretEncoderRatio(); |
| 83 | turret_params->zeroing_constants.zeroing_threshold = 0.0005; |
| 84 | turret_params->zeroing_constants.moving_buffer_size = 20; |
| 85 | turret_params->zeroing_constants.allowable_encoder_error = 0.9; |
| 86 | turret_params->zeroing_constants.measured_absolute_position = 0.0; |
Yash Chainani | 997a749 | 2022-01-29 15:48:56 -0800 | [diff] [blame] | 87 | |
Siddhant Kanwar | 0e37f59 | 2022-02-21 19:26:50 -0800 | [diff] [blame] | 88 | // Climber constants |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 89 | auto *const climber = &r.climber; |
Siddhant Kanwar | 0e37f59 | 2022-02-21 19:26:50 -0800 | [diff] [blame] | 90 | climber->subsystem_params.zeroing_voltage = 3.0; |
| 91 | climber->subsystem_params.operating_voltage = 12.0; |
| 92 | climber->subsystem_params.zeroing_profile_params = {0.5, 0.1}; |
Austin Schuh | 8507c9f | 2022-03-13 18:08:28 -0700 | [diff] [blame] | 93 | climber->subsystem_params.default_profile_params = {5.0, 1.0}; |
Siddhant Kanwar | 0e37f59 | 2022-02-21 19:26:50 -0800 | [diff] [blame] | 94 | climber->subsystem_params.range = Values::kClimberRange(); |
| 95 | climber->subsystem_params.make_integral_loop = |
| 96 | control_loops::superstructure::climber::MakeIntegralClimberLoop; |
| 97 | |
Griffin Bui | bcbef48 | 2022-02-23 15:32:10 -0800 | [diff] [blame] | 98 | // Flipper arm constants |
| 99 | Values::PotConstants flipper_arms; |
| 100 | flipper_arms.subsystem_params.zeroing_voltage = 3.0; |
| 101 | flipper_arms.subsystem_params.operating_voltage = 12.0; |
| 102 | flipper_arms.subsystem_params.zeroing_profile_params = {0.5, 0.1}; |
| 103 | flipper_arms.subsystem_params.default_profile_params = {6.0, 1.0}; |
| 104 | flipper_arms.subsystem_params.range = Values::kFlipperArmRange(); |
| 105 | |
Austin Schuh | e18df6d | 2022-03-05 14:02:03 -0800 | [diff] [blame] | 106 | auto *const flipper_arm_right = &r.flipper_arm_right; |
| 107 | auto *const flipper_arm_left = &r.flipper_arm_left; |
Griffin Bui | bcbef48 | 2022-02-23 15:32:10 -0800 | [diff] [blame] | 108 | |
| 109 | *flipper_arm_right = flipper_arms; |
| 110 | *flipper_arm_left = flipper_arms; |
| 111 | |
| 112 | // No integral loops for flipper arms |
| 113 | |
Austin Schuh | 39f26f6 | 2022-02-24 21:34:46 -0800 | [diff] [blame] | 114 | // Catapult |
| 115 | Values::PotAndAbsEncoderConstants *const catapult = &r.catapult; |
| 116 | ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemParams< |
| 117 | ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator> |
| 118 | *const catapult_params = &catapult->subsystem_params; |
| 119 | |
| 120 | catapult_params->zeroing_voltage = 4.0; |
| 121 | catapult_params->operating_voltage = 12.0; |
| 122 | catapult_params->zeroing_profile_params = {0.5, 2.0}; |
| 123 | catapult_params->default_profile_params = {15.0, 40.0}; |
| 124 | catapult_params->range = Values::kCatapultRange(); |
| 125 | catapult_params->make_integral_loop = |
| 126 | &control_loops::superstructure::catapult::MakeIntegralCatapultLoop; |
| 127 | catapult_params->zeroing_constants.average_filter_size = |
| 128 | Values::kZeroingSampleSize; |
| 129 | catapult_params->zeroing_constants.one_revolution_distance = |
| 130 | M_PI * 2.0 * constants::Values::kCatapultEncoderRatio(); |
| 131 | catapult_params->zeroing_constants.zeroing_threshold = 0.0005; |
| 132 | catapult_params->zeroing_constants.moving_buffer_size = 20; |
| 133 | catapult_params->zeroing_constants.allowable_encoder_error = 0.9; |
| 134 | |
Ravago Jones | 3283ce0 | 2022-03-09 19:31:29 -0800 | [diff] [blame] | 135 | // Interpolation table for comp and practice robots |
| 136 | r.shot_interpolation_table = InterpolationTable<Values::ShotParams>({ |
Austin Schuh | d84d431 | 2022-11-07 09:04:48 -0800 | [diff] [blame] | 137 | {1.0, {0.12, 19.4}}, |
| 138 | {1.6, {0.12, 19.4}}, |
| 139 | {1.9, {0.17, 19.4}}, |
| 140 | {2.12, {0.21, 19.4}}, |
| 141 | {2.9, {0.30, 19.9}}, |
Austin Schuh | 1ed66ab | 2022-04-02 22:39:17 -0700 | [diff] [blame] | 142 | |
Austin Schuh | d84d431 | 2022-11-07 09:04:48 -0800 | [diff] [blame] | 143 | {3.2, {0.33, 20.1}}, |
Austin Schuh | 9628b8b | 2022-04-16 10:18:59 -0700 | [diff] [blame] | 144 | |
Austin Schuh | d84d431 | 2022-11-07 09:04:48 -0800 | [diff] [blame] | 145 | {3.60, {0.39, 20.65}}, |
| 146 | {4.50, {0.44, 22.3}}, |
Nathan Leong | 4afefdb | 2022-12-21 21:17:19 -0800 | [diff] [blame] | 147 | {4.9, {0.43, 22.75}}, // up to here |
Austin Schuh | d84d431 | 2022-11-07 09:04:48 -0800 | [diff] [blame] | 148 | {5.4, {0.43, 23.85}}, |
Austin Schuh | 1ed66ab | 2022-04-02 22:39:17 -0700 | [diff] [blame] | 149 | |
Austin Schuh | d84d431 | 2022-11-07 09:04:48 -0800 | [diff] [blame] | 150 | {6.0, {0.42, 25.3}}, |
| 151 | {7.0, {0.40, 27.7}}, |
Austin Schuh | 9628b8b | 2022-04-16 10:18:59 -0700 | [diff] [blame] | 152 | |
Austin Schuh | d84d431 | 2022-11-07 09:04:48 -0800 | [diff] [blame] | 153 | {10.0, {0.40, 27.7}}, |
Ravago Jones | 3283ce0 | 2022-03-09 19:31:29 -0800 | [diff] [blame] | 154 | }); |
| 155 | |
James Kuszmaul | b9ba9a5 | 2022-03-31 22:16:01 -0700 | [diff] [blame] | 156 | if (false) { |
| 157 | // 1.5 meters -> 2.7 |
| 158 | // 2.3 meters -> 4.7 |
| 159 | // 4.5 meters -> 7.0 |
| 160 | // 7.0 meters -> 9.0 |
| 161 | |
| 162 | constexpr double kShotVelocity = 9.0; |
| 163 | r.shot_velocity_interpolation_table = |
| 164 | InterpolationTable<Values::ShotVelocityParams>({ |
| 165 | {1.0, {kShotVelocity}}, |
| 166 | {10.0, {kShotVelocity}}, |
| 167 | }); |
| 168 | } else { |
| 169 | r.shot_velocity_interpolation_table = |
| 170 | InterpolationTable<Values::ShotVelocityParams>({ |
| 171 | {1.0, {2.7}}, |
| 172 | {1.5, {2.7}}, |
| 173 | {2.3, {4.7}}, |
| 174 | {4.5, {7.0}}, |
| 175 | {7.0, {9.0}}, |
| 176 | {10.0, {9.0}}, |
| 177 | }); |
| 178 | } |
| 179 | |
Milind Upadhyay | c76bb4c | 2022-09-21 09:31:48 -0700 | [diff] [blame] | 180 | Values::BallColorParams *const ball_color = &r.ball_color; |
| 181 | |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 182 | switch (team) { |
| 183 | // A set of constants for tests. |
| 184 | case 1: |
Ravago Jones | 3283ce0 | 2022-03-09 19:31:29 -0800 | [diff] [blame] | 185 | r.shot_interpolation_table = InterpolationTable<Values::ShotParams>({ |
| 186 | {2, {0.08, 8.0}}, |
| 187 | {5, {0.6, 10.0}}, |
| 188 | }); |
| 189 | |
James Kuszmaul | b9ba9a5 | 2022-03-31 22:16:01 -0700 | [diff] [blame] | 190 | r.shot_velocity_interpolation_table = |
| 191 | InterpolationTable<Values::ShotVelocityParams>({ |
| 192 | {2, {2.0}}, |
| 193 | {5, {4.0}}, |
| 194 | }); |
| 195 | |
Nathan Leong | 4afefdb | 2022-12-21 21:17:19 -0800 | [diff] [blame] | 196 | climber->potentiometer_offset = -0.035; |
| 197 | intake_front->potentiometer_offset = 3.122; |
Nathan Leong | 7fdbd66 | 2022-11-19 15:53:13 -0800 | [diff] [blame] | 198 | intake_front->subsystem_params.zeroing_constants |
Nathan Leong | 4afefdb | 2022-12-21 21:17:19 -0800 | [diff] [blame] | 199 | .measured_absolute_position = 0.175; |
| 200 | intake_back->potentiometer_offset = 3.365; |
Nathan Leong | 7fdbd66 | 2022-11-19 15:53:13 -0800 | [diff] [blame] | 201 | intake_back->subsystem_params.zeroing_constants |
Nathan Leong | 4afefdb | 2022-12-21 21:17:19 -0800 | [diff] [blame] | 202 | .measured_absolute_position = 0.051; |
| 203 | turret->potentiometer_offset = -7.932; |
Nathan Leong | 7fdbd66 | 2022-11-19 15:53:13 -0800 | [diff] [blame] | 204 | turret->subsystem_params.zeroing_constants.measured_absolute_position = |
Nathan Leong | 4afefdb | 2022-12-21 21:17:19 -0800 | [diff] [blame] | 205 | 1.166; |
| 206 | flipper_arm_left->potentiometer_offset = -6.40; |
| 207 | flipper_arm_right->potentiometer_offset = 5.56; |
Nathan Leong | 7fdbd66 | 2022-11-19 15:53:13 -0800 | [diff] [blame] | 208 | |
James Kuszmaul | 00c730d | 2022-12-14 20:29:53 -0800 | [diff] [blame] | 209 | catapult_params->zeroing_constants.measured_absolute_position = 0.0; |
Nathan Leong | 4afefdb | 2022-12-21 21:17:19 -0800 | [diff] [blame] | 210 | catapult->potentiometer_offset = -2.033; |
Milind Upadhyay | c76bb4c | 2022-09-21 09:31:48 -0700 | [diff] [blame] | 211 | |
| 212 | ball_color->reference_red = {0, 0, 1, 1}; |
| 213 | ball_color->reference_blue = {0, 0, 1, 1}; |
| 214 | ball_color->ball_location = {0, 0, 1, 1}; |
| 215 | |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 216 | break; |
| 217 | |
| 218 | case kCompTeamNumber: |
milind-u | 6e7d8d4 | 2022-04-06 18:30:43 -0700 | [diff] [blame] | 219 | climber->potentiometer_offset = -0.0463847608752 - 0.0376876182111 + |
| 220 | 0.0629263851579 - 0.00682128836400001 + |
Austin Schuh | 69379ac | 2022-04-29 21:27:05 -0700 | [diff] [blame] | 221 | 0.0172237531191 - 0.0172237531191 + |
| 222 | 0.00443383743660001 - 0.0117667224279; |
Austin Schuh | 39f26f6 | 2022-02-24 21:34:46 -0800 | [diff] [blame] | 223 | |
Philipp Schrader | 790cb54 | 2023-07-05 21:06:52 -0700 | [diff] [blame] | 224 | intake_front->potentiometer_offset = +3.572389; |
Austin Schuh | 275f981 | 2022-03-05 14:02:37 -0800 | [diff] [blame] | 225 | intake_front->subsystem_params.zeroing_constants |
James Kuszmaul | 4072704 | 2023-01-07 18:01:01 -0800 | [diff] [blame] | 226 | .measured_absolute_position = 0.238611243887673; |
Austin Schuh | 275f981 | 2022-03-05 14:02:37 -0800 | [diff] [blame] | 227 | |
Austin Schuh | 463abe2 | 2022-04-15 19:15:49 -0700 | [diff] [blame] | 228 | intake_back->potentiometer_offset = |
| 229 | 3.1409576474047 + 0.278653334013286 + 0.00879137908308503 + |
Austin Schuh | 69379ac | 2022-04-29 21:27:05 -0700 | [diff] [blame] | 230 | 0.0837134053818833 + 0.832945730100298 - 0.00759895654985426 - |
| 231 | 2.03114758819475 + 0.318379597392509 + 0.675664531140745 + |
James Kuszmaul | 4072704 | 2023-01-07 18:01:01 -0800 | [diff] [blame] | 232 | 0.0650864893911517 - 0.0202318432257168 - 0.0561212375592096; |
Austin Schuh | 275f981 | 2022-03-05 14:02:37 -0800 | [diff] [blame] | 233 | intake_back->subsystem_params.zeroing_constants |
James Kuszmaul | 4072704 | 2023-01-07 18:01:01 -0800 | [diff] [blame] | 234 | .measured_absolute_position = 0.292329083185933; |
Austin Schuh | 275f981 | 2022-03-05 14:02:37 -0800 | [diff] [blame] | 235 | |
milind-u | c63d094 | 2022-04-15 12:07:42 -0700 | [diff] [blame] | 236 | turret->potentiometer_offset = |
| 237 | -9.99970387166721 + 0.06415943 + 0.073290115367682 - |
| 238 | 0.0634440443622909 + 0.213601224728352 + 0.0657973101027296 - |
| 239 | 0.114726411377978 - 0.980314029089968 - 0.0266013159299456 + |
Austin Schuh | 69379ac | 2022-04-29 21:27:05 -0700 | [diff] [blame] | 240 | 0.0631240002215899 + 0.222882504808653 + 0.0370686419434252 - |
Austin Schuh | d84d431 | 2022-11-07 09:04:48 -0800 | [diff] [blame] | 241 | 0.0965027214840068 - 0.126737479717192 - 0.0773753775457 + |
| 242 | 2.8132444751306; |
Austin Schuh | 275f981 | 2022-03-05 14:02:37 -0800 | [diff] [blame] | 243 | turret->subsystem_params.zeroing_constants.measured_absolute_position = |
Austin Schuh | d84d431 | 2022-11-07 09:04:48 -0800 | [diff] [blame] | 244 | 1.16683731504739; |
Austin Schuh | 275f981 | 2022-03-05 14:02:37 -0800 | [diff] [blame] | 245 | |
| 246 | flipper_arm_left->potentiometer_offset = -6.4; |
Austin Schuh | 6b1e4d9 | 2022-03-12 12:02:46 -0800 | [diff] [blame] | 247 | flipper_arm_right->potentiometer_offset = 5.56; |
Austin Schuh | 275f981 | 2022-03-05 14:02:37 -0800 | [diff] [blame] | 248 | |
Austin Schuh | d84d431 | 2022-11-07 09:04:48 -0800 | [diff] [blame] | 249 | *turret_range = ::frc971::constants::Range{ |
| 250 | .lower_hard = -7.0, // Back Hard |
| 251 | .upper_hard = 3.4, // Front Hard |
| 252 | .lower = -6.4, // Back Soft |
| 253 | .upper = 2.9 // Front Soft |
| 254 | }; |
| 255 | turret_params->range = *turret_range; |
| 256 | |
Austin Schuh | 275f981 | 2022-03-05 14:02:37 -0800 | [diff] [blame] | 257 | catapult_params->zeroing_constants.measured_absolute_position = |
| 258 | 1.71723370408082; |
| 259 | catapult->potentiometer_offset = -2.03383240293769; |
Milind Upadhyay | c76bb4c | 2022-09-21 09:31:48 -0700 | [diff] [blame] | 260 | |
| 261 | ball_color->reference_red = {440, 150, 50, 130}; |
| 262 | ball_color->reference_blue = {440, 350, 30, 100}; |
| 263 | ball_color->ball_location = {100, 400, 140, 50}; |
| 264 | |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 265 | break; |
| 266 | |
| 267 | case kPracticeTeamNumber: |
Austin Schuh | d84d431 | 2022-11-07 09:04:48 -0800 | [diff] [blame] | 268 | catapult_params->range.lower = -0.885; |
| 269 | |
Milind Upadhyay | d02ae80 | 2022-09-21 09:33:48 -0700 | [diff] [blame] | 270 | r.shot_interpolation_table = InterpolationTable<Values::ShotParams>({ |
| 271 | {1.0, {0.08, 20.0}}, |
| 272 | {1.6, {0.08, 20.0}}, |
| 273 | {1.9, {0.11, 20.0}}, |
| 274 | {2.12, {0.15, 20.5}}, |
| 275 | {2.9, {0.27, 20.2}}, |
| 276 | |
| 277 | {3.2, {0.29, 20.6}}, |
| 278 | |
| 279 | {3.60, {0.36, 21.0}}, |
| 280 | {4.50, {0.41, 22.7}}, |
| 281 | {4.9, {0.42, 23.3}}, |
| 282 | {5.4, {0.42, 24.6}}, |
| 283 | |
| 284 | {6.0, {0.42, 26.25}}, |
| 285 | {7.0, {0.39, 28.25}}, |
| 286 | |
| 287 | {10.0, {0.39, 28.25}}, |
| 288 | }); |
| 289 | |
Austin Schuh | d84d431 | 2022-11-07 09:04:48 -0800 | [diff] [blame] | 290 | climber->potentiometer_offset = |
| 291 | -0.1209073362519 + 0.0760598 - 0.0221716219244 - 0.00321684; |
Milind Upadhyay | a10e5e0 | 2022-09-10 22:57:25 -0700 | [diff] [blame] | 292 | intake_front->potentiometer_offset = 3.06604378582351 - 0.60745632979918; |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 293 | intake_front->subsystem_params.zeroing_constants |
Milind Upadhyay | a10e5e0 | 2022-09-10 22:57:25 -0700 | [diff] [blame] | 294 | .measured_absolute_position = 0.143667561169188; |
Milind Upadhyay | d7b9eca | 2022-09-26 21:28:03 -0700 | [diff] [blame] | 295 | intake_back->potentiometer_offset = |
| 296 | 3.10861174832838 + 0.431432052414186 - 0.171422335492571 + |
| 297 | 0.0414174770317617 + 0.0908883523752557 - 0.0632767010207473; |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 298 | intake_back->subsystem_params.zeroing_constants |
Milind Upadhyay | d7b9eca | 2022-09-26 21:28:03 -0700 | [diff] [blame] | 299 | .measured_absolute_position = 0.404628372743507; |
Milind Upadhyay | 4e9f260 | 2022-09-22 14:47:54 -0700 | [diff] [blame] | 300 | |
Milind Upadhyay | ac29d02 | 2022-09-24 20:43:52 -0700 | [diff] [blame] | 301 | turret->potentiometer_offset = |
| 302 | -8.14418207451834 + 0.342635491808218 - 0.944807955598189 - |
| 303 | 0.0718028442723373 - 0.0793332946417493 + 0.233707527214682 + |
| 304 | 0.0828349540635251 + 0.677740533247017 - 0.0828349540635251 - |
| 305 | 0.0903654044329345 - 0.105426305171759 - 0.150609007388226 - |
Austin Schuh | d84d431 | 2022-11-07 09:04:48 -0800 | [diff] [blame] | 306 | 0.0338870266623506 - 0.0677740533247011 - 0.135548106649404 - 0.6852; |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 307 | turret->subsystem_params.zeroing_constants.measured_absolute_position = |
Austin Schuh | d84d431 | 2022-11-07 09:04:48 -0800 | [diff] [blame] | 308 | 0.8306; |
| 309 | *turret_range = ::frc971::constants::Range{ |
| 310 | .lower_hard = -7.0, // Back Hard |
| 311 | .upper_hard = 3.4, // Front Hard |
| 312 | .lower = -6.4, // Back Soft |
| 313 | .upper = 2.9 // Front Soft |
| 314 | }; |
Milind Upadhyay | e9075d1 | 2022-04-12 22:45:16 -0700 | [diff] [blame] | 315 | turret_params->range = *turret_range; |
Nathan Leong | 4afefdb | 2022-12-21 21:17:19 -0800 | [diff] [blame] | 316 | flipper_arm_left->potentiometer_offset = |
| 317 | -4.39536583413615 - 0.108401297910291; |
| 318 | flipper_arm_right->potentiometer_offset = |
| 319 | 4.36264091401229 + 0.175896445665755; |
Austin Schuh | 39f26f6 | 2022-02-24 21:34:46 -0800 | [diff] [blame] | 320 | |
Milind Upadhyay | e9075d1 | 2022-04-12 22:45:16 -0700 | [diff] [blame] | 321 | catapult_params->zeroing_constants.measured_absolute_position = |
| 322 | 1.62909518684227; |
| 323 | catapult->potentiometer_offset = -1.52951814169821 - 0.0200812009850977; |
Milind Upadhyay | c76bb4c | 2022-09-21 09:31:48 -0700 | [diff] [blame] | 324 | |
| 325 | ball_color->reference_red = {526, 75, 110, 220}; |
| 326 | ball_color->reference_blue = {526, 340, 110, 100}; |
| 327 | ball_color->ball_location = {40, 440, 200, 30}; |
| 328 | |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 329 | break; |
| 330 | |
| 331 | case kCodingRobotTeamNumber: |
Ravago Jones | 3283ce0 | 2022-03-09 19:31:29 -0800 | [diff] [blame] | 332 | r.shot_interpolation_table = InterpolationTable<Values::ShotParams>({ |
| 333 | {2, {0.08, 8.0}}, |
| 334 | {5, {0.6, 10.0}}, |
| 335 | }); |
| 336 | |
James Kuszmaul | b9ba9a5 | 2022-03-31 22:16:01 -0700 | [diff] [blame] | 337 | r.shot_velocity_interpolation_table = |
| 338 | InterpolationTable<Values::ShotVelocityParams>({ |
| 339 | {2, {2.0}}, |
| 340 | {5, {4.0}}, |
| 341 | }); |
| 342 | |
Siddhant Kanwar | 0e37f59 | 2022-02-21 19:26:50 -0800 | [diff] [blame] | 343 | climber->potentiometer_offset = 0.0; |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 344 | intake_front->potentiometer_offset = 0.0; |
| 345 | intake_front->subsystem_params.zeroing_constants |
| 346 | .measured_absolute_position = 0.0; |
| 347 | intake_back->potentiometer_offset = 0.0; |
| 348 | intake_back->subsystem_params.zeroing_constants |
| 349 | .measured_absolute_position = 0.0; |
| 350 | turret->potentiometer_offset = 0.0; |
| 351 | turret->subsystem_params.zeroing_constants.measured_absolute_position = |
| 352 | 0.0; |
Griffin Bui | bcbef48 | 2022-02-23 15:32:10 -0800 | [diff] [blame] | 353 | flipper_arm_left->potentiometer_offset = 0.0; |
| 354 | flipper_arm_right->potentiometer_offset = 0.0; |
Austin Schuh | 39f26f6 | 2022-02-24 21:34:46 -0800 | [diff] [blame] | 355 | |
| 356 | catapult_params->zeroing_constants.measured_absolute_position = 0.0; |
| 357 | catapult->potentiometer_offset = 0.0; |
Milind Upadhyay | c76bb4c | 2022-09-21 09:31:48 -0700 | [diff] [blame] | 358 | |
| 359 | ball_color->reference_red = {0, 0, 1, 1}; |
| 360 | ball_color->reference_blue = {0, 0, 1, 1}; |
| 361 | ball_color->ball_location = {0, 0, 1, 1}; |
| 362 | |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 363 | break; |
| 364 | |
| 365 | default: |
| 366 | LOG(FATAL) << "unknown team: " << team; |
| 367 | } |
| 368 | |
Nathan Leong | 342b85e | 2023-01-08 13:49:33 -0800 | [diff] [blame] | 369 | CHECK(frc971::wpilib::SafePotVoltageRange( |
| 370 | Values::kClimberRange(), climber->potentiometer_offset, |
| 371 | [](double meters) { return meters / Values::kClimberPotMetersPerVolt(); }, |
| 372 | false)) |
| 373 | << "Couldn't translate climber pot"; |
| 374 | CHECK(frc971::wpilib::SafePotVoltageRange( |
| 375 | Values::kFlipperArmRange(), flipper_arm_left->potentiometer_offset, |
| 376 | [](double radians) { |
| 377 | return radians / Values::kFlipperArmsPotRadiansPerVolt(); |
| 378 | }, |
| 379 | false)) |
| 380 | << "Couldn't translate flipper left pot"; |
| 381 | CHECK(frc971::wpilib::SafePotVoltageRange( |
| 382 | Values::kFlipperArmRange(), flipper_arm_right->potentiometer_offset, |
| 383 | [](double radians) { |
| 384 | return radians / Values::kFlipperArmsPotRadiansPerVolt(); |
| 385 | }, |
| 386 | true)) |
| 387 | << "Couldn't translate flipper right pot"; |
| 388 | CHECK(frc971::wpilib::SafePotVoltageRange( |
| 389 | Values::kIntakeRange(), intake_front->potentiometer_offset, |
| 390 | [](double radians) { |
| 391 | return radians / Values::kIntakePotRadiansPerVolt(); |
| 392 | }, |
| 393 | true)) |
| 394 | << "Couldn't translate front intake pot"; |
| 395 | CHECK(frc971::wpilib::SafePotVoltageRange( |
| 396 | Values::kIntakeRange(), intake_back->potentiometer_offset, |
| 397 | [](double radians) { |
| 398 | return radians / Values::kIntakePotRadiansPerVolt(); |
| 399 | }, |
| 400 | true)) |
| 401 | << "Couldn't translate back intake pot"; |
| 402 | CHECK(frc971::wpilib::SafePotVoltageRange( |
| 403 | *turret_range, turret->potentiometer_offset, |
| 404 | [](double radians) { |
| 405 | return radians / Values::kTurretPotRadiansPerVolt(); |
| 406 | }, |
| 407 | false)) |
| 408 | << "Couldn't translate turret pot"; |
| 409 | |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 410 | return r; |
| 411 | } |
| 412 | |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 413 | Values MakeValues() { return MakeValues(aos::network::GetTeamNumber()); } |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 414 | |
| 415 | } // namespace constants |
| 416 | } // namespace y2022 |