LogoLogo
  • Welcome!
  • Mission Statement
  • Contributing Guidelines
    • Embed CADs in Wiki Articles
  • VEX Worlds Livestream Archive
    • VEX U
    • V5RC High School
    • V5RC Middle School
    • VIQRC Middle School
    • VIQRC Elementary School
    • JROTC
  • ⚙️Hardware
    • Design Fundamentals
      • Gear Ratios
      • Internal Forces (Stress)
      • Torque
      • RPM
      • Center of Mass
    • Introduction to VEX Parts
      • Structure
        • C-Channels and Angles
        • Fasteners
        • Retainers
        • Gussets and Brackets
        • Bearings
        • Plate Metal and Flat Bars
      • Motion
        • High Strength Components
        • Gears and Sprockets
        • Traction Wheels
        • Mecanum Wheels
        • Omnidirectional Wheels
        • Flex Wheels
    • Robot Decorations
      • Part Dyeing
      • Metal Coloring
      • License Plate Holders
    • Lifts
      • Double Reverse Four Bar (DR4B or RD4B)
      • Four Bar
      • Scissor Lift
      • Six Bar
      • Other Lifts
      • Best Practices
    • Shooting Mechanisms
      • Catapult
      • Flywheel
      • Linear Puncher
    • Drivetrains
      • Tank Drive
      • Mecanum Drive
      • Holonomic Drive
      • Designing a Drivetrain
      • Best Practices
    • Pivots & Joints
    • Pneumatics
      • Best Practices - Pneumatics
    • Intakes
    • Flip Out Mechanisms
    • Defensive Mechanisms
    • Misc. Building Techniques
    • VexU
      • Common Manufacturing Techniques
        • 3D Printing
        • Laser Cutting
      • Custom Manufactured Parts Library
      • Commercial Off The Shelf Parts Library
  • 👑Team Administration
    • New Team Resources
      • Creating The Team
      • Gaining Interest for Robotics Teams
      • Attending Competitions
        • Elimination Bracket
    • Team Dynamics
      • Organization Structure and Longevity
      • Member Allocation and Management
      • How *Not* To Run a Team
    • Team Finances
      • One-Year Team Financial Breakdown
      • Funding Your Teams
    • Hosting Competitions
      • Live Streaming
      • Tournament Manager
        • Competition Electronics
        • Creating a Tournament
        • Tools
          • Field Set Control
          • Connecting Mobile Devices
          • Connecting Raspberry Pis
        • Match Control
          • Inputting Match Scores
          • Inputting Skills Scores
          • Inputting Scores on TM Mobile
        • Displays
        • Alliance Selection
      • Additional Event Partner Resources
    • VexU Organization Management
      • Getting Started in VexU
      • Team / Personnel Management
      • Volunteering At Local Events
  • 📚The Judging Process
    • The Engineering Design Process
      • Test and Refine
    • The Engineering Notebook
      • Segments of the Notebook
      • BLRS2 '23-'24 Engineering Notebook
      • Integrating Inventor Models into Documentation
      • Engineering Notebook Rubric Breakdown
    • The Interview
      • Interview Rubric Breakdown
    • Using Notion for an Engineering Notebook
      • How to Setup a Notebook
      • How to Create Entries
      • How to Export a Notebook
      • Purdue SIGBots Notion Template
        • Game Analysis
        • Identify The Problem
        • Brainstorm Solution
        • Select Best Approach & Plan
        • Build Log
        • Programming Log
        • Testing Solution
        • Tournament Recap
        • Innovative Feature
  • 🖥️VEX CAD
    • CAD Programs
      • Inventor
      • Fusion 360
      • Solidworks
      • OnShape
      • Protobot
    • Making a Chassis
      • Inventor Chassis: The Basics
        • Installation
        • User Interface Overview
        • Dark Mode
        • Assemblies
        • Placing Parts
        • Navigating CAD
        • Changing Visual Style
        • Grounding
        • Connecting Two C-Channels
        • Modifying Existing Constraints
        • Toggling Visibility on Existing Parts
        • Completing Half of the Chassis
          • Inner Drive Channel
          • Bearing Flats
          • Motors
          • Wheels
          • Sprockets
          • Spacers, Washers and Standoffs
          • Spacers Cont.
        • Creating Mid-Plane
        • Mirroring
      • Inventor Chassis: Best Practices
        • File Structure
        • Subassemblies
        • Wheel Subassembly
        • Origin Planes
        • Cross Brace
        • Drive Channels
        • Simple Motor iMates
        • Replacing Simple Electronics
        • Completing Half of the Drive
          • Bearing Flats (Best Practice)
          • Wheels
          • Powered Gear
          • Spacer Boxing
          • Spacers, Washers and Standoffs (Best Practice)
        • Model Browser Folders
        • Mirroring (Best Practice)
        • Model Browser Folder (Right)
        • Main Assembly
      • Fusion 360 Chassis
      • Solidworks Chassis, Chain, and Custom Plastic
    • Remembering The Best
      • 62A Skyrise
      • 400X Nothing But Net
      • 2587Z Nothing But Net
      • 365X Starstruck
      • 62A In The Zone
      • 202Z In The Zone
      • 5225A In The Zone
      • 169A Turning Point
      • 929U Turning Point
      • 7K Tower Takeover
      • 5225A Tower Takeover
      • 62A Change Up
    • Scuff Controller
  • 💻Software
    • Odometry
    • Path Planning
    • Robotics Basics
      • Arcade Drive
      • Tank Drive
      • Joystick Deadzones
      • Curvature (Cheesy) Drive
      • Subsystem Toggling
    • Organizing Code
      • Code Style
      • Code Styling Guide
      • Writing Good Comments
      • Version Control
    • Control Algorithms
      • Bang Bang
      • PID Controller
      • Basic Pure Pursuit
      • Flywheel Velocity Control
      • Kalman Filter
      • Take Back Half (TBH) Controller
      • RAMSETE Controller
    • Competition Specific
      • Operator Control
      • Autonomous Control
    • C++ Basics for VEX Robotics
      • Basic Control Flow
      • Enumerations
      • Namespaces (::)
      • Multiple Files (C/C++)
    • VEX Programming Software
      • PROS
        • OkapiLib
      • vexide
      • Robot Mesh Studio (RMS)
      • EasyC
      • RobotC
      • VEXcode
      • Midnight C
    • General
      • Stall Detection
      • Register Programming
      • Sensors and Odometry in Autonomous
      • Embedded Programming Tips
      • Debugging
      • Bit Shift
      • Bit Mask
      • Autoformatting
      • Finite State Machine
      • Data Logging
    • Object Recognition
      • Red Green Buoy
      • AMS
      • OpenCV
      • OpenNI
    • 🤖AI in VRC: Pac-Man Pete
  • ⚡VEX Electronics
    • V5 ESD Protection Board
    • VEX Electronics
      • VEX V5 Brain
        • V5 Electronics Observations and Issues
      • VEX Controller
      • VEXnet and V5 Robot Radio
      • VEX Battery
      • VEX Motors
    • VEX Sensors
      • 3-Pin / ADI Sensors
        • Encoder
        • Potentiometer
        • Limit Switch
        • Bumper Switch
        • Accelerometer
        • Gyroscope
        • Ultrasonic
        • Line Tracker
        • LED Indicator
      • Smart Port Sensors
        • GPS Sensor
        • Rotation Sensor
        • Vision Sensor
        • Optical Sensor
        • Distance Sensor
        • Inertial Sensor (IMU)
        • 3-Wire Expander
    • V5 Brain Wiring Guide
    • Legacy
      • VEX Cortex
      • Power Expander
      • VEX Motor Controller
      • VEX Cortex Wiring Guide
  • General Electronics
    • General Topics
      • External Boards
        • ASUS Tinker Board S
        • Arduino
        • Beagleboard
        • Leaflabs Maple
        • LattePanda
        • Meadow F7 Micro
        • Netduino
        • ODROID-XU4
        • Pandaboard
        • Raspberry Pi
      • Analog-Digital Converter (ADC)
      • Bit-Bang
      • GPIO
      • I2C
      • Jitter
      • Line Noise
      • List of Tools
      • Output Drive
      • Power Consumption
      • Radius Array
      • Resettable Fuse (PTC)
      • SPI
      • Slew Rate
      • Stalling
      • USART
      • UART
      • 5 Volt Tolerant
      • DC Motor Basics
