mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpimath] Disallow LTV controller max velocities above 15 m/s (#5495)
15 m/s is about 50 ft/s, which is way above what FRC robots should be able to achieve. This limit lets us catch user errors from bad unit conversions immediately instead of the LUT generation in the LTV controllers hanging for a really long time. Fixes #5027.
This commit is contained in:
@@ -68,7 +68,11 @@ LTVDifferentialDriveController::LTVDifferentialDriveController(
|
||||
|
||||
if (maxV <= 0_mps) {
|
||||
throw std::domain_error(
|
||||
"Max velocity of plant with 12 V input must be greater than zero.");
|
||||
"Max velocity of plant with 12 V input must be greater than 0 m/s.");
|
||||
}
|
||||
if (maxV >= 15_mps) {
|
||||
throw std::domain_error(
|
||||
"Max velocity of plant with 12 V input must be less than 15 m/s.");
|
||||
}
|
||||
|
||||
for (auto velocity = -maxV; velocity < maxV; velocity += 0.01_mps) {
|
||||
|
||||
@@ -40,7 +40,10 @@ LTVUnicycleController::LTVUnicycleController(
|
||||
const wpi::array<double, 3>& Qelems, const wpi::array<double, 2>& Relems,
|
||||
units::second_t dt, units::meters_per_second_t maxVelocity) {
|
||||
if (maxVelocity <= 0_mps) {
|
||||
throw std::domain_error("Max velocity must be greater than zero.");
|
||||
throw std::domain_error("Max velocity must be greater than 0 m/s.");
|
||||
}
|
||||
if (maxVelocity >= 15_mps) {
|
||||
throw std::domain_error("Max velocity must be less than 15 m/s.");
|
||||
}
|
||||
|
||||
// The change in global pose for a unicycle is defined by the following three
|
||||
|
||||
Reference in New Issue
Block a user