I am looking for some help developing an interface between the Ardupilot SITL simulator and MATLAB/Simulink.
I am part of a research team in the early stages of developing a high-fidelity model of multi-rotor aircraft. We have access to state-of-the-art wind tunnels and measurement equipment, and several individuals involved are very experienced in aerodynamic modeling. I personally have significant experience modeling and simulating multi-rotor aircraft; for example I was the lead designer for the "Quad-Sim" project when I was completing my undergraduate studies (Mathworks File Exchange Entry, Git-Hub repository,). Since the Quad-Sim project ended I have made a number of significant advances in the area of modeling and simulating multi-rotor aircraft, and I expect the upcoming simulation I am working on (and its derivative works) to have many new and desirable features that I believe will make it useful to a broad audience. Among other things, this upcoming simulation will include wind-tunnel derived flight performance data in order to realistically model the multi-rotor aircraft performance in "off-nominal" conditions, and will be designed to support multi-rotors with various n-motor arrangements (though obviously the wind tunnel data will only apply directly to the configurations we can test). While it is relatively straightforward to simulate the aircraft dynamics in Simulink, simulating the flight controller in a highly accurate and realistic manner is less convenient within this environment. Instead of creating a controller within the Simulink environment to approximate the behavior of the real on-board controller, I would like to link the Simulink model directly to a SITL instance of ArduCopter.
An interface between Simulink and SITL would provide several things to the user community:
- SITL would now have an interface to the MATLAB/Simulink environment, which I suspect would be of interest to many people, from undergraduate students to professional engineers and researchers. Simulink can be a great environment for assessing the behavior of complex dynamic systems, and I am sure a large number of users would find uses for this interface if it existed.
- Combined with the new multi-rotor simulation currently under development, users would have a functioning and documented version of a realistic multi-copter simulation which "out-of-the-box" would be compatible with SITL, which could be used as a building block for their own work in this area.
- Allow simulation of complex real-world scenarios to evaluate how well Ardupilot can handle difficult flight conditions, such as sensor malfunctions, motor failures, severe turbulance, etc. Of course, current SITL simulations could be modified to allow some degree of simulating these failures, but the organizational structure of the MATLAB/Simulink environment makes it a particularly appealing for investigating such areas.
To reiterate, I am proposing to have MATLAB/Simulink be the platform for simulating the dynamics of the vehicle in flight (and simulating the associated feedback from on-board sensors) and letting SITL ArduCopter "fly" the Simulink simulation. Communication between the two environments would be done via the same UDP interfacing methods currently used by SITL to communicate with the physics simulations. Simulink has a toolbox which I have access to (and which is included in current "Student License" downloads) called "Instrument Control Toolbox" which appears to allow two way UDP communication from within Simulink models. I believe Simulink would also be able to be run in real-time modes which should allow it to provide high frame-rate feedback, though details of this are not clear yet. Presumably, simulation output visualization could be done in whatever program the user prefers, such as FlightGear, MAVProxy, or even MATLAB/Simulink.
Please let me know if you think you can help. I have very little experience with the type of programming that will be required to enable this functionality on the Ardupilot side of things. While I have looked through the Ardupilot code quite a bit, I am still unsure how much work would be entailed in setting up this interface from the Ardupilot side, though I believe it should be feasible and perhaps not even particularly difficult for someone with experience. Given some guidance on required communication behavior I believe I can handle the Simulink side of things, though I'm open to any and all collaborators.
I think a number of folks in the community would be very pleased to have this functionality, so please get in touch if you think you can help.
Thanks for reading, and happy flying!