Powered by GitBook
LogoLogo

This work is licensed under a Attribution-ShareAlike 2.0 Generic License

On this page
  • Prerequisites
  • Computing Error
  • Computing the Output Velocities
  • Tuning the Desired Velocities
  • Outputs
  • Commanding the Robot
  • References:
  • Teams Contributed to this Article:

Was this helpful?

Edit on GitHub
Export as PDF
  1. Software
  2. Control Algorithms

RAMSETE Controller

A nonlinear feedback controller for correcting robot position in the global coordinate system.

PreviousTake Back Half (TBH) ControllerNextCompetition Specific

Last updated 2 years ago

Was this helpful?

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 , that are designed to be used with the 2D motion of mobile robots. Typical controllers like 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 . The desired global position for the robot can be a single (x, y, theta) point or a point along a .

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.

[xdesired−xactualydesired−yactualθdesired−θactual]\begin{bmatrix} x_{desired} - x_{actual}\\ y_{desired} - y_{actual}\\ \theta_{desired} - \theta_{actual} \end{bmatrix}​xdesired​−xactual​ydesired​−yactual​θdesired​−θactual​​​

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:

[exeyeθ]=[cos⁡θactualsin⁡θactual0−sin⁡θactualcos⁡θactual0001][xdesired−xactualydesired−yactualθdesired−θactual]\begin{equation*} \begin{bmatrix} e_x \\ e_y \\ e_\theta \end{bmatrix} = \begin{bmatrix} \cos\theta_{actual} & \sin\theta_{actual} & 0 \\ -\sin\theta_{actual} & \cos\theta_{actual} & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x_{desired} - x_{actual} \\ y_{desired} - y_{actual} \\ \theta_{desired} - \theta_{actual} \end{bmatrix} \end{equation*}​ex​ey​eθ​​​=​cosθactual​−sinθactual​0​sinθactual​cosθactual​0​001​​​xdesired​−xactual​ydesired​−yactual​θdesired​−θactual​​​​

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:

  • bbb: Roughly a proportional term for the controller. Large values of bbb will result in a more aggressive controller. Must be > 0.

  • ζ\zetaζ: Roughly a damping term (like the D term of a PID controller). Must be between 0 and 1.

