This paper studies the implementation of controllers in the Pixhawk by using the Matlab/Simulink platform to modify the settings. Commercial products for the realization of autonomous flight of unmanned aerial vehicles (UAVs) are more and more accessible nowadays. One of those is the Pixhawk collaborating with mission planner. However, the massive and sophiscated structure of the mission planner makes it difficult to implement customized controllers for a specific UAV. This paper intends to build the controller with Matlab/Simulink, and implement it on the mission planner directly by employing the PX4 Toolchain toolbox. Design and analysis of the controllers, software-in-loop, hardware-in-loop and flight tests are performed in this research. The work described in this paper potentially helps engineers who are not of computer-science background to design and implement controllers for the UAV autonomous flight much more easily.