In this post we will see how we can describe motion of the quadcopter – or any vehicle – as a set of differential equations.

*This post is the 2nd in a series on modeling and simulation of a quadcopter’s vehicle dynamics. The full series will include all of the following posts:*

- Modeling Vehicle Dynamics – Euler Angles
**Modeling Vehicle Dynamics – Quadcopter Equations of Motion**- Modeling Vehicle Dynamics – 6DOF Nonlinear Simulation

*The contents of this post will build on the concepts of multiple reference frames and Euler angles. If you aren’t familiar with those, you may want to read the first post in this series.*

# Describing Motion

Before going into any details about equations of motion, we should identify what we are trying to describe. There are two questions we should answer:

**What variables are necessary to describe motion?**

In the first post we already discussed the concept of 6 Degrees of Freedom (6DOF), where we want to know 3-D position in addition to 3-D orientation of the vehicle. But to describe the motion of a body what we really want to know is how these change over time.

Therefore we will need variables which represent both the linear and angular velocity of the vehicle. The linear velocity in the body-frame of the vehicle is defined as:

The angular velocity of the rotating body-fixed reference frame is defined as:

We also need to know the forces which influence motion of the vehicle. Again we define this for both linear translation force and angular moment:

Finally, some influences may be in the inertial frame (such as gravity) while some may be attached to the body (such as the vehicle’s propulsion). Therefore, the Euler angles must also be tracked in order to convert between the inertial and body frames.

**What additional variables are useful?**

The above variables are sufficient to describe all of the dynamics of the quadcopter vehicle, however they do not specify the actual position in space of the vehicle. This is because the dynamics in one location should be the same as any other location (things that change with location such as aerodynamics and gravity we will consider constant, and only enter the equations through the force and moment variables).

This is desirable since we expect the quadcopter to behave the same no matter where it starts from. But given a starting point, the equations of motion will allow us to propagate that starting location forward in time to a new position if we know all of the “state” variables defined above.

With that being said, sometimes it is useful to include additional state variables to observe. For navigation or motion planning, it is generally necessary to track the inertial position as well as it changes over time. Therefore we will define three more variables for position in the inertial reference frame:

I will treat these navigation coordinates as in a Flat-Earth model, where the coordinates are assumed to represent a rectilinear grid. However, one could extend these equations to a spherical coordinate frame in order to express position in latitude and longitude, and even account for rotation of the Earth.

## Sign Conventions

All dynamics equations will use right-handed coordinate frames. In flight controls it is standard for the **X** component to be aligned with the forward direction of the vehicle. And the forward direction is assumed to be at a heading of 0 degrees when it is aligned with North in the inertial frame. This results in the somewhat odd convention of [**X**, **Y**, **Z**] being a [North, East, **Down**] reference frame, in order to maintain right-handedness.

However, for navigation it makes sense to define height as positive in the up direction. Therefore, our navigation frame, which we will refer to with (E) for Earth, in relation to the inertial (n) frame will have the convention:

# Reference Frames and Rotation

One thing that must be kept in mind while developing these expressions is what reference frame are the variables expressed in, and with respect to what reference frame are they changing? See Reference [2] for a more thorough explanation if desired.

## Inertial motion expressed in body frame components

The motion we want to classify for translation as well as rotation is all with respect to the inertial frame (e.g. the ground). In fact, we assume a rigid body which means there can be no motion with respect to the body frame. The body frame is fixed to the vehicle, and any motion of the vehicle with respect to that origin would imply flexible bending or movement of the vehicle components.

The body frame is useful though, because our vehicle sensors are attached to it, as well as our propulsion (the propellers). Therefore, the equations of motion we derive will be inertial motion (change in position and orientation with respect to the ground), but expressed within the coordinate system of our body axes .

You should notice once we derive the final set of equations however, that inertial position is not necessary for these equations of dynamics. The equations of motion only represent the change in these values from the vehicle’s point of view. In that sense, they are very useful as they may be applied to solve for the future motion of a vehicle from any inertial starting point.

