Table of Contents
Quadcopter
The quadcopter model here is a higher dimensional, more realistic implementation of actual flight using multi-rotorcraft than the Planar Bi-Rotor Helicopter model. Though it is still considered to be an underactuated model relative to the full $SE(3)$ state dynamics model, if the output states are restricted to be the 3D position and the yaw, then the model becomes fully actuated. The pitch and roll dynamics become passive variables implicitly determined by the trajectory taken or being followed. Many physically motivated mobile robot systems have this property, which is known as differential flatness. Control designers and roboticists have taken advantage of the differential flatness property to design nonlinear controllers for quadcopters that have better stabilization properties than their linear counterparts.
Basic Equations
The simplest general form of the equations use the standard second order equations for the linear states $(q, \dot q)$ and the Euler equations with dissipation for the angular states $(R, \omega)$: \begin{equation} \begin{split} m \ddot q & = -D_t \dot q + R B_t \vec u - m \vec g \\ \dot R & = R \cdot \omega \\ J \dot \omega & = -D_a \omega + (J\omega) \times \omega + B_a \vec u \end{split} \end{equation} where $J$ is the intertia matrix, $D_t$ and $D_a$ are the dissipation matrices, and $B_t$ and $B_a$ are the control matrices. The control matrices take the form: \begin{equation} B_t = b_t \begin{bmatrix} 0 & 0 & 0& 0 \\ 0& 0 & 0 & 0 \\ 1 & 1 & 1 & 1 \end{bmatrix} \qquad \text{and} \qquad B_a = \text{diag}(b_x,b_y, b_z) \begin{bmatrix} 0 & 0 & 1 & -1 \\ -1 & 1 & 0 & 0 \\ -1 & -1 & 1 & 1 \end{bmatrix}. \end{equation} The constant $b_t$ is the input to thrust factor, and $b_x$, $b_y$, and $b_z$ are input to torque factors for rotation about the body $x$, $y$, and $z$ axes. Note that this configuration is based on the first and second rotor inputs aligning with the body $x$-axis, and the third and fourth aligning with the body $y$-axis, and with both sets being counter-rotating. The first and second rotate counter in the positive sense and the third and fourth rotate in the negative sense. Thus spin-ups will induce the opposing angular acceleration as per the signs in $B_a$'s third row.
If the rotor geometry is different from the one described above, then the $B_t$ and $B_a$ matrices may require adjusting. If the rotor axes are in the body $z$-axis but do not form a plus, then the $B_a$ matrix will differ. They could form a cross with all equal angles or an x shape with two different angles, or possibly even have some asymmetric form. Likewise, the rotor axes could be tilted, which would also impact the $B_t$ matrix. There is a design like that which permits forward acceleration without significant pitching, and can achieve a steady state velocity at zero pitch. Due to drag forces, most quad-copters will need to pitch some in order to move at a constant velocity.
Model Parameters
The model parameters for this system are a bit more complex. They will be provided in accompanying Matlab files that have the parameters for a variety of quadcopter platforms as culled from online documentation and published works. These parameters will be located in a YAML file.
Alternative Forms
How to implement the equations is a function of one's comfort level with them. For those familiar with Lie groups and control on Lie groups, then the best option is to keep them in geometric form by using rotation matrices or quaternions to represent the rotation $R$, and their corresponding Lie algebra representations for the angular velocities $\omega$. A common representation for those unfamiliar with, or new to rigid body mechanics, is to employ Euler angle representations for the angular states. Which to use is up to you, though the most common will be the Tait-Bryan angles, described using the notation $X_1 Y_2 Z_3$ for the first coordinate being rotation about $x$, second about $y$ and third about $z$. The order of application is from right to left since the multiplication happens from the left side. Sometimes it is written as $R_x R_y R_z$ where $R_\cdot$ is the canonical rotation about the subscripted axis. Picking the right representation choice can simplify the nonlinearity in the equations of motion. The value of doing so is such that adaptive controllers might benefit from the simpler nonlinearity by having dependence on a sub-state of the system instead of the full state, or by having easy to describe nonlinear basis elements for adaptive cancellation.
Implementation
Functional code stubs for the implementation are provided in the quadcopter zipfile. They implement a constant control signal that most definitely fails to do the job, but provide enough structure to complete the project. Comments in the code should help to realize the necessary improvements.
Control Approaches
There are several approaches to stabilizing the quadcopter. Which one to take depends on your comfort with control theory. They are listed below.
Full Linearization: The standard state space MIMO approach would simply linearize the full set of controlled differential equations using whichever angular representation one prefers. It is fairly common to see Euler angle implementations in the published literature, especially if one is linearizing about hover and not seeking to perform agressive maneuvering.
Inner/Outer Control Loops: Since it is known that control of (horizontaol) position requires angling the quadcopter (there are no means to directly control these state coordinates), a common technique for control of the quadcopter is to design a fast inner loop that achieves fast angular control with the position variables ignored. This approach works because the position state variables don't factor into the angular rate equations. The next step would be to then assume great or perfect tracking of angular signals and look at the position substates with angular inputs. The inner and outer loops can be adaptively controlled using different techniques. For example, the angular portion could be controlled using a more geometric method; a simple version of something like this was in the homework with satellite angular rate control. The linear portion could be controlled using standard linear techniques.
Geometric Control: There are geometric approaches that impose a transformation of state to render the system more linear looking. A combination of geometric transformations of the signals plus linear control permit stabilization and trajectory tracking of non-aggressive maneuvers. There are flavors of this that afford aggressive maneuvering along feasible, specified trajectories. Aggressive controllers are a bit more involved and not sought here.
Activities
Though the activities below involve application of linear control, the full nonlinear equations should be used for simulation. As a sanity check, it is usually a good idea to first implement with the linear system simulated as a confirmation. Once it works, switch to the nonlinear system dynamics and linear control law. Performance should be similar but degrade slightly. For expected documentation for the deliverables, see the Planar Bi-Rotor Helicopter project description.
Step 1: Stable Linear Controller
Pick what basic scheme will be used to control the system and document it. Next, linearize the equations of motion about hover, so that the linearized state and control inputs have an equiblirium at the origin with zero linearized control input. Establish performance specifications for the system and design a linear feedback controller that will stabilize the system and meet the performance specifications. Any reasonable technique can be used, so long as you explain and justify.
Your description should be compatible with the solution approach taken. For example, if using the inner/outer loops approach, then there will be two performance specifications to provide.
Step 2: Model Mismatch and Adaptive Control
Modify by 10-20% some of the model parameters of the system and compare the outcomes under a traditional linear controller. Incorporate linear adaptive control and show the resulting outcomes. Confirm how well the adaptive system meets the performance specifications versus the static controller.
Here, you should consider two cases. One is the initial case, where tracking a particular reference signal will lead to an adaptation transient. Simulate as normal, however pick a time post-transient and grab the adaptive gains from the output signals. Prepare a second simulation that starts with these gains. The second simulation would act like a second or subsequent deployment post-adaptation. Show that the system better meets the performance objectives.
Step 3: Enhancing the Baseline Implementation
Consider taking the baseline approach and doing something more interesting with it, at least if you'e gone for the standard linear control approaches of full linearization or inner/outer linearization. Possible options are listed below.
Step 3: Option 1: Adaptive Nonlinear Controller
Implement a more geometric approach borrowing the virtual point idea from the bi-rotor problem. It will still have as a degree of freedom the yaw or pointing direction. It will still need to be specified, usually by asking for the quadcopter to be aimed along the tangent to the trajectory or with some angular offset from the tangent. A neat thing to do would be to specify the control task to be stabilization to a small set or region around the trajectory tangent.
Step 3: Option 2: Model Predictive Control + DMRAC
Usually the reference signal for robotic systems is the trajectory to follow. Synthesizing such a trajectory for something like a quadcopter is best done using optimal control strategies. Integrate the adaptive control system with Matlab's nonlinear model predictive control (NMPC) solution to generate non-trivial paths and track them ( Matlab help center document).
Step 3: Option 3: Other??
Maybe you have found some interesting research related to adaptive control of quadcopters and would like to implement it. That's an acceptable option, but please do contact me to confirm that it will be realizable.
References
For sure you need to be careful with these references. In addition to different reference frame conventions between Aerospace engineers and others, plus different ways of representing the $SE(3)$ Lie group state, there are actually slightly different dynamical equations for the quadcopter. The references below just give some idea for how static controllers are synthesized for these systems. The model chosen depends on what the authors wish to demonstrate or what kinds of constraints their control method has.
- TBD – Aiming to complete Spring Break, 2023 Spring. We've collected the references but need to curate them.