3#include "../CAN/CANUtils.h"
4#include "../Constants.h"
12#include <frozen/unordered_map.h>
13#include <frozen/unordered_set.h>
60constexpr auto encMotors = frozen::make_unordered_map<motorid_t, encparams_t>({
63 .ppjr = 4590 * 1024 * 4,
64 .limitSwitchLow = Constants::arm::JOINT_LIMITS.at(robot::types::motorid_t::shoulder).first,
65 .limitSwitchHigh = Constants::arm::JOINT_LIMITS.at(robot::types::motorid_t::shoulder).second,
66 .zeroCalibrationPower = 0.4}},
69constexpr double FOURBAR_GEAR_RATIO = 71.71875;
73constexpr auto potMotors = frozen::make_unordered_map<motorid_t, potparams_t>({
75 {.adc_lo = 1208, .mdeg_lo = -180 * 1000, .adc_hi = 841, .mdeg_hi = 180 * 1000}},
76 {motorid_t::wristDiffLeft,
77 {.adc_lo = 0, .mdeg_lo = -100 * 0, .adc_hi = 0, .mdeg_hi = 100 * 0}},
78 {motorid_t::wristDiffRight,
79 {.adc_lo = 0, .mdeg_lo = -100 * 0, .adc_hi = 0, .mdeg_hi = 100 * 0}},
80 {motorid_t::fourbar1, {.adc_lo = 8, .mdeg_lo = 75200, .adc_hi = 8, .mdeg_hi = 267500}},
84constexpr auto motorSerialIDMap = frozen::make_unordered_map<motorid_t, can::deviceserial_t>(
85 {{motorid_t::leftTread, DEVICE_SERIAL_TREAD_LEFT},
86 {motorid_t::rightTread, DEVICE_SERIAL_TREAD_RIGHT},
87 {motorid_t::armBase, DEVICE_SERIAL_MOTOR_BASE},
88 {motorid_t::shoulder, DEVICE_SERIAL_MOTOR_SHOULDER},
89 {motorid_t::elbow, DEVICE_SERIAL_MOTOR_ELBOW},
90 {motorid_t::forearm, DEVICE_SERIAL_MOTOR_FOREARM},
91 {motorid_t::wristDiffLeft, DEVICE_SERIAL_MOTOR_WRIST_DIFF_LEFT},
92 {motorid_t::wristDiffRight, DEVICE_SERIAL_MOTOR_WRIST_DIFF_RIGHT},
93 {motorid_t::hand, DEVICE_SERIAL_MOTOR_HAND},
94 {motorid_t::drillActuator, DEVICE_SERIAL_DRILL_ACTUATOR},
95 {motorid_t::drillMotor, DEVICE_SERIAL_DRILL_MOTOR},
96 {motorid_t::fourbar1, DEVICE_SERIAL_FOUR_BAR_LINKAGE_1},
97 {motorid_t::fourbar2, DEVICE_SERIAL_FOUR_BAR_LINKAGE_2},
98 {motorid_t::scienceServoBoard, DEVICE_SERIAL_SCIENCE_SERVO},
99 {motorid_t::scienceStepperBoard, DEVICE_SERIAL_SCIENCE_STEPPER}});
101constexpr auto motorGroupMap = frozen::make_unordered_map<motorid_t, can::devicegroup_t>(
102 {{motorid_t::leftTread, can::devicegroup_t::motor},
103 {motorid_t::rightTread, can::devicegroup_t::motor},
104 {motorid_t::armBase, can::devicegroup_t::motor},
105 {motorid_t::shoulder, can::devicegroup_t::motor},
106 {motorid_t::elbow, can::devicegroup_t::motor},
107 {motorid_t::forearm, can::devicegroup_t::motor},
108 {motorid_t::wristDiffLeft, can::devicegroup_t::motor},
109 {motorid_t::wristDiffRight, can::devicegroup_t::motor},
110 {motorid_t::hand, can::devicegroup_t::motor},
111 {motorid_t::drillActuator, can::devicegroup_t::science},
112 {motorid_t::drillMotor, can::devicegroup_t::science},
113 {motorid_t::fourbar1, can::devicegroup_t::science},
114 {motorid_t::fourbar2, can::devicegroup_t::science},
115 {motorid_t::scienceServoBoard, can::devicegroup_t::science},
116 {motorid_t::scienceStepperBoard, can::devicegroup_t::science}});
120 frozen::make_unordered_map<motorid_t, pidcoef_t>({{motorid_t::shoulder, {70, 0, 0}}});
127 frozen::make_unordered_map<motorid_t, double>({{motorid_t::armBase, -0.25},
128 {motorid_t::shoulder, -1},
129 {motorid_t::elbow, -1},
130 {motorid_t::forearm, -0.2},
131 {motorid_t::wristDiffLeft, -0.1},
132 {motorid_t::wristDiffRight, 0.1},
133 {motorid_t::leftTread, 0.7},
134 {motorid_t::rightTread, 0.7},
135 {motorid_t::hand, -0.75},
136 {motorid_t::drillActuator, -0.5},
137 {motorid_t::drillMotor, -1.0},
138 {motorid_t::fourbar1, 0.3},
139 {motorid_t::fourbar2, 0.3},
140 {motorid_t::scienceServoBoard, 0},
141 {motorid_t::scienceStepperBoard, 0}});
147 frozen::make_unordered_map<motorid_t, double>({{motorid_t::armBase, -0.25},
148 {motorid_t::shoulder, -1},
149 {motorid_t::elbow, -1},
150 {motorid_t::forearm, -0.2},
151 {motorid_t::wristDiffLeft, -0.1},
152 {motorid_t::wristDiffRight, 0.1},
153 {motorid_t::leftTread, 0.7},
154 {motorid_t::rightTread, 0.7},
155 {motorid_t::hand, -0.75},
156 {motorid_t::drillActuator, -0.5},
157 {motorid_t::drillMotor, -1.0},
158 {motorid_t::fourbar1, 0.15},
159 {motorid_t::fourbar2, 0.15},
160 {motorid_t::scienceServoBoard, 0},
161 {motorid_t::scienceStepperBoard, 0}});
duration< int64_t, milli > milliseconds
motorid_t
The motors on the robot.
Definition data.h:57
Collection of functions for manipulating a motor.
Definition ArduPilotInterface.cpp:27
constexpr std::chrono::milliseconds TELEM_PERIOD(50)
The default telemetry period for motors.
constexpr auto motorSerialIDMap
A mapping of motorids to their corresponding serial number.
Definition real_world_constants.h:84
constexpr auto positive_pwm_scales
A mapping of motorids to power scale factors when commanded with positive power.
Definition real_world_constants.h:126
constexpr auto motorPIDMap
A mapping of PID controlled motors to their pid coefficients.
Definition real_world_constants.h:119
constexpr auto negative_pwm_scales
A mapping of motorids to power scale factors when commanded with negative power.
Definition real_world_constants.h:146
Definition real_world_constants.h:46
int limitSwitchHigh
Limit switch high, in millidegrees.
Definition real_world_constants.h:54
double zeroCalibrationPower
Power value set during limit switch calibration.
Definition real_world_constants.h:56
bool isInverted
Whether the encoder motor is inverted.
Definition real_world_constants.h:48
int ppjr
Encoder pulses count per joint revolution.
Definition real_world_constants.h:50
int limitSwitchLow
Limit switch low, in millidegrees.
Definition real_world_constants.h:52
A struct containing a set of PID coefficients.
Definition real_world_constants.h:20
Represents parameters defining a potentiometer scale.
Definition real_world_constants.h:35
uint16_t adc_hi
The "high" point on the ADC scale.
Definition real_world_constants.h:41
uint16_t adc_lo
The "low" point on the ADC scale.
Definition real_world_constants.h:37
int32_t mdeg_hi
The "high" point on the joint rotation scale.
Definition real_world_constants.h:43
int32_t mdeg_lo
The "low" point on the joint rotation scale.
Definition real_world_constants.h:39