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