Vertical Robotics Competition
  • Welcome to VRC!
  • Before We Get Started
    • Phase I Overview
    • Helpful Links
  • Primary Goal: Assembly and Configuration
    • VRC Drone Kit Contents
    • VRC Drone Assembly
      • Arms and Motors
      • Landing Gear, PDB, and Rails
      • ESCs, FC Power Module, and Receiver
      • Flight Controller Enclosure
      • Mounting the Flight Controller
      • Top Plate and Arms
      • FC and ESC Wiring
      • Propeller Adapters
    • RC Transmitter Setup
      • Basic Usage
      • Binding the RC Receiver
      • Setting the Output Mode
      • Setting Up Channels on the RC Transmitter
      • Setting Up Failsafe
    • FC Setup and Calibration w/ QGC
      • PX4 Firmware
      • Airframe
      • Sensors
      • Radio
      • Flight Modes and Kill Switch
      • Power
      • Safety
      • Motor Test
  • Sphero RVR
    • RVR Assembly
    • RVR Programming
  • Battery
    • Overview
    • Charging
    • Storage
  • Checkpoint #1: Flight Test
    • Before You Fly
    • Flight Test
    • After You Fly
  • SECONDARY GOAL: PCC
    • Laptop Setup
      • Setting Up Windows
      • Install Git Bash
      • Clone the VRC Repo
      • Install Anaconda
      • Install VS Code
      • Install SD Card Formatter
      • Install Balena Etcher
      • Install PuTTY
      • Install QGroundControl
    • Peripheral Control Computer (PCC)
      • Physical Assembly
      • Video Tutorial: Flash & Test PCC
      • Flash the PCC
      • Test the PCC
  • Overachiever Goal
    • Vehicle Management Computer (VMC) Setup
      • Preparing the Jetson
      • Flashing the SD Card
      • First Boot
  • 3D Printing Project
    • Project Overview
    • Sr. Design Project
    • Rotor Guards
  • Diving Deeper
    • Control Loops
    • Glossary
Powered by GitBook
On this page

Was this helpful?

  1. Diving Deeper

Control Loops

PreviousRotor GuardsNextGlossary

Last updated 4 years ago

Was this helpful?

Control Loops

When a drone flies, there are many things going on at once, some of them are happening much more quickly than others. We can break these down as inner-loops and outer-loops.

Rate Control

This is the inner-most loop, running several hundred times per second usually. The purpose of this loop is to control the angular rate of the vehicle, that is, how quickly the vehicle is pitching forward or back, rolling to the left or right, or yawing to change its heading. If we can successfully control the angular rate of the vehicle, it is said that we are able to stabilize the vehicle. All other control loops are considered outer loops because they depend on this inner loop providing a stable vehicle.

Rate control is achieved by comparing a sensor value for the angular rate of the vehicle in each axis to a set point, or target, value. Once we have the knowledge of how far our state (pitch rate / roll rate / yaw rate) is away from where we want it to be, we can apply some gain factor (we can tune these gains to change the performance of the controller) to that difference, and we send those values to the motor controllers as motor commands. All control loops in our drone work on this principle.

Attitude Control

The Attitude control loop is the first outer loop, as its name suggests, this control loop allows us to command the vehicle to a particular attitude. If we wanted to hover, for instance, we would send attitude commands of 0 degrees, for the pitch and roll axis. It's important to note that the output of the attitude controller is the input of the rate controller, they are effectively nested control loops. It is important to note the difference in frequency that these loops operate at; typically, an attitude loop is about an order of magnitude slower (or a division by 10) than the rate control loop.

Velocity Control

Similarly, the velocity controller compares velocity commands (usually in the form of forward velocity and vertical velocity) to a velocity estimate that has been calculated, applies some controller gain, and then computes what the desired vehicle attitude is to achieve that velocity, passing that desired attitude to the more inner loop below.

Position Control

Surely, you see where this is going. Once we can control the velocity of the vehicle, we are able to control the position of the vehicle, because velocity is merely the derivative of position, right? That is essentially true, however, we always need to keep in mind the different coordinate systems the vehicle is operating in. Almost exclusively, the coordinate frame that angular rates and attitudes are measured in is not relevant for position control, usually we want to command the vehicle to a particular latitude and longitude. How do you define a vehicle's roll attitude in the coordinate system that latitude and longitude make sense in? There will be a coordinate transform between what position command is being set by the operator and how the vehicle interprets that before it can apply the controller.

For position control to work, the vehicle must have an estimate of where it is in space. This is where the VMC comes in, as we've mentioned, we are flying indoors and don't have GPS to use a sensor, so we must find out the drone's position with other sensors. The VMC uses two different sensors together to estimate the position of the vehicle in the inertial frame that is flying arena, that is, this frame is not moving, it is the reference for all other frames. Estimating position indoors is very challenging, and a great deal of work has been done to simplify the operation for these drones, it takes a lot of calculation and code to interface with the position sensors and generate these estimates, that's why we have to do this work on the VMC and not the FC, the VMC is a much more powerful computer. Luckily for us, the position control loop is the slowest of the control loops, so we only have to send the position feedback to the more inner loop controls a few times a second.