Skip to content

Commit

Permalink
add return after MathSharedStore::ReportError
Browse files Browse the repository at this point in the history
  • Loading branch information
OhmV-IR committed Feb 21, 2025
1 parent 2d70846 commit 06a80cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions wpimath/src/main/java/edu/wpi/first/math/MathUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public static Translation2d slewRateLimit(
Exception e = new IllegalArgumentException();
MathSharedStore.reportError(
"maxVelocity must be a non-negative number, got " + maxVelocity, e.getStackTrace());
return next;
}
Translation2d diff = next.minus(current);
double dist = diff.getNorm();
Expand Down Expand Up @@ -254,6 +255,7 @@ public static Translation3d slewRateLimit(
Exception e = new IllegalArgumentException();
MathSharedStore.reportError(
"maxVelocity must be a non-negative number, got " + maxVelocity, e.getStackTrace());
return next;
}
Translation3d diff = next.minus(current);
double dist = diff.getNorm();
Expand Down
2 changes: 2 additions & 0 deletions wpimath/src/main/native/include/frc/MathUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ constexpr Translation2d SlewRateLimit(const Translation2d& current,
if (maxVelocity < 0_mps) {
wpi::math::MathSharedStore::ReportError(
"maxVelocity must be a non-negative number, got {}!", maxVelocity.value());
return next;
}
Translation2d diff = next - current;
units::meter_t dist = diff.Norm();
Expand Down Expand Up @@ -256,6 +257,7 @@ constexpr Translation3d SlewRateLimit(
if (maxVelocity < 0_mps) {
wpi::math::MathSharedStore::ReportError(
"maxVelocity must be a non-negative number, got {}!", maxVelocity.value());
return next;
}
Translation3d diff = next - current;
units::meter_t dist = diff.Norm();
Expand Down

0 comments on commit 06a80cd

Please # to comment.