blob: 80c2a7a475a91132efa65018db316df35f74d5aa [file] [log] [blame]
Ariv Diggi0af59c02023-10-07 13:15:39 -07001#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 Henderson43684fa2023-11-06 11:08:06 -080015#include "y2023_bot3/control_loops/superstructure/pivot_joint/integral_pivot_joint_plant.h"
Ariv Diggi0af59c02023-10-07 13:15:39 -070016
17namespace y2023_bot3 {
18namespace constants {
19
20Values MakeValues(uint16_t team) {
21 LOG(INFO) << "creating a Constants for team: " << team;
22
23 Values r;
Maxwell Henderson43684fa2023-11-06 11:08:06 -080024 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 Diggi0af59c02023-10-07 13:15:39 -070043 switch (team) {
44 // A set of constants for tests.
45 case 1:
Maxwell Henderson43684fa2023-11-06 11:08:06 -080046
Maxwell Henderson9435b5c2023-11-06 13:48:51 -080047 pivot_joint->potentiometer_offset = 0.0;
48
Maxwell Henderson43684fa2023-11-06 11:08:06 -080049 pivot_joint->subsystem_params.zeroing_constants
50 .measured_absolute_position = 0.0;
51
Ariv Diggi0af59c02023-10-07 13:15:39 -070052 break;
53
54 case kThirdRobotTeamNumber:
55 break;
56
57 default:
58 LOG(FATAL) << "unknown team: " << team;
59 }
60
61 return r;
62}
63
64Values MakeValues() { return MakeValues(aos::network::GetTeamNumber()); }
65
66} // namespace constants
67} // namespace y2023_bot3