Skip to content

Commit 1c22ec4

Browse files
authored
Bug fix: missing conditional.
Auto and manual motor commands should currently be treated differently. This should be revisited so that manual drive produces commands that are compatible with auto. We should also change the misused twist message type with a real value pair.
1 parent 192c253 commit 1c22ec4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/abridge/src/abridge.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,17 @@ void driveCommandHandler(const geometry_msgs::Twist::ConstPtr& message) {
165165
// the hardware to fail when the robot moves itself too violently.
166166
int max_motor_cmd = 120;
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;
171-
172-
left = linear - angular;
173-
right = linear + angular;
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;
173+
174+
left = linear - angular;
175+
right = linear + angular;
176+
}
174177

178+
// Check that the resulting motor commands do not exceed the specified safe maximum value
175179
if (left > max_motor_cmd)
176180
{
177181
left = max_motor_cmd;

0 commit comments

Comments
 (0)