In this project, I explored controller design and trajectory generation for a quadrotor. Differential flatness was used for trajectory generation based on one of the references. A minimum snap trajectory is generated from the given algorithm based on waypoint navigation, and a simple proportional plus derivative (PD) controller is used to track the trajectories. Simulation results are presented which generate smooth trajectories for position and velocity of the quadrotor.
I. INTRODUCTION
Recently, quadrotors have been widely used for research. Because of their agility in 3D Euclidean space, they can be used for a variety of purposes, including photography, inspection, transportation of loads, geo-surveying, and so on. For a quadrotor maneuvering in a tightly constrained environment, it is necessary to develop optimal trajectories to ensure safe passage through corridors and constraints [1]. So, it is necessary to develop flight plans that leverage the dynamics of the system [1].
II. PROJECT OBJECTIVE
The objective of this project is to review and develop an understanding of trajectory generation for quadrotors. I reviewed [1] and related sources [2], [3] to understand and implement differential flatness for trajectory generation. Example code was given at [4], [5]. I implemented Mellinger's minimum snap trajectory and control algorithm for quadrotors based on differential flatness [1], [2]. The goal of this project was to develop a strong understanding of quadrotor trajectory generation and control algorithms so that they can be applied to multi-agent path planning and control problems in future work.
III. METHODOLOGY
In this paper, I used the dynamic model and control from [1] and implemented it in MATLAB. I used a PD controller to track a given trajectory. Trajectories are generated based on differential flatness, which ensures smoothness. I compared the minimum snap trajectory and the shortest distance trajectory and distinguished their performance.
IV. DYNAMIC MODEL
Fig. 1. Quadrotor model with the body-fixed and inertial reference frames.
A. Coordinate Systems
The coordinate systems with a free body diagram for the quadrotor are shown in Fig. 4. A is the inertial frame with axes a1, a2 and a3. The body frame B is attached to the center of mass of the quadrotor, which is coincident with the inertial frame. C is the center of mass of the rotor and L is the length of the rotors from the center C.
B. Motor Model
Each rotor has an angular speed ωi and produces a vertical force Fi, which is given by
The orientation of the quadrotor is described by a triplet of yaw-pitch-roll ( ϕ, θ and ψ) Z−Y−X Euler angles. The position of the center of mass of the quadrotor is given by
The angular velocity of the robot in the body frame is denoted as q, q and r. These values are related to derivatives of the roll, pitch and yaw angles according to
pqr=cθ0sθ010−cϕsθsϕcϕcθϕ˙θ˙ψ˙.(6)
Newton’s Equations of Motion: The forces in the system are gravity and the forces from each rotor Fi. The equation governing the acceleration of the center of mass of the quadrotor is
mr¨=00mg+RBA00F1+F2+F3+F4,(7)
The first input to the system u1 is defined as
u1=i=1∑4Fi
Euler’s Equations of Motion: In addition to forces, each rotor produces a moment perpendicular to the plane of rotation of the blade, Mi. Rotors 1 and 3 rotate in the −b3 direction while 2 and 4 rotate in the +b3 direction. The moment produced on the quadrotor is opposite to the direction of rotation of the blades. So, M1 and M3 act in the b3 direction while M2 and M4 act in the −b3 direction. The angular acceleration is determined by,
where γ=kFkM. The second input u2 is defined as:
u2=0−LγL0−γ0Lγ−L0−γF1F2F3F4.
V. CONTROL
The controller used in [1], [3] is derived by linearizing the equation of motion about an operating point, r=r0, θ=ϕ=0, ψ=ψ0, r˙=0, and ϕ˙=θ˙=ψ˙=0. Using a small angle approximation for roll and pitch angles ( cϕ=1, cθ=1, sϕ≈ϕ, and sθ≈θ) gives us the following linearized equations:
Fi,0=4mg,(10)
At the nominal state, the inputs for hover are u1,0=mg, u2,0=0.
The control problem is to determine the four inputs, (u1,u2) required to hover or to follow a desired trajectory, zdes. As shown in Fig. 2, the error in the robot's position is used to derive the controller from (11). The equations in (11) also allow us to derive a desired orientation. The attitude controller for this desired orientation is derived from (12). We require the attitude control loop to run at a higher rate than the position control loop.
Attitude Control: Mellinger [1] developed the following PD controller for attitude control:
A nonlinear system is differentially flat if we can find a set of outputs such that we can express all states and inputs in terms of those outputs and their derivatives [6].
A. Example
Fig. 3. Kinematic Car
A kinematic car is a differentially flat system, as shown in [7] Equations of motion
After substituting x¨ into (30), we can prove that the fourth derivative of position is proportional to u2. So, it is proved that the quadrotor is a differentially flat system [1] [4].
VII. 3D TRAJECTORY GENERATION
For the purpose of this simulation, I used the optimal trajectory defined in [1]. For the optimal trajectory, the following function is used based on Calculus of Variations,
x∗(t)=argx(t)min∫0TL(x˙,xt)dt(34)
Solving the functional L using the Euler-Lagrange equation gives us the optimal function.
ddt(∂x˙∂L)−∂x∂L=0(35)
For smooth trajectory generation, Mellinger [1] used the following functional
x∗(t)=argx(t)min∫0T((xn)2)dt(36)
When n = 1, we get the shortest distance with minimum velocity, n = 2 gives minimum acceleration, n = 3 gives minimum acceleration, and n = 4 produces the minimum snap trajectory. For the rest of the paper, I will use the minimum snap trajectory for simulation purposes.
A. Minimum Snap Trajectory
A minimum snap trajectory is a 7th order polynomial of time [4], [1]. If we are given a set of n+1 waypoints w0,…,wn, the minimum snap trajectory is a piecewise polynomial composed of n 7th order polynomials. Each polynomial piece pi travels between a pair of waypoints wi−1 and wi and takes a known amount of time Ti to complete i=1,…,n.
Let S0=0 and for i=1,…,n, Si=∑k=1iTk. Si is the time it takes to reach waypoint wi from waypoint w0. Then the polynomial pi has the form:
To obtain the complete equation for the piecewise trajectory, we need to solve for all the coefficients ≈ij. There are 8n such coefficients. These coefficients must satisfy a series of constraints. First, the polynomial must go through all the waypoints
The coefficients can be solved for by converting the equations into matrix form
Aα=b(41)
The coefficients can be obtained by solving
α=A−1b(42)
VIII. SIMULATION RESULTS
In this section, results obtained from minimum snap trajectory generation are included. Example code was given in [4][5], and I implemented the trajectory generation and control algorithm in their example code. The model used is the AscTec Hummingbird quadrotor. The mass of the rotor is 0.18 kg, the length (L) of the rotor from center of mass to motors is 0.086 m, and the principal moments of inertia are Ixx=0.00025kgm2, Iyy=0.000232kgm2, Izz=0.0003738kgm2.
Fig. 4. AscTec Hummingbird quadrotor used in the paper for simulation purposes [1] [8]
time [s]
time [s]
(a)
time [s]
time [s]
(b)
Fig. 5. Position and velocity trajectories for the quadrotor based on minimum snap. All the trajectories are smooth and based on differential flatness.
time [s]
time [s]
time [s]
(a)
time [s]
time [s]
time [s]
(b)
Fig. 6. Position and velocity trajectories for the quadrotor without minimum snap. The points are connected linearly with each other based on the shortest distance (minimum velocity).
As we can observe from Fig. 5, the trajectories are smooth and there is no discontinuity in the system. The smooth trajectories allow better performance and planning of the quadrotor. However, in Fig. 6, it can be observed that the trajectories are not continuous; they pass through the specified waypoints, but because of the sudden jumps in the velocity and position graphs, they are not smooth. Also, because of the inertia present in the system, it may not be feasible to make such a sharp turn.
IX. CONCLUSION
From this project, I learned an interesting application of trajectory generation for quadrotors. Minimum snap trajectories can be used for aggressive maneuvers and perching, and the system will still have no perturbations. This is one of the important concepts I learned from this project. The trajectories are always smooth and optimal. One can select waypoints and introduce more dynamic behavior to the quadrotor. I plan to use differential flatness based trajectory generation for my future work and test it on the experimental platform with one of our rotors. I also plan to extend it to multi-agent motion planning and control.
REFERENCES
[1] D. Mellinger and V. Kumar, “Minimum snap trajectory generation and control for quadrotors,” in Robotics and Automation (ICRA), 2011 IEEE International Conference on. IEEE, 2011, pp. 2520–2525.
[2] D. Mellinger, N. Michael, and V. Kumar, “Trajectory generation and control for precise aggressive maneuvers with quadrotors,” The International Journal of Robotics Research, vol. 31, no. 5, pp. 664–674, 2012.
[3] N. Michael, D. Mellinger, Q. Lindsey, and V. Kumar, “The grasp multiple micro-uav testbed,” IEEE Robotics & Automation Magazine, vol. 17, no. 3, pp. 56–65, 2010.