Unable to run example PX4 in Hardware-in-the-Loop (HITL) Simulation with jMAVSim Simulator

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
Unable to connect to the 'PX4 Pixracer' target for 'px4demo_QGCWaypointFollower_hitl'.
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

 Respuesta aceptada

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.

1 comentario

Hi Arun, thanks for the reply. Launching the example using TELEM2 seems to solve the problem, thanks!
I have noticed that I must launch JMAVSim manually beacuse it doesn't open automatically.

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Versión

R2022b

Etiquetas

Preguntada:

el 11 de Oct. de 2022

Comentada:

el 13 de Oct. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by