Vertical Takeoff and Landing Aircraft: System Description
Vertical Takeoff and Landing Aircraft: System Description
Vertical Takeoff and Landing Aircraft: System Description
http://www.cds.caltech.edu/~murray/wiki/index.php/Python-control
/Example:_Vertical_takeoff_and_landing_aircraft
System Description
This example uses a simplified model for a (planar) vertical takeoff and landing
aircraft (PVTOL), as shown below:
The position and orientation of the center of mass of the aircraft is denoted by
$(x,y,\theta)$, $m$ is the mass of the vehicle, $J$ the moment of inertia, $g$ the
gravitational constant and $c$ the damping coefficient. The forces generated by
the main downward thruster and the maneuvering thrusters are modeled as a
pair of forces $F_1$ and $F_2$ acting at a distance $r$ below the aircraft
(determined by the geometry of the thrusters).
To execute this example, we first import the libraries for SciPy, MATLAB plotting
and the python-control package:
In [1]:
In [2]:
m = 4 # mass of aircraft
J = 0.0475 # inertia around pitch axis
r = 0.25 # distance to center of force
g = 9.8 # gravitational constant
c = 0.05 # damping factor (estimated)
Choosing equilibrium inputs to be $u_e = (0, mg)$, the dynamics of the system
$\frac{dz}{dt}$, and their linearization $A$ about equilibrium point $z_e = (0, 0, 0,
0, 0, 0)$ are given by $$ \frac{dz}{dt} = \begin{bmatrix} z_4 \\ z_5 \\ z_6 \\ -g
\sin z_3 -\frac{c}{m} z_4 \\ g(\cos z_3 - 1)- \frac{c}{m} z_5 \\ 0 \end{bmatrix}
\qquad A = \begin{bmatrix} 0 & 0 & 0 &1&0&0\\ 0&0&0&0&1&0 \\
0&0&0&0&0&1 \\ 0&0&-g&-c/m&0&0 \\ 0&0&0&0&-c/m&0 \\ 0&0&0&0&0&0
\end{bmatrix} $$
In [3]:
In [4]:
# Input matrix
B = matrix(
[[0, 0], [0, 0], [0, 0],
[cos(xe[2])/m, -sin(xe[2])/m],
[sin(xe[2])/m, cos(xe[2])/m],
[r/J, 0]])
# Output matrix
C = matrix([[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0]])
D = matrix([[0, 0], [0, 0]])
To compute a linear quadratic regulator for the system, we write the cost
function as $$ J = \int_0^\infty (\xi^T Q_\xi \xi + v^T Q_v v) dt,$$
where $\xi = z - z_e$ and $v = u - u_e$ represent the local coordinates around
the desired equilibrium point $(z_e, u_e)$. We begin with diagonal matrices for
the state and input costs:
In [5]:
This gives a control law of the form $v = -K \xi$, which can then be used to
derive the control law in terms of the original variables:
$$u = v + u_e = - K(z - z_d) + u_d.$$ where $u_e = (0, mg)$ and $z_d = (x_d, y_d, 0,
0, 0, 0)$
The way we setup the dynamics above, $A$ is already hardcoding $u_d$, so we
don't need to include it as an external input. So we just need to cascade the
$-K(z-z_d)$ controller with the PVTOL aircraft's dynamics to control it. For
didactic purposes, we will cheat in two small ways:
First, we will only interface our controller with the linearized dynamics. Using
the nonlinear dynamics would require the NonlinearIOSystem functionalities,
1. Second, as written, our controller requires full state feedback ($K$ multiplies
full state vectors $z$), which we do not have access to because our system, as
written above, only returns $x$ and $y$ (because of $C$ matrix). Hence, we
would need a state observer, such as a Kalman Filter, to track the state variables.
Instead, we assume that we have access to the full state.
In [6]:
In [7]:
plot(t,x,'-',t,y,'--')
plot([0, 10], [1, 1], 'k-')
ylabel('Position')
xlabel('Time (s)')
title('Step Response for Inputs')
legend(('Yx', 'Yy'), loc='lower right')
show()
The plot above shows the $x$ and $y$ positions of the aircraft when it is
commanded to move 1 m in each direction. The following shows the $x$ motion
for control weights $\rho = 1, 10^2, 10^4$. A higher weight of the input term in the
cost function causes a more sluggish response. It is created using the code:
In [8]:
In [9]:
To design a controller for the lateral dynamics of the vectored thrust aircraft, we
make use of a "inner/outer" loop design methodology. We begin by representing
the dynamics using the block diagram
where
The closed inner loop dynamics $H_i$ control the roll angle of the aircraft using
the vectored thrust while the outer loop controller $C_o$ commands the roll
angle to regulate the lateral position.
The following code imports the libraries that are required and defines the
dynamics:
In [10]:
In [12]:
# System parameters
m = 4 # mass of aircraft
J = 0.0475 # inertia around pitch axis
r = 0.25 # distance to center of force
g = 9.8 # gravitational constant
c = 0.05 # damping factor (estimated)
In [13]:
In [14]:
k = 200
a = 2
b = 50
Ci = k*tf([1, a], [1, b]) # lead compensator
Li = Pi*Ci
The closed loop dynamics of the inner loop, $H_i$, are given by
In [15]:
In [16]:
In [17]:
L = Co*Hi*Po
S = feedback(1, L)
T = feedback(L, 1)
In [18]:
t, y = step(T, T=linspace(0,10,100))
plot(y, t)
title("Step Response")
grid()
xlabel("time (s)")
ylabel("y(t)")
show()
The frequency response and Nyquist plot for the loop transfer function are
computed using the commands
In [19]:
bode(L)
show()
In [20]:
In [21]:
gangof4(Hi*Po, Co)
Similar notebooks:
pvtol-lqr-nested
pvtol-lqr-nested
cruise
Chapter1
Robot Juggling
gps_notebook
FOTD-Design
SOTD-Design
Dynamics to Control