RAMSETE Controller
A nonlinear feedback controller for correcting robot position in the global coordinate system.
Prerequisites
A basic understanding of matrix multiplication
A basic understanding of trigonometry
The RAMSETE controller is in a unique class of control algorithms, along with Pure Pursuit, that are designed to be used with the 2D motion of mobile robots. Typical controllers like PID operate in the local frame of the robot, controlling the robot's forward and backwards motion for example. The RAMSETE controller, on the other hand, controls the robot's global x, y, and heading position.
In order to control the robot's global position, we must first know the robot's current position and know the desired global position of the robot. We can find the robot's current position through Odometry. The desired global position for the robot can be a single (x, y, theta)
point or a point along a computed path.
Computing Error
The first step with any control algorithm is determining the current error value. We can easily compute the robot's error in the global frame by subtracting the desired position from the current position.
These error values don't give us much actionable data to control the robot though. For example, if the robot is facing the positive Y direction we can command the robot to drive forward to reduce the error in Y. However, if the robot is facing the positive X direction, commanding the robot to drive forward will reduce error in X this time and have no impact on the error in Y. We need to transform the error into a more useful form, the robot's local frame.
Applying the following transformation matrix to the global error vector gives us the robot's local error:
Where X in the local frame is the forward/backward direction of the robot's drivetrain.
Computing the Output Velocities
Now that we know the local error that the robot needs to correct for, we can calculate the angular and linear velocities to command the robot.
The first step is defining our controller's gain value. That gain comes from a few factors:
: Roughly a proportional term for the controller. Large values of will result in a more aggressive controller. Must be > 0.
: Roughly a damping term (like the D term of a PID controller). Must be between 0 and 1.
: The desired linear velocity. This can come from a computed path or can be another tuning factor.
: The desired angular velocity. This can come from a computed path or can be another tuning factor.
These factors combine with the following equation to give us a gain value for the controller:
Tuning the Desired Velocities
Tuning the and values is a bit tricky when they are not provided from a pre-computed path. If the controller is being used for correcting the robot's pose to a desired stopped position, for example, the desired velocity for the robot would be zero. However, setting these desired velocity values to zero will result in no output from the controller.
In a situation like this, it is recommended to set the desired velocity values to a small, non-zero value roughly scaled to the current error in the robot's local frame.
Do bear in mind, though, that the RAMSETE controller performs best when provided with a motion profile to follow rather than tuned, constant desired velocity values.
Outputs
The gain value is applied to the desired linear velocity (), angular velocity (), and the local error (, , and ) to give us these velocity commands:
Commanding the Robot
The output of the RAMSETE controller is a linear velocity and an angular velocity. These values need to be transformed to command a typical tank-drive robot.
The linear velocity can be converted to the robot's left and right wheel velocities using the following equation:
The angular velocity can be converted to the robot's left and right wheel velocities using the following equation:
Since the positive direction is turning the robot to the right, we'll apply the the angularMotorVelocity
to get the following left and right wheel velocities
References:
Teams Contributed to this Article:
BLRS (Purdue SIGBots)
Last updated