Understanding the L1 contoller

As part of improving the the developer wiki, we’ve added a page that attempts to explain how Rover is using the L1 controller.

It’s explained in more detail on the new page but in short:

  • the main vehicle code calls the AP_L1_Control library on each iteration pass in the origin (A) and destination (B).
  • within the L1 controller it then:
    • pulls the vehicle’s position from the AHRS and uses it to calculate the closest point on the line between A and B.
    • next a target position on the line is calculated (see L1_dist) using the “damping” and “period” parameters supplied by the user along with the vehicle’s speed.
    • a desired lateral acceleration (called “latAccDem” in the code) is calculated to turn the vehicle towards the target point. The “Nu1” and “Nu2” angles are used in this calculation.
  • the desired lateral acceleration is then passed into the APM/Control/AR_AttitudeControl library which feeds it into the steering-rate PID controller and finally sends to the AP_MotorsUGV class which does the mixing and sends out to the motors

Hope this is slightly interesting to others. As per usual, if you want to get involved with development, check out the “Getting Involved” section on the top page of our developer wiki started section of the wiki.


Here’s a link to the original paper that this is all based on:

I’m not so familiar with Rover or Plane, but I understand that Plane also uses an L1 controller. Are these same principles applied also to Plane?

Yes, I think so. The exact same library is used for both Rover and Plane although there may be extra features that Plane uses. I’m not sure because I haven’t looked into plane that deeply yet, only deep enough to create the basic plane architecture and now this L1 page.

I have question related to position control via L1 controller.
I have seen this in plane documentation:

  • the L1 controller converts a origin and destination (each expressed as a latitude, longitude) into a lateral acceleration to make the vehicle travel horizontally along the path from the origin to the destination.

As I understood the L1 controls the vehicle travel horizontally. Is it possible to change/tune it to be able control vertically as well?