Connection issues during PX4 uorb topic data relay in External Mode

3 views (last 30 days)
I am using the embedded coder support package for PX4 and am working on a flight controller (developed in SIMULINK). I need to receive motion caputre data for testing and am using the inbuilt PX4 uorb blocks to receive data from our motion capture system. I relay the motion campture data on to the Pixhawk telem port through a RPi (using ROS). When I run my tests on External mode, the simulation automatically stops within a minute or so citing the following error:
--------------------------------------------------------------------------------------------------------
Error occurred while executing External Mode MEX-file 'ext_comm':
ExtSetTargetPkt() call failed on CLOSE.
Ensure target is still running
-------------------------------------------------------------------------------------------------------
My PX4 is still on and is functional when this error pops up. Has someone encountered similar issues?
Is there a better way to verify if SIMULINK is subscribing to the uorb topic? I am just worried that SIMULINK might stop subscribing to the topic mid air. Thank you.

Answers (1)

Deep Parikh
Deep Parikh on 21 Oct 2019
I am assuming that when you press "Monitor & Tune" (R2019b) or "Run" in external mode (R2019a and earlier), the simulink model is getting compiled and built. The model starts running and the simulation time increses and within one miniute or so you are getting the specified error.
The error that you have mentioned is genereally caused when the px4 target is not responding to the SIMULINK. You can itteratively remove certain functionalities of your model, like receiving the data over serial, that can interfere with normal operation of px4 target and check if the error persists. Also, it is not necessary that the functional PX4 is still responding to SIMULINK calls.

Community Treasure Hunt

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

Start Hunting!