These factors combine with the following equation to give us a gain value kkk for the controller:

k=2∗ζ∗ωd2+b∗vd2k = 2 * \zeta * \sqrt{\omega_d^2 + b * v_d^2}k=2∗ζ∗ωd2​+b∗vd2​​

Tuning the Desired Velocities

Tuning the vdv_dvd​ and ωd\omega_dωd​ 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.

smallScalar=0.01vd=smallScalar∗exωd=smallScalar∗eθsmallScalar = 0.01\\ v_d = smallScalar * e_x\\ \omega_d = smallScalar * e_\thetasmallScalar=0.01vd​=smallScalar∗ex​ωd​=smallScalar∗eθ​

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 (vdv_dvd​), angular velocity (ωd\omega_dωd​), and the local error (exe_xex​, eye_yey​, and eθe_\thetaeθ​) to give us these velocity commands:

v=vd∗cos⁡eθ+k∗exω=ωd+k∗eθ+b∗vd∗sin⁡(eθ)∗eyeθv = v_d * \cos{e_\theta} + k * e_x\\ \omega = \omega_d + k * e_\theta + \frac{b * v_d * \sin(e_\theta) * e_y}{e_\theta}v=vd​∗coseθ​+k∗ex​ω=ωd​+k∗eθ​+eθ​b∗vd​∗sin(eθ​)∗ey​​

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:

linearMotorVelocity=vwheelCircumference\it{linearMotorVelocity} = \frac{v}{\it{wheelCircumference}}linearMotorVelocity=wheelCircumferencev​

The angular velocity can be converted to the robot's left and right wheel velocities using the following equation:

left=linearMotorVelocity+angularMotorVelocityright=linearMotorVelocity−angularMotorVelocity{\it{left} = \it{linearMotorVelocity} + \it{angularMotorVelocity}}\\right = {\it{linearMotorVelocity} - \it{angularMotorVelocity}}left=linearMotorVelocity+angularMotorVelocityright=linearMotorVelocity−angularMotorVelocity

Since the positive θ\thetaθ 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:

vdv_dvd​: The desired linear velocity. This can come from a or can be another tuning factor.

ωd\omega_dωd​: The desired angular velocity. This can come from a or can be another tuning factor.

(Purdue SIGBots)

💻
Odometry
Pure Pursuit
PID
Odometry
computed path
computed path
computed path
Controls Engineering in FRC
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.529.3557&rep=rep1&type=pdf
BLRS