Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 1 | #include "y2023_bot3/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 "glog/logging.h" |
| 12 | |
| 13 | #include "aos/mutex/mutex.h" |
| 14 | #include "aos/network/team_number.h" |
Maxwell Henderson | 43684fa | 2023-11-06 11:08:06 -0800 | [diff] [blame^] | 15 | #include "y2023_bot3/control_loops/superstructure/pivot_joint/integral_pivot_joint_plant.h" |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 16 | |
| 17 | namespace y2023_bot3 { |
| 18 | namespace constants { |
| 19 | |
| 20 | Values MakeValues(uint16_t team) { |
| 21 | LOG(INFO) << "creating a Constants for team: " << team; |
| 22 | |
| 23 | Values r; |
Maxwell Henderson | 43684fa | 2023-11-06 11:08:06 -0800 | [diff] [blame^] | 24 | auto *const pivot_joint = &r.pivot_joint; |
| 25 | |
| 26 | r.pivot_joint_flipped = true; |
| 27 | |
| 28 | pivot_joint->subsystem_params.zeroing_voltage = 3.0; |
| 29 | pivot_joint->subsystem_params.operating_voltage = 12.0; |
| 30 | pivot_joint->subsystem_params.zeroing_profile_params = {0.5, 3.0}; |
| 31 | pivot_joint->subsystem_params.default_profile_params = {0.5, 5.0}; |
| 32 | pivot_joint->subsystem_params.range = Values::kPivotJointRange(); |
| 33 | pivot_joint->subsystem_params.make_integral_loop = |
| 34 | control_loops::superstructure::pivot_joint::MakeIntegralPivotJointLoop; |
| 35 | pivot_joint->subsystem_params.zeroing_constants.average_filter_size = |
| 36 | Values::kZeroingSampleSize; |
| 37 | pivot_joint->subsystem_params.zeroing_constants.one_revolution_distance = |
| 38 | M_PI * 2.0 * constants::Values::kPivotJointEncoderRatio(); |
| 39 | pivot_joint->subsystem_params.zeroing_constants.zeroing_threshold = 0.0005; |
| 40 | pivot_joint->subsystem_params.zeroing_constants.moving_buffer_size = 20; |
| 41 | pivot_joint->subsystem_params.zeroing_constants.allowable_encoder_error = 0.9; |
| 42 | |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 43 | switch (team) { |
| 44 | // A set of constants for tests. |
| 45 | case 1: |
Maxwell Henderson | 43684fa | 2023-11-06 11:08:06 -0800 | [diff] [blame^] | 46 | |
| 47 | pivot_joint->subsystem_params.zeroing_constants |
| 48 | .measured_absolute_position = 0.0; |
| 49 | |
Ariv Diggi | 0af59c0 | 2023-10-07 13:15:39 -0700 | [diff] [blame] | 50 | break; |
| 51 | |
| 52 | case kThirdRobotTeamNumber: |
| 53 | break; |
| 54 | |
| 55 | default: |
| 56 | LOG(FATAL) << "unknown team: " << team; |
| 57 | } |
| 58 | |
| 59 | return r; |
| 60 | } |
| 61 | |
| 62 | Values MakeValues() { return MakeValues(aos::network::GetTeamNumber()); } |
| 63 | |
| 64 | } // namespace constants |
| 65 | } // namespace y2023_bot3 |