I have written with my friend Yuri Kapitanyuk (the main idea was from him) an algorithm for solving the problem of tracking smooth curves by an unmanned aerial vehicle travelling with a constant airspeed and under a wind disturbance. The algorithm is based on the idea of following a guiding vector field which is constructed from the implicit function that describes the desired (possibly time-varying) trajectory.

For fixed-wings the output of the algorithm can be directly expressed in terms of the bank angle of the UAV in order to achieve coordinated turns. Furthermore, the algorithm can be tuned offline such that physical constraints of the UAV, e.g. the maximum bank angle, will not be violated in a neighborhood of the desired trajectory.

This work is based on the paper Guidance algorithm for smooth trajectory tracking of a fixed wing UAV flying in wind flows, in the proceedings of ICRA 2017.

**How does it work?**

We start from the implicit equation of the trajectory, for example for a circumference we have that , where and are the x, y coordinates with respect to HOME ( in the figure below) and R is the radius of the circumference. Note that when the vehicle is over the desired trajectory, then , otherwise it will be different from zero. We will use this concept of “level set” to define the notion of distance to the trajectory, namely . It has to be noted that this is different from the Euclidean distance (see figure below).

For the sake of clarity we will consider just 2D trajectories and parallel to the ground. Let us stack the x and y coordinates in and consider the following kinematical model for our vehicle

where is a constant that can be considered as the airspeed, with being the attitude yaw angle, is a constant with respect to representing the wind and is the control action that will make the vehicle to turn. We also notice that the course heading , i.e. the direction the velocity vector is pointing at, in general is different from the yaw angle because of the wind.

Given a desired trajectory, we compute its normal

and its tangent

The idea is to steer the vehicle such that it follows the direction given by the unit vector calculated from

where is a positive gain. At each point we can build a unit vector from . **This collection of vectors is our Guidance Vector Field**. Note that when the error is zero, then we are just tracking the tangent to the trajectory.

The algorithm needs for work the measurements of (typically derived from GPS), position w.r.t. HOME (typically derived from GPS too) and yaw angle or sideslip angle . The algorithm still works quite well in practice with only and , in other words, you will only need to have installed a GPS.

The algorithm is already available and ready to use in the opensource project Paparazzi, the free autopilot.