// Since negative values in setMotorSpeeds(...) are forwards, we reverse
// speed here so positive input values will move the robot forwards.
this.speed = -speed;
- this.distance = distance;
+
+ // ensure distance is positive
+ this.distance = Math.max(distance, -distance);
}
@Override
@Override
protected boolean isFinished() {
- return Robot.driveTrain.getLeftDistance() >= distance
- && Robot.driveTrain.getRightDistance() >= distance;
+ return Math.abs(Robot.driveTrain.getLeftDistance()) >= distance
+ && Math.abs(Robot.driveTrain.getRightDistance()) >= distance;
}
@Override