Steering Algorithms

What is the difference between “PureP” and “Stanley” steering?
Why do we have both and what are the benefits of each?

Pure Pursuit (PP) uses the curvature of a circular arc that connects the rear axle location to a goal point on the path ahead of the vehicle. Pure Pursuit was originally designed for fighter plane pilots and tracking. Stanley is a nonlinear feedback function of the cross track error measured from the center of the front axle to the nearest path point for which exponential convergence can be calculated. PP draws arcs to keep the pivot point on the line, Stanley tries to keep the steer axle on the line and the rest will follow. Pure pursuit is a lot like the way we drive down the road, we look ahead to a point on the road and steer towards it. Stanley looks across at the yellow line out the side window and determines the best angle to get back in your lane.

Stanley requires a really accurate heading since the position of the steer axle in the world is determined based on the pivot position and the heading. Pure pursuit generally likes the antenna farther ahead closer to the steer axle to determine distance from the guidance line as it tries to generate that arc back to the line.

PP has many more settings, is generally better for slow speed like under 2 kmh. Stanley works quite well for most ag speeds guidance as it was designed for road vehicles.

Both systems uses 2nd order derivatives (non linear steering methods) to bring the vehicle back to the line. As in, as they approach the line it needs to start steering away from the line to prevent crossing back and forth over the line and never getting on course, like an icy road. the opposite is taking way too long to get back on the line.

Homework time: Here is an excellent read, well worth the time and explains in very good detail how steering systems work Steering methods


Dear all,

Please let me hook in to this topic.
I have installed my antenna above the front axle or even a bit ahead.
For my understanding it has the advantage to detect the error to the centerline quickly.
Like above mentioned PP would be the way to go but if i do so at around 8km/h most of the time the tractor is going parallel to the line and going very slowly back on track.
Going with Stanley it steers from left to right like crazy.
As advised i have the aggresivity between 0.8 and 1.
I think may i have to turn down the agresivity very low because the position on the front axle will move very fast even there is only a small steering angle impuls.
I sm not sure if it would better to place it nearer to the back axle to get it more smooth.

Do you have BNO055 installed? I don’t know exactly how the steering is calculated, but for sure the cours that is stabilized by BNO055 is as important as position and distance from the line.
Aggressiveness and line crossing aren’t just Stanley’s settings. Try to set the PWM, especially pay attention to the low PWM max.

I have a BNO installed, but actually disabled because it works better without.
Its installed on the roof and seems not to drift a lot.
During stand still it changs under 1° within 30 minutes.
Some advises to set the PureP settings?
I use the 4.3.10 version but max low PWM does not seem to work.
I have 40 as minimum PWM and 15 as gain.
For my understaning I got for an angle error of 3° an output of 85 PWM. When I set low Max to maybe 70 PWM it should not go up to 85 but it does.
Also sometimes it follows the line very good ±2cm but its not central, moving between 8-12 away from the center.

Prueba a seleccionar una ganancia entre 4 y 10. No la subas mas porque provocaría muchas oscilaciones bruscas de lado a lado. Mueve los cursores pwm lejos del maximo. Con los tres cursores pwm divides la linea de potencia electrica en dos partes. Min pwm establece la energia minima para que el motor o valvula responda a una minima correccion. Si la corrección tiene que ser mayor, de mas de 5 grados (eso creo) el valor de la potencia que se mandará al motor o valvula estara entre los parametros establecidos por low pwm y max pwm. Este ultimo parametro max pwm establece la potencia máxima que se enviará al motor o valvula cuando las ruedas de direccion deban girar rapido para volver a la linea o para realizar giros en U.
Yo tengo instalada la antena sobre los contrapesos delanteros, un metro por delante del eje de direccion, y en mi caso me gusta mas stanley porque sigue la linea muy bien, aunque como dice Brian es como mirar la linea de la carretera por la ventana del coche, lo que implica que hace muchas mas pequeñas correcciones para seguir la linea. En mi caso pure P no va tan bien, dice Brian que este modo tiene en cuenta la posicion del eje motriz trasero sobre la linea, y en mi caso el punto a perseguir debe estar siempre por delante de la antena, cosa que no sucede al aminorar la velocidad de repente porque el punto se acerca al eje trasero quedando por detras de la antena y en este caso la direccion se vuelve loca, obligando a seleccionar un valor de adelanto mayor para trabajos muy lentos. Tanto en un caso como en otro, en pure P, noto que tarda demasiado tiempo en colocarse sobre la linea y tiene desviaciones de hasta 15 cms antes de acercarse de nuevo a la linea, creo que es debido a la distancia existente entre el eje traseto y el punto que se mueve sobre la linea delante del tractor.

Thank you Cesar.
For my feeling Stanley works better if the antenna is at the front.
With PP the steering angle set value is more smooth and a good wave in steering chart but it takes often long to get on the line or it steers parallel to it.
With stanley the set point in steering chart is more zig-zag but works better.

I’m not sure if i missunderstood the low max PWM or if it does not work.

I have min PWM 50 and Gain 10.
When I use the manuel mode and set an error of 3° I should get an theoretically output of 50+(3x10)=80
If I set low max to 70 for my understading this value must not be exceeded till error of 5°.
But I get at 3° an output of 80 not of 70.

@Cesar one thing I got in mind if we use the antenna far at the front is that the antenna moves a lot sideways if there is a small steering angle compared to have the antenna more to the back axle.
I think because of that we have to set the aggresivity value very low.