Error in PX4 SITL with UAV Toolbox Support Package for PX4 Autopilots

9 views (last 30 days)
I'm performing SITL on Windows 11 with jmavsim using UAV Toolbox Support Package for PX4 Autopilots but I got an error:
On the diagnostic view I got:
Top model targets built: Model Action Rebuild Reason ==================================================================================
openloop_2022b Code generated. Global variable px4_Bus_actuator_armed changed. 1 of 1 models built (0 models already up to date) Build duration: 0h 2m 11.97s
action: EXT_INIT Creating Target Handler (XCP on TCP/IP)... Build directory: D:\model validation\matlab2022b\openloop_2022b_ert_rtw Target name: 127.0.0.1 Target port: 17725 action: EXT_CONNECT Connecting to the target...
External Mode Open Protocol Connect command failed
Caused by:
  • Could not connect to target application: XCP TCP/IP error: Connect failed
Component:Simulink | Category:Block diagram error
Unable to connect to the 'PX4 Host Target' target for 'openloop_2022b'.
On the cmd, I got:

Accepted Answer

Thiago Felippe
Thiago Felippe on 20 Sep 2023
I had the same problem. I found the following workaround:
  • Click in "Monitor & Tune"
  • Wait for the Simulink error. Wait a little more.
  • Don't close the command window nor the jMAVSim
  • Go in the down arrow in "Monitor & Tune" and change it to "Connect" (under "Step by Step Commands"). See image below:
  • Wait until the connection is made
  • Click in "Start" (it shows in place of "Monitor & Tune"). See image below:
  • And it is done!
I think the Simulink doesn't wait to PX4 Host Target to fully boot up before trying to communicate with it.

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!