blob: 9e1902c47fdfcefbb68ea8ff5b8b6d65ce92f9aa [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
47 pivot_joint->subsystem_params.zeroing_constants
48 .measured_absolute_position = 0.0;
49
Ariv Diggi0af59c02023-10-07 13:15:39 -070050 break;
51
52 case kThirdRobotTeamNumber:
53 break;
54
55 default:
56 LOG(FATAL) << "unknown team: " << team;
57 }
58
59 return r;
60}
61
62Values MakeValues() { return MakeValues(aos::network::GetTeamNumber()); }
63
64} // namespace constants
65} // namespace y2023_bot3