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}}
71constexpr auto potMotors = frozen::make_unordered_map<motorid_t, potparams_t>({
73 {.adc_lo = 1208, .mdeg_lo = -180 * 1000, .adc_hi = 841, .mdeg_hi = 180 * 1000}},
74 {motorid_t::wristDiffLeft,
75 {.adc_lo = 0, .mdeg_lo = -100 * 0, .adc_hi = 0, .mdeg_hi = 100 * 0}},
76 {motorid_t::wristDiffRight,
77 {.adc_lo = 0, .mdeg_lo = -100 * 0, .adc_hi = 0, .mdeg_hi = 100 * 0}},
78 {motorid_t::frontLeftSwerve,
79 {.adc_lo = 1422, .mdeg_lo = -180 * 1000, .adc_hi = 656, .mdeg_hi = 180 * 1000}},
80 {motorid_t::frontRightSwerve,
81 {.adc_lo = 644, .mdeg_lo = -180 * 1000, .adc_hi = 1404, .mdeg_hi = 180 * 1000}},
82 {motorid_t::rearLeftSwerve,
83 {.adc_lo = 1260, .mdeg_lo = -180 * 1000, .adc_hi = 476, .mdeg_hi = 180 * 1000}},
84 {motorid_t::rearRightSwerve,
85 {.adc_lo = 1538, .mdeg_lo = -180 * 1000, .adc_hi = 767, .mdeg_hi = 180 * 1000}},
89constexpr auto motorSerialIDMap = frozen::make_unordered_map<motorid_t, can::deviceserial_t>(
90 {{motorid_t::frontLeftWheel, DEVICE_SERIAL_MOTOR_CHASSIS_FL},
91 {motorid_t::frontRightWheel, DEVICE_SERIAL_MOTOR_CHASSIS_FR},
92 {motorid_t::rearLeftWheel, DEVICE_SERIAL_MOTOR_CHASSIS_BL},
93 {motorid_t::rearRightWheel, DEVICE_SERIAL_MOTOR_CHASSIS_BR},
94 {motorid_t::frontLeftSwerve, DEVICE_SERIAL_MOTOR_CHASSIS_FL_SW},
95 {motorid_t::frontRightSwerve, DEVICE_SERIAL_MOTOR_CHASSIS_FR_SW},
96 {motorid_t::rearLeftSwerve, DEVICE_SERIAL_MOTOR_CHASSIS_BL_SW},
97 {motorid_t::rearRightSwerve, DEVICE_SERIAL_MOTOR_CHASSIS_BR_SW},
98 {motorid_t::armBase, DEVICE_SERIAL_MOTOR_BASE},
99 {motorid_t::shoulder, DEVICE_SERIAL_MOTOR_SHOULDER},
100 {motorid_t::elbow, DEVICE_SERIAL_MOTOR_ELBOW},
101 {motorid_t::forearm, DEVICE_SERIAL_MOTOR_FOREARM},
102 {motorid_t::wristDiffLeft, DEVICE_SERIAL_MOTOR_WRIST_DIFF_LEFT},
103 {motorid_t::wristDiffRight, DEVICE_SERIAL_MOTOR_WRIST_DIFF_RIGHT},
104 {motorid_t::hand, DEVICE_SERIAL_MOTOR_HAND},
105 {motorid_t::activeSuspension, DEVICE_SERIAL_LINEAR_ACTUATOR},
106 {motorid_t::drillActuator, DEVICE_SERIAL_DRILL_ARM_MOTOR},
107 {motorid_t::drillMotor, DEVICE_SERIAL_DRILL_MOTOR}});
110constexpr auto motorPIDMap = frozen::make_unordered_map<motorid_t, pidcoef_t>(
111 {{motorid_t::shoulder, {70, 0, 0}},
112 {motorid_t::frontLeftSwerve, {2, 0, 0}},
113 {motorid_t::frontRightSwerve, {2, 0, 0}},
114 {motorid_t::rearLeftSwerve, {2, 0, 0}},
115 {motorid_t::rearRightSwerve, {2, 0, 0}}});
122 frozen::make_unordered_map<motorid_t, double>({{motorid_t::armBase, -0.25},
123 {motorid_t::shoulder, -1},
124 {motorid_t::elbow, -1},
125 {motorid_t::forearm, -0.2},
126 {motorid_t::wristDiffLeft, -0.1},
127 {motorid_t::wristDiffRight, 0.1},
128 {motorid_t::frontLeftWheel, 0.7},
129 {motorid_t::frontRightWheel, 0.7},
130 {motorid_t::rearLeftWheel, 0.7},
131 {motorid_t::rearRightWheel, 0.7},
132 {motorid_t::frontLeftSwerve, 1.0},
133 {motorid_t::frontRightSwerve, 1.0},
134 {motorid_t::rearLeftSwerve, 1.0},
135 {motorid_t::rearRightSwerve, 1.0},
136 {motorid_t::hand, -0.75},
137 {motorid_t::activeSuspension, -0.5},
138 {motorid_t::drillActuator, -0.5},
139 {motorid_t::drillMotor, 1.0}});
145 frozen::make_unordered_map<motorid_t, double>({{motorid_t::armBase, -0.25},
146 {motorid_t::shoulder, -1},
147 {motorid_t::elbow, -1},
148 {motorid_t::forearm, -0.2},
149 {motorid_t::wristDiffLeft, -0.1},
150 {motorid_t::wristDiffRight, 0.1},
151 {motorid_t::frontLeftWheel, 0.7},
152 {motorid_t::frontRightWheel, 0.7},
153 {motorid_t::rearLeftWheel, 0.7},
154 {motorid_t::rearRightWheel, 0.7},
155 {motorid_t::frontLeftSwerve, 1.0},
156 {motorid_t::frontRightSwerve, 1.0},
157 {motorid_t::rearLeftSwerve, 1.0},
158 {motorid_t::rearRightSwerve, 1.0},
159 {motorid_t::hand, -0.75},
160 {motorid_t::activeSuspension, -0.5},
161 {motorid_t::drillActuator, -0.5},
162 {motorid_t::drillMotor, 1.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:89
constexpr auto positive_pwm_scales
A mapping of motorids to power scale factors when commanded with positive power.
Definition real_world_constants.h:121
constexpr auto motorPIDMap
A mapping of PID controlled motors to their pid coefficients.
Definition real_world_constants.h:110
constexpr auto negative_pwm_scales
A mapping of motorids to power scale factors when commanded with negative power.
Definition real_world_constants.h:144
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