I know the topic of adaptive control keeps showing up, but let's try one more time.

I'm trying to implement the Virtual Reference Feedback Tuning  algorithm to tune the PID loops on the ArduPlane software. My final objective is to use this as my graduation project (I'm an E.E. student). I have chosen this method because of some of its characteristics like:

  • Non iterative - Only one experiment needed, with the data collection from the plant
  • Can be used to tune PIDs - So no need to change the main code on APM
  • Can be run offline - This way if the Atmega doen't have enought power to process the data, it can be processed on the Ground Station ( even after the flight, without the use of telemetry).
  • Finds the global minimum directly - Unlike other methods that can lead to sub-optimized controllers.

The paper witch originally describes the algorithm is at this link. And a good explanation of the method and comparisons to others can be found on this book.

I have made for a class last semester a project about this method, the report can be read here. I also made a demo of the software (sorry about the bad diction, English is not my native language and recorders frightens me! feel free to ask anything):


I have already started to work on this (this is my git clone of the source), and if you would like to join me I would be pleased. My current strategy is:

  • Run HIL simulation (with X-plane) on the APM
  • Transfer all the necessary data to the Mission Planner via Mavlink. (the necessary data is the output of the PID controllers, and the output of the plant [for example in the roll controller these are: g.channel_roll.servo_out and ahrs.roll_sensor])
  • Collect, format, visualize, and trim the data on Labview. The communication between MP and Labview is via UDP.
  • Transfer the formatted data to Matlab, where the VRFT algorithm is run.

I'm using this data flow because I like to work with these tools, but it could all be hard-coded in MP or in the APM source.I currently have this setup up and running, but the implementation of the algorithm is still dangling. 

My first try was with the Roll PID, but it failed catastrophically since I had bad data. By this i mean the data was not received in a fixed sample rate neither the scale where appropriate. I also had problems with the gain adaptation introduced by the variable speed_scaler.

The second try was using just a P controller for the Yaw_Nav controller, I got I little more successful ( latter if there is interest I can post a video). But again I had problems with offsets, sample rate, and scaling between MP parameters and APM variables.


I'm happy to hear any response or ideas (or even to get help :).


You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


  • This sounds very interesting. I can't help with APM or planes but I plan to read the paper and see if I stand any chance of understanding and applying :)

This reply was deleted.