Contributor
Emre Saldiran

Custom Controller Implementation Using MathWorks Simulink Code Generation


Mentors
Andrew Tridgell, Peter Hall
Organization
ArduPilot
Technologies
c++, matlab, Simulink, Code Generation
Topics
robotics, autopilot, Flight Control
MathWorks Simulink is a graphical programming language that allows one to create nonlinear vehicle models, and perform control system design and development. Using Simulink code generation tools to add a custom attitude controller to the ArduPilot will allow the researcher to test their novel control algorithm in ArduPilot without spending too much time in manual coding which will further increase ArduPilot usage in academia. Currently, ArduPilot does not have a short and concise way to implement and test custom controllers. This project’s main aim is to create a systematic and sustainable way to implement a custom controller into ArduPilot using Simulink code generation and set an example for other researchers on how to use ArduPilot as a control system development platform. I implemented a new controller in the ArduCopter and has a Simulink model of this controller, thus I will continue with this vehicle type. But the methods laid during this project should be transferable to the other vehicle types. There are multiple-step I identified to achieve this goal. Firstly, the ArduCopter attitude controller code structure needs to be changed to allow running custom controller concurrently and safely switching between two-controller. Second, a hook in ArduCopter for Simulink code generation to bind should be created. Third, human-readable source code from Simulink without any dependencies on the Matlab libraries should be generated. Fourth, prepare a Matlab script to automatically merge generated libraries into ArduCopter source code, and configure and build it. Last, prepare detailed documentation and video to show how to utilize this functionality.