# Guiding Vector Fields

I’m looking into guiding vector fields as a method for path following, and I’m curious how it works. I know a vector field is created around a polynomial or biarc spline, and then you use your coordinates to find a vector on the field. This is where I get lost, because I don’t see how you can turn that vector into outputs for your robot unless the robot already is facing the same direction as the vector at its location is. In other words, once you have the field and the specific vector for the robot’s location, how do you turn that into an output for each side of a tank drive, for example? Here is a link to a paper on this topic which is far beyond my understanding, but maybe someone on here can put it in plain English. https://arxiv.org/pdf/1610.04391.pdf

2 Likes

If you’re interested, I implemented this algorithm a while ago here: https://github.com/nickschatz/kgvf
It’s been a while, but I think I can boil down the key points. You should have a basic grasp of multivariable calculus and a tad of linear algebra.

The first key bit is the \bar{m}_d vector and its relationship to \bar{m}. \bar{m} is the robot’s current heading. \bar{m}_d is the desired heading to return to the path. This is a simple proportional control based on the cross-track error and path tangent vector. Fig. 2 illustrates all the key vectors and variables. \bar{m}_d is calculated in vectorAt. If you were to implement the GVF algorithm for a holonomic robot, then this is all you would need- just let \bar{m} = \bar{m}_d. For a skid-steer robot, you need part 2 which is decidedly more complex.

We introduce two more variables/functions of robot/path state- \delta, which is the angle between \bar{m} and \bar{m}_d; and \omega_d, which is the curvature of the vector field at a certain position. For our purposes, it is the desired curvature to follow the vector field. Once these two are defined, the controller is very simple.

(23) \omega = \omega_d - k_\delta \delta

(If you’re not familiar with skid-steer curvature \omega, it’s pretty much 1 / (radius of the circle the robot drives in))

k_\delta is a tuning constant like k_n in the \bar{m}_d calculation. The trick is now calculating \omega_d. For conciseness I’ve not been putting the arguments, but remember that these are all functions of robot state and our path.

\omega_d = \dot{\bar{m}}_d^T E \bar{m}_d where \dot{\bar{m}}_d is the derivative* of \bar{m}_d and E = \left[\begin{array}{cc}0 &1 \\ -1 & 0\end{array}\right], from (17). This is a kind of psuedo-dot product, but I don’t feel like I can competently explain the math behind it.

A lot of the paper is dedicated to proving the existence of these paths and that they always converge, which we don’t care that much about since we’re just implementing it and I couldn’t explain that anyways.

I haven’t talked at all about the implementation of these paths, because it doesn’t matter that much. Pretty much all you need to do to implement this algorithm is to describe the tangent vectors and the cross track error. So it works to describe the path with a simple equation like the ellipse example, or something more complex and useful like a spline.

* Kind of complicated. See (18).

4 Likes