The NASA MSFC team selected Model-Based Design with MATLAB and Simulink for their engineering internship program.
Interns learn modeling, simulation, and control design in Simulink by viewing the Simulink tutorials on mathworks.com and attending training sessions conducted by NASA engineers.
After assembling the quadcopter from a kit, they build a six-degree-of-freedom model of the quadcopter in Simulink, using Aerospace Blockset™ to model the equations of motion.
Working in Simulink, they create a controller model to provide stability augmentation for the quadcopter. To access input from ArduPilot sensors, including accelerometers, gyros, and the magnetometer, they add blocks from the APM2 Simulink Blockset to their controller model.
They acquire a linear model from Simulink, analyze the gain and phase margin with the SISO Design Tool from Control System Toolbox™, and then run simulations to verify the control system performance. Using a block from Aerospace Blockset, they connect the model to FlightGear flight simulation software to visualize simulation results, and then refine their design based on those results.
Using the Run on Target Hardware feature of Simulink, the interns load their controller model directly onto the ArduPilot Mega hardware for flight testing.
They postprocess recorded flight data in MATLAB and use the results to fine-tune their control algorithms and plant model.
NASA MSFC engineers are currently revising their internship program. The new version will use a hexacopter. The ArduPilot Mega hardware will be replaced with the more powerful Pixhawk processor, which will enable interns to incorporate Kalman filtering, implement sliding mode controls, and handle engine out conditions. They will generate C code for the Pixhawk target from their Simulink models using Embedded Coder®.