RamseteController

class wpilib.controller.RamseteController(*args, **kwargs)

Bases: pybind11_builtins.pybind11_object

Ramsete is a nonlinear time-varying feedback controller for unicycle models that drives the model to a desired pose along a two-dimensional trajectory. Why would we need a nonlinear control law in addition to the linear ones we have used so far like PID? If we use the original approach with PID controllers for left and right position and velocity states, the controllers only deal with the local pose. If the robot deviates from the path, there is no way for the controllers to correct and the robot may not reach the desired global pose. This is due to multiple endpoints existing for the robot which have the same encoder path arc lengths.

Instead of using wheel path arc lengths (which are in the robot’s local coordinate frame), nonlinear controllers like pure pursuit and Ramsete use global pose. The controller uses this extra information to guide a linear reference tracker like the PID controllers back in by adjusting the references of the PID controllers.

The paper “Control of Wheeled Mobile Robots: An Experimental Overview” describes a nonlinear controller for a wheeled vehicle with unicycle-like kinematics; a global pose consisting of x, y, and theta; and a desired pose consisting of x_d, y_d, and theta_d. We call it Ramsete because that’s the acronym for the title of the book it came from in Italian (“Robotica Articolata e Mobile per i SErvizi e le TEcnologie”).

See <https://file.tavsys.net/control/controls-engineering-in-frc.pdf> section on Ramsete unicycle controller for a derivation and analysis.

Overloaded function.

  1. __init__(self: wpilib.controller._controller.RamseteController, b: float, zeta: float) -> None

Construct a Ramsete unicycle controller.

Parameters
  • b – Tuning parameter (b > 0) for which larger values make convergence more aggressive like a proportional term.

  • zeta – Tuning parameter (0 < zeta < 1) for which larger values provide more damping in response.

  1. __init__(self: wpilib.controller._controller.RamseteController) -> None

Construct a Ramsete unicycle controller. The default arguments for b and zeta of 2.0 and 0.7 have been well-tested to produce desirable results.

atReference()bool

Returns true if the pose error is within tolerance of the reference.

calculate(*args, **kwargs)

Overloaded function.

  1. calculate(self: wpilib.controller._controller.RamseteController, currentPose: wpimath.geometry._geometry.Pose2d, poseRef: wpimath.geometry._geometry.Pose2d, linearVelocityRef: meters_per_second, angularVelocityRef: radians_per_second) -> wpimath.kinematics._kinematics.ChassisSpeeds

Returns the next output of the Ramsete controller.

The reference pose, linear velocity, and angular velocity should come from a drivetrain trajectory.

Parameters
  • currentPose – The current pose.

  • poseRef – The desired pose.

  • linearVelocityRef – The desired linear velocity.

  • angularVelocityRef – The desired angular velocity.

  1. calculate(self: wpilib.controller._controller.RamseteController, currentPose: wpimath.geometry._geometry.Pose2d, desiredState: wpimath.trajectory._trajectory.Trajectory.State) -> wpimath.kinematics._kinematics.ChassisSpeeds

Returns the next output of the Ramsete controller.

The reference pose, linear velocity, and angular velocity should come from a drivetrain trajectory.

Parameters
  • currentPose – The current pose.

  • desiredState – The desired pose, linear velocity, and angular velocity from a trajectory.

setEnabled(enabled: bool)None

Enables and disables the controller for troubleshooting purposes.

Parameters

enabled – If the controller is enabled or not.

setTolerance(poseTolerance: wpimath.geometry.Pose2d)None

Sets the pose error which is considered tolerable for use with AtReference().

Parameters

poseTolerance – Pose error which is tolerable.