## Simultaneous Translation and Rotation – The Chain Rule

Now that we have established we want to represent inertial motion in the vehicle coordinate frame, we must understand what that means mathematically. In our derivation of the equations of motion we will want to take the derivative of vectors which are expressed in the body frame. Using the rules of calculus, we must use the chain rule of derivation to account for both the change due to the time derivative of the vector within the coordinate frame, as well as the time derivative of the coordinate frame’s rotation. Let me show this with a scalar expression of the time differentiation of the body-fixed velocity vector:

The components in the first set of parentheses represent the change in inertial velocity within the body frame coordinate system. The components in the second set of parentheses represent perceived velocity change due to the rotation of the coordinate frame. We can rewrite this equation as Coriolis’ Theorem, where the frame rotation is represented by the angular velocity crossed with the velocity vector:

The cross-product can be rewritten as the skew-symmetric cross-product matrix, , premultiplying the velocity vector.

We will return to this formula when we look at acceleration.

# Newton’s Second Law of Motion

We will begin with Newton’s 2nd Law which is commonly summarized as force equals change in momentum , or for systems with constant mass, force equals mass times acceleration — the derivative of velocity :

This equation defines the change in linear momentum, however we can also express the rotational analogue. Crossing both sides of the equation with a position vector from some origin we get the rotational law of motion about the origin . We can simplify the equation to moment equals the change in angular momentum , or for systems with constant mass distribution, moment equals moment of inertia times angular acceleration — the derivative of angular velocity .

We will use both the linear and rotational forms of this law to derive the total vehicle equations of motion. But first, a note on what reference frame we will be working in.

# Force, Mass, and Acceleration

We will be deriving the equations for translation and rotation separately, but viewing the equations side by side can help illustrate the similarities between the two.

**Translation**

Inertial velocity in the body-fixed coordinate system will be expressed as:

Using the chain rule for a rotating body frame, the law of motion becomes:

**Rotation**

Angular velocity from inertial () to body-fixed () frame will be expressed as:

Using the chain rule for a rotating body frame, the rotational law of motion becomes:

## External Forces and Moments

To start formulating the equations of motion, the left hand side of Newton’s 2nd Law requires all forces which act on the body. For the quadcopter this comes down to our propulsion (thrust created by the propellers) and gravity.

### Propeller Thrust

For this post we will not go into propeller dynamics, but simply assume each of the four quadcopter propellers provides a thrust force perpendicular to the propeller and a torque about the center of gravity of the vehicle.

The thrust force is represented for each of the 4 propellers as . And all are aligned parallel with the vertical axis of the quadcopter, .

The force vector within the body frame coordinate system can then be represented by:

Note that since our body frame convention has positive in the **down** direction, thrust from the propellers is negative.

The moments are represented with components L, M, N for rotations about the axes, respectively. As a moment is measured by force times distance, we’ll need the motor distances from the center of gravity, as shown in the image above. For pitch and roll, half the motors provide positive moment, and the other half provide a negative moment, depending on which side of the axis they are located.

