Glider Experiments in Python.
We’re using opty to compute optimal trajectories for a glider.
We describe our glider by a simple dimension 4 model (implementation).
\(x, y, z\) are the coordinates of the glider’s center of gravity in an euclidian space, \(v_a\) is its airspeed, \(\phi\) and \(\psi\) are respectively roll and heading angles. \(w_x, w_y, w_z\) are the wind velocity’s components.
Using \(X = \transp{\begin{pmatrix} x & y & z & \psi \end{pmatrix}}\) as state vector and \(U = \transp{\begin{pmatrix} v_a & \phi \end{pmatrix}}\) as control input, we obtain the following state space representation:
\[\begin{align} \dot{X} &= f(X, U) \\ \begin{pmatrix} \dot{x} \\ \dot{y} \\ \dot{z} \\ \dot{\psi}\end{pmatrix} &= \begin{pmatrix} v_a \cos{\psi} + w_x \\ v_a \sin{\psi} + w_y \\ \dot{z}_a(v_a, \phi) + w_z \\ \frac{g}{v_a} \tan{\phi} \end{pmatrix} \end{align}\]Lines 1 and 2 of the dynamics are pure kinematics. Line 3 (ref) is a polynomial model of the glider sink rate as a function of airspeed and bank angle.
\[CL_0 = \frac{K}{v_a^2}\] \[\dot{z}_a(v_a, \phi) = -v_a(\frac{CD_0}{CL_0}+\frac{B*CL_0}{\cos^2{\phi}})\]The model is fitted in simulation on the trajectories of an aerodynamically correct simulator (see). In real life, it would have to be fitted on real flight trajectories (trimmed at different velocities and bank angles).
Line 4 is from a coordinated turn hypothesis (no slip turn).
The thermal is described by a wharignton model:
\[w_z = w_{z0} e^{\frac{-r^2}{r_0^2}}\]As objective function, we tested both altitude gain (\(J = z(t_f)\)) and average altitude (\(J = \Sigma_{k=0}^n z(t_k)/n\)) (see).
Here we use a simple analytic model of wind blowing across a cylindrical obstacle (see).
The objective function can be the same as for thermaling (final or mean altitude).
The solver returns a convincing trajectory that is similar to the one a human pilot would perform and consisting in lines parallel to the ridge, connected by headwind turns, the lines going further away from the ridge as altitude increases.
We can fly to a waypoint by using the average distance to the waypoint as objective function (see).
We are now able to find an optimal trajectory to a waypoint in a 2D wind gradient.
The trajectory on figure 4 leans north to find tailwind rather than going straight and experiencing headwind.
If we add a constraint on altitude (forbiding us from hitting ground), we can find a trajectory that hunts thermals along the way.
If we give it a weak thermal, it might decide to skip it and instead gain altitude by performing loops in the stronger one.