Pixhawk software-in-the-loop (SIL) connector for Simulink
Pixhawk SIL Connector for Simulink
Simulink C++ S-function for software-in-the-loop simulation with Pixhawk.
Requirements
- MATLAB & Simulink (MATLAB R2022a or earlier)
- MinGW-w64 or MSVC C/C++ Compiler
- QGroundControl
- PX4-Autopilot source code (the latest stable release v1.14.0)
https://github.com/PX4/PX4-Autopilot/releases/tag/v1.14.0 - Windows Subsystem for Linux (WSL 2)
https://learn.microsoft.com/en-us/windows/wsl/about
Files
includes.zip (contains the Asio C++ and MAVLink C libraries)
Build instructions
- Install MATLAB-supported compiler
https://mathworks.com/support/requirements/supported-compilers.html. - Download the "pixhawk_sil_connector.cpp" and "make.m" files and the "includes.zip" archive.
- Unzip the "includes.zip archive".
- Run "make.m" to create a "pixhawk_sil_connector.mexw64" (Windows), "pixhawk_sil_connector.mexa64" (Linux), "pixhawk_sil_connector.mexmaci64" (macOS) file.
Note: If you are using a compiler other than MSVC (e.g. MinGW64) you need to add the -lws2_32 flag to the "mex" command in the "make.m" file.
Use instructions (Simulink model running in Windows, PX4 Autopilot running in WSL 2)
-
Download and install QGroundControl for Windows https://docs.qgroundcontrol.com/master/en/getting_started/download_and_install.html.
-
Create a new "Comm Link" in QGroundControl via the "Application Settings" page. The type of the link must be UDP, thed port 18570, and the server address must be the ip address of the WLS 2 instance. You can use the "ip addr" command to find the ip of the WSL 2 instance. Note that the ip of the WSL isntance will change every time you relaunch the instance.
-
Open and run "pixhawk_sil_connector_example.slx".
-
Build the PX4-Autopilot source code in WSL 2 using the following commands:
git clone --recursive https://github.com/PX4/PX4-Autopilot cd PX4-Autopilot git checkout v1.14.0 git submodule sync --recursive git submodule update --init --recursive export PX4_SIM_HOST_ADDR=x.x.x.x #(the ip of the computer running the Simulink model) make px4_sitl none_iris
https://docs.px4.io/master/en/dev_setup/building_px4.html
https://docs.px4.io/main/en/simulation/. -
If you already have a build of the PX4-Autopilot source code start PX4 using the following commands:
export PX4_SIM_HOST_ADDR=x.x.x.x #(the ip of the computer running the Simulink model) export PX4_SIM_MODEL=model (iris for v1.13.3 or none_iris for v1.14.0) ./bin/px4 -s etc/init.d-posix/rcS
Demonstration of the Pixhawk SIL connector example
Pixhawk SIL connector example
Pixhawk SIL connector example sensors
Additional information available at:
인용 양식
Kiril Boychev (2024). Pixhawk software-in-the-loop (SIL) connector for Simulink (https://github.com/aviumtechnologies/pixhawk-sil-connector/releases/tag/1.4.0), GitHub. 검색됨 .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!버전 | 게시됨 | 릴리스 정보 | |
---|---|---|---|
1.4.0.0 | See release notes for this release on GitHub: https://github.com/aviumtechnologies/pixhawk-sil-connector/releases/tag/1.4.0 |
||
1.1.0 | See release notes for this release on GitHub: https://github.com/aviumtechnologies/pixhawk-sil-connector/releases/tag/1.1.0 |