Help with PX4 SITL - Simulink connection

Hi everyone,

I’m working on a project that involves a Software-In-The-Loop (SITL) simulation of a hexacopter.

I have developed a dynamic model and navigation equations (lat, lon, alt) in Simulink, and I’m using FlightGear as the visual simulator. FlightGear is launched directly from Simulink via a script, so I don’t need PX4 to start any built-in GUI simulator (like jMAVSim or Gazebo).

I’ve followed the PX4 setup steps from the official PX4 + WSL documentation, and everything builds successfully. However, I’m confused about the correct build target for my use case. I’ve been using:

make px4_sitl_default none

But I’m unsure if this is the right choice, given that all simulation (dynamics + FlightGear connection) is handled externally by Simulink.

:red_question_mark: My Questions:

  1. Which build target should I use for PX4 SITL, considering that:
  • I already simulate the vehicle’s dynamics in Simulink.
  • I control and visualize the vehicle in FlightGear (also launched from Simulink).
  • I do not use jMAVSim, Gazebo, or other internal PX4 simulators.
  1. How should I connect my Simulink model to PX4 so that PX4 receives simulated sensor data (e.g., IMU, GPS, barometer)?
  • Should I use MAVLink and send HIL_SENSOR, HIL_GPS, etc.?
  • What parameters/modules do I need to configure inside PX4 to make this work?

Thanks in advance for any help or pointers!

New Gazebo uses the gz libraries inside of a PX4 module directly which gives a nice tight integration between gz::transport and px4 uORB. The mavlink interface is the “old” way of doing it, but should work. Does simulink have a C++ client library? If so, I would create a bridge module following the same pattern as the GZBridge. I don’t know anything about simulink, @Jaeyoung-Lim might have a better answer.