Unable to run example PX4 in Hardware-in-the-Loop (HITL) Simulation with jMAVSim Simulator
12 views (last 30 days)
Show older comments
Hello, when I run the example PX4 in Hardware-in-the-Loop (HITL) Simulation with jMAVSim Simulator - MATLAB & Simulink - MathWorks Italia I get the following error:
Top model targets built: Model Action Rebuild Reason ================================================================================== px4demo_QGCWaypointFollower_hitl Code generated. Incremental checksum changed. 1 of 1 models built (0 models already up to date) Build duration: 0h 3m 27.816s
action: EXT_INIT Creating Target Handler (XCP on Serial)... Build directory: C:\Users\paolo\OneDrive\Documenti\Tesi_magistrale\px4demo_QGCWaypointFollower_hitl_ert_rtw Serial Port Name: COM4 Baud Rate: 1152000 action: EXT_CONNECT Connecting to the target...
External Mode Open Protocol Connect command failed
Caused by:
- Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command
Component:Simulink | Category:Block diagram error
And JMAVSim doesn't open.
The build is ok, but seems somthing is wrong with the connection. My setup is:
- Pixracer R15
- Serial-to-USB FTDI converter
- Micro USB type-B cable
The port setup is show in photo, I have serial port COM3 e COM4.
And this is my hardware settings:
- Build options > Automatically determine serial port for firmwareupload √
- Enable HITL Mode > Simulator: JMAVSim √
- External mode > Hardware board serial port: /dev/tty/S1
- External mode > Host serial port: COM4
- MAVLink > Enable MAVLink on /dev/ttyACM0 √
- /dev/ttyS1 > Baud rate : 1152000
0 Comments
Accepted Answer
Arun Mathamkode
on 12 Oct 2022
MAVLink is enabled by default over TELEM1 (I am assuming /dev/tty/S1 is TELEM1 in your case) for QGC connectivity. This can cause conflict when we are trying to write data to same serial port from Simulink as well. Ensure MAV_0_CONFIG is set to 0 for disabling MAVLink over TELEM1 or consider using TELEM2 or any other free serial port.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!