For yaw, the quadcopter takes advantage of its four rotating propellers. Half of the propellers are installed to rotate clockwise (#3 and #4) and the other half counter-clockwise (#1 and #2). Each propeller as it pushes against the air will also apply a torque about the cg of the quadcopter in the direction of its rotation as a function of its thrust, propeller radius, and distance from the cg. We will define this torque as a function , and can express the yaw moment of the vehicle as:

### Gravity Force in Body Coordinates

Gravity always acts towards the center of the Earth, and is expressed in the inertial frame as:

Where g = 9.81 m/s^{2}, the gravitational constant. Remember that our z-inertial coordinate is in the Down direction, so gravity is a positive acceleration.

But all of our other forces are defined within the body frame of the vehicle. To include gravity in our equations of motion we must convert it into body frame components as well. Using our Euler angle transformation matrix from inertial to body frame, , this is easy:

## Mass and Moment of Inertia

Moment of inertia is the rotational analogue of mass, or “angular mass.” An object’s mass will inform you about how much force it will take to accelerate a still object, or stop a moving one (the property of inertia). The moment of inertia will similarly describe how large of a moment is required to turn a still object, or stop rotation of one about an axis. Because the rotational inertia depends on the axis it is rotating about, this property is represented with a matrix for our 3-dimensional world.

The moment of inertia is defined in physics for scalars as:

### The Moment of Inertia Matrix (I)

A more general representation where the mass is integrated over the entire body of the object is:

To represent this in matrix form, we will assume is some coordinate with components in relation to the reference frame origin. Then using the cross-product matrix form of we can evaluate:

Let’s try to understand the physical meaning of these mathematical expressions. The diagonal terms of this matrix are referred to as the moments of inertia. The off-diagonal terms are referred to as the products of inertia.

If instead of a continuous body of mass, we represent the body as a collection of point-masses, then we can rewrite as a summation of all mass points :

This means that every point of mass in the body is multiplied by the square of its distance from the x-axis — just as in the scalar form I = mr^{2}. So the further the mass is away from the axis, the greater the angular inertia is about that axis.

### Symmetry

The products of inertia can be thought of as the cross-coupling of different axes’ inertias on each other. But, if the vehicle is symmetric about an axis, then we will see that some of the products of inertia will equal zero, and make our equations easier!

If we again think of them in the discrete form, the product of inertia is the sum of all mass points :

With the moments of inertia the distance from the axis is squared, and therefore always results in a positive value. However here we can have both positive and negative values, since the distances and are from the center of the vehicle.

If the vehicle is symmetric across an axis, that would mean all the mass one side is equal to the other side and all at the same distance. For example, if the vehicle’s mass distribution is symmetric about the x-axis, then the sum of mass points in the negative direction equals the sum of mass points in the positive direction, and the positive and negative x distances all cancel out.

If the quadcopter is built so it is symmetric about both the x and y axes, then the inertia matrix would become:

## Acceleration

The final component we must express to complete our equations of motion is the acceleration. As acceleration is the time derivative of velocity, we will represent acceleration as the derivative of our defined inertial velocity terms for linear and rotational motion.

### Linear Acceleration

We have already learned that we must use Coriolis’ Theorem to represent the inertial velocity derivative in the rotating body frame. And we came up with the formula:

If we plug in our nomenclature for and , we get:

### Translational Motion

We have now derived representations for all components of our system’s force, mass, and acceleration in translation. Plugging these into Newton’s formula provides us with our first set of equations of motion.

### Angular Acceleration and Rotational Motion

We follow a similar procedure to solve for the angular acceleration and rotational law of motion. Using Coriolis’ Theorem again for the time derivative of angular velocity, we can evaluate the rotational motion formula as follows:

But if we assume our quadcopter is symmetric about both the x and y axes of the body frame, then the products of inertia all go to zero and this becomes:

## Additional Coordinate Frame Transformations

### Angular Velocity vs. Euler Angle Rates

We now have an equation for how the angular velocity changes over time. These are the values which a gyroscope sensor would measure on-board a quadcopter. One caveat though, is that the angular velocity about the body-fixed frame is not the same as the rate of change of the Euler angles .

This is because the Euler angles represent a sequence of rotations each in their own intermediate frame of reference, whereas the angular velocity is the instantaneous angular rate about each of the body-fixed axes. We can use coordinate transformations to express the angular velocity as a function of the Euler angle derivatives by transforming them all into the body frame.

To help make this clear I’ve labeled the intermediate reference frames in the sequence of Euler rotations below as b” and b’. So if we want to know how would be represented in the body frame (b), we must transform it from its intermediate frame. Here we see is the rotation rate about unit vector in the b” frame, so we will refer to it as . However in the final body-fixed frame, b, that unit vector has been rotated by the second and third Euler angles in the sequence.

Therefore, the rotation rates measured in the body-fixed frame due to the rate of change of the first Euler angle will equal the rotation transformed by the and rotations. (Since its rotation angle is also parallel with the inertial axis , you could get the same answer by multiplying it by all three Euler angle rotations with the inertial-to-body coordinate transformation derived in Modeling Vehicle Dynamics – Euler Angles).

The second Euler rotation, is treated similarly, and needs no rotation as the unit vector it rotates around, , is a unit vector in the body frame, b.

The relationship between measured gyro rates and Euler angle rates can be expressed in scalar form multiplied by unit vectors as:

If we express it in matrix form however, we can take advantage of our rotation matrices to handle the disparate reference frames:

To make things a little easier to read and fit on the page, I’m going to use a shorthand for the trigonometric functions: and . The above expression can be simplified by multiplying the matrices.

So finally we arrive at the set of equations:

These equations can also be rewritten for the Euler angle derivatives:

### The Navigation Coordinates

To determine the motion of the vehicle within our navigation coordinate frame, we simply transform our body frame velocity states with our Euler angle transformation matrix. Also we define our height variable, h, as the negative of our North-East-Down inertial frame to get a North-East-Up navigation frame.

## The Quadcopter Equations of Motion

Finally we have collected all the pieces to fully describe the motion of the quadcopter. Collecting all of the equations into one set and rearranging them we arrive at:

where

and is positive in the up direction.

## Up next

The above set of equations describes the motion of the quadcopter as a set of nonlinear differential equations. Still needed are models for the propeller force and torque functions and values plugged in for the mass and moment of inertia variables. But simple estimates and approximations would be good enough to start simulating vehicle dynamics.

In the next post we will look at how we can program a simulation which can solve for a time history of this motion by numerically integrating these equations over time from a given initial condition.

## Additional References:

**[1] Nelson, Robert, “Flight Stability and Automatic Control”**

A good starting point with straight-forward text on deriving the basic rigid body equations of motion for an airplane. Books by Etkin and Roskam are also common resources for this.

**[2] Schmidt, David K., “Modern Flight Dynamics”**

This is a good reference for a thorough description of the fundamentals in deriving these equations within the multiple frames of reference. It also provides in other chapters derivations of the equations of motion for elastic bodies as well as for the general linearized equations of motion. The mathematical notation may take a little getting used to in comparison to some of the more classic texts, as all equations are described as the integration of all point masses over the volume of the vehicle. However, the text descriptions are easy to understand.

**[3] Stengel, Robert F., “Flight Dynamics”**

This author provides very clear formulations of the equations and also provides useful information on the numerical integration of them. Also includes model dynamics for various lift and thrust sources, including propellers through actuator disk theory.

**[4] Lewis, Frank L., and Stevens, Brian L., “Aircraft Control and Simulation”**

This book is a great resource for practical examples of the equations in use for simulation of vehicles.

The Moment of Inertia Matrix term (3,2) should be -I_yz not -Ixz.

Thanks for spotting that Brandon, I’ve corrected the mistake.

Thanks Charlie! I like your blog. I just started a blog along these lines: flexing the old, analytical muscles by studying and (eventually) building a quadrotor. My blog is here http://www.mtwallets.com. If you look at the “quadcopter” posts you’ll see I got into the motor-propeller dynamics, “lift” concepts, and now I’m working on (but haven’t posted) my platform dynamic model. I have some good papers on the topic and I’m wrestling to derive the equations of motion using the Lagrangian…it feels close but I’m still not getting to the “final” equations I see in some of the papers. I’m going to study yours a bit and see if I can get, “unstuck”. Thanks again!

Really wonderfull article sir. It inspired tremendously and made easy for me to understand core concepts. Please broadcast series of videos on Youtube about quadrotors.