mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
[wpimath] Deprecate RamseteController (#6494)
LTVUnicycleController is a drop-in replacement with better tuning knobs. The RamseteCommand examples were removed instead of retrofitted with LTVUnicycleController because we're planning on removing the command controller classes anyway, so it would be wasted effort. The SimpleDifferentialDriveSimulation example shows direct LTVUnicycleController usage.
This commit is contained in:
@@ -48,7 +48,9 @@ public class RamseteController {
|
||||
* aggressive like a proportional term.
|
||||
* @param zeta Tuning parameter (0 rad⁻¹ < zeta < 1 rad⁻¹) for which larger values provide
|
||||
* more damping in response.
|
||||
* @deprecated Use LTVUnicycleController instead.
|
||||
*/
|
||||
@Deprecated(since = "2024", forRemoval = true)
|
||||
public RamseteController(double b, double zeta) {
|
||||
m_b = b;
|
||||
m_zeta = zeta;
|
||||
@@ -57,7 +59,10 @@ public class RamseteController {
|
||||
/**
|
||||
* Construct a Ramsete unicycle controller. The default arguments for b and zeta of 2.0 rad²/m²
|
||||
* and 0.7 rad⁻¹ have been well-tested to produce desirable results.
|
||||
*
|
||||
* @deprecated Use LTVUnicycleController instead.
|
||||
*/
|
||||
@Deprecated(since = "2024", forRemoval = true)
|
||||
public RamseteController() {
|
||||
this(2.0, 0.7);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "frc/controller/RamseteController.h"
|
||||
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
#include "units/angle.h"
|
||||
#include "units/math.h"
|
||||
|
||||
@@ -26,10 +28,14 @@ RamseteController::RamseteController(units::unit_t<b_unit> b,
|
||||
units::unit_t<zeta_unit> zeta)
|
||||
: m_b{b}, m_zeta{zeta} {}
|
||||
|
||||
WPI_IGNORE_DEPRECATED
|
||||
|
||||
RamseteController::RamseteController()
|
||||
: RamseteController{units::unit_t<b_unit>{2.0},
|
||||
units::unit_t<zeta_unit>{0.7}} {}
|
||||
|
||||
WPI_UNIGNORE_DEPRECATED
|
||||
|
||||
bool RamseteController::AtReference() const {
|
||||
const auto& eTranslate = m_poseError.Translation();
|
||||
const auto& eRotate = m_poseError.Rotation();
|
||||
|
||||
@@ -56,14 +56,19 @@ class WPILIB_DLLEXPORT RamseteController {
|
||||
* convergence more aggressive like a proportional term.
|
||||
* @param zeta Tuning parameter (0 rad⁻¹ < zeta < 1 rad⁻¹) for which larger
|
||||
* values provide more damping in response.
|
||||
* @deprecated Use LTVUnicycleController instead.
|
||||
*/
|
||||
[[deprecated("Use LTVUnicycleController instead.")]]
|
||||
RamseteController(units::unit_t<b_unit> b, units::unit_t<zeta_unit> zeta);
|
||||
|
||||
/**
|
||||
* Construct a Ramsete unicycle controller. The default arguments for
|
||||
* b and zeta of 2.0 rad²/m² and 0.7 rad⁻¹ have been well-tested to produce
|
||||
* desirable results.
|
||||
*
|
||||
* @deprecated Use LTVUnicycleController instead.
|
||||
*/
|
||||
[[deprecated("Use LTVUnicycleController instead.")]]
|
||||
RamseteController();
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,7 @@ class RamseteControllerTest {
|
||||
private static final double kTolerance = 1 / 12.0;
|
||||
private static final double kAngularTolerance = Math.toRadians(2);
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Test
|
||||
void testReachesReference() {
|
||||
final var controller = new RamseteController(2.0, 0.7);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
#include "frc/MathUtil.h"
|
||||
#include "frc/controller/RamseteController.h"
|
||||
@@ -16,6 +17,8 @@ static constexpr units::meter_t kTolerance{1 / 12.0};
|
||||
static constexpr units::radian_t kAngularTolerance{2.0 * std::numbers::pi /
|
||||
180.0};
|
||||
|
||||
WPI_IGNORE_DEPRECATED
|
||||
|
||||
TEST(RamseteControllerTest, ReachesReference) {
|
||||
frc::RamseteController controller{2.0 * 1_rad * 1_rad / (1_m * 1_m),
|
||||
0.7 / 1_rad};
|
||||
@@ -43,3 +46,5 @@ TEST(RamseteControllerTest, ReachesReference) {
|
||||
robotPose.Rotation().Radians()),
|
||||
0_rad, kAngularTolerance);
|
||||
}
|
||||
|
||||
WPI_UNIGNORE_DEPRECATED
|
||||
|
||||
Reference in New Issue
Block a user