diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/LTVDifferentialDriveController.java b/wpimath/src/main/java/edu/wpi/first/math/controller/LTVDifferentialDriveController.java index dd0459ff38..2be2a478ec 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/LTVDifferentialDriveController.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/LTVDifferentialDriveController.java @@ -22,9 +22,16 @@ import edu.wpi.first.math.trajectory.Trajectory; /** * The linear time-varying differential drive controller has a similar form to the LQR, but the - * model used to compute the controller gain is the nonlinear model linearized around the - * drivetrain's current state. We precomputed gains for important places in our state-space, then - * interpolated between them with a LUT to save computational resources. + * model used to compute the controller gain is the nonlinear differential drive model linearized + * around the drivetrain's current state. We precompute gains for important places in our + * state-space, then interpolate between them with a lookup table to save computational resources. + * + *

This controller has a flat hierarchy with pose and wheel velocity references and voltage + * outputs. This is different from a Ramsete controller's nested hierarchy where the top-level + * controller has a pose reference and chassis velocity command outputs, and the low-level + * controller has wheel velocity references and voltage outputs. Flat hierarchies are easier to tune + * in one shot. Furthermore, this controller is more optimal in the "least-squares error" sense than + * a controller based on Ramsete. * *

See section 8.7 in Controls Engineering in FRC for a derivation of the control law we used * shown in theorem 8.7.4. diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/LTVUnicycleController.java b/wpimath/src/main/java/edu/wpi/first/math/controller/LTVUnicycleController.java index ad3bd94f30..7e3391f733 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/LTVUnicycleController.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/LTVUnicycleController.java @@ -21,8 +21,11 @@ import edu.wpi.first.math.trajectory.Trajectory; /** * The linear time-varying unicycle controller has a similar form to the LQR, but the model used to - * compute the controller gain is the nonlinear model linearized around the drivetrain's current - * state. + * compute the controller gain is the nonlinear unicycle model linearized around the drivetrain's + * current state. + * + *

This controller is a roughly drop-in replacement for {@link RamseteController} with more + * optimal feedback gains in the "least-squares error" sense. * *

See section 8.9 in Controls Engineering in FRC for a derivation of the control law we used * shown in theorem 8.9.1. diff --git a/wpimath/src/main/native/include/frc/controller/LTVDifferentialDriveController.h b/wpimath/src/main/native/include/frc/controller/LTVDifferentialDriveController.h index 3995d3a3a7..94f3fa37b7 100644 --- a/wpimath/src/main/native/include/frc/controller/LTVDifferentialDriveController.h +++ b/wpimath/src/main/native/include/frc/controller/LTVDifferentialDriveController.h @@ -23,9 +23,17 @@ namespace frc { /** * The linear time-varying differential drive controller has a similar form to * the LQR, but the model used to compute the controller gain is the nonlinear - * model linearized around the drivetrain's current state. We precomputed gains - * for important places in our state-space, then interpolated between them with - * a LUT to save computational resources. + * differential drive model linearized around the drivetrain's current state. We + * precompute gains for important places in our state-space, then interpolate + * between them with a lookup table to save computational resources. + * + * This controller has a flat hierarchy with pose and wheel velocity references + * and voltage outputs. This is different from a Ramsete controller's nested + * hierarchy where the top-level controller has a pose reference and chassis + * velocity command outputs, and the low-level controller has wheel velocity + * references and voltage outputs. Flat hierarchies are easier to tune in one + * shot. Furthermore, this controller is more optimal in the "least-squares + * error" sense than a controller based on Ramsete. * * See section 8.7 in Controls Engineering in FRC for a derivation of the * control law we used shown in theorem 8.7.4. diff --git a/wpimath/src/main/native/include/frc/controller/LTVUnicycleController.h b/wpimath/src/main/native/include/frc/controller/LTVUnicycleController.h index b128dbb7d4..38c4287d21 100644 --- a/wpimath/src/main/native/include/frc/controller/LTVUnicycleController.h +++ b/wpimath/src/main/native/include/frc/controller/LTVUnicycleController.h @@ -20,8 +20,11 @@ namespace frc { /** * The linear time-varying unicycle controller has a similar form to the LQR, - * but the model used to compute the controller gain is the nonlinear model - * linearized around the drivetrain's current state. + * but the model used to compute the controller gain is the nonlinear unicycle + * model linearized around the drivetrain's current state. + * + * This controller is a roughly drop-in replacement for RamseteController with + * more optimal feedback gains in the "least-squares error" sense. * * See section 8.9 in Controls Engineering in FRC for a derivation of the * control law we used shown in theorem 8.9.1.