Skip to content

Commit 8a80f48

Browse files
committed
Auto will work correctly again.
The mixing and scaling that occurs for manual does not need to happen for auto Re added the gaurd that prevented this Left the capping of inputs outside the gaurd as a temp fix to overvolting/overamping that the motors where causing.
1 parent f0dd36d commit 8a80f48

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/abridge/src/abridge.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,17 @@ void driveCommandHandler(const geometry_msgs::Twist::ConstPtr& message) {
163163

164164
// Cap motor commands at 120. Experimentally determined that high values (tested 180 and 255) can cause
165165
// the hardware to fail when the robot moves itself too violently.
166-
int max_motor_cmd = 120;
166+
int max_motor_cmd = 180;
167167

168-
// Assumes left and right are always between -1 and 1
169-
float linear = left * max_motor_cmd;
170-
float angular = right * max_motor_cmd;
168+
if (currentMode == 1)
169+
{
170+
// Assumes left and right are always between -1 and 1
171+
float linear = left * max_motor_cmd;
172+
float angular = right * max_motor_cmd;
171173

172-
left = linear - angular;
173-
right = linear + angular;
174+
left = linear - angular;
175+
right = linear + angular;
176+
}
174177

175178
if (left > max_motor_cmd)
176179
{

0 commit comments

Comments
 (0)