Hi all,
I’m trying to get a Simulink model to connect to a PX4 autopilot. A few others have successfully already used this very same model on their PCs.
I’m getting stuck when running Simulink, then opening a Windows Command Prompt, and compiling the PX4 (which appears successful). Simulink shows compiling for a bit, at maybe 10% complete or so (in the Simulink window frame), then switches to initializing (in lower left corner of the Simulink window frame) even before I can get the PX4 make started.
The PX4 make Command Prompt window says “Waiting for simulator to accept connection on TCP port 4560”. Screenshot attached of the make results.
The Simulink appears to be frozen when running; time is not incrementing. Should time increment when Simulink is trying to connect? I’m guessing it should. In any case, the code to even kick off the Simulink appears to not be executing (it’s mexPrintf notification statement never seems to run; see below).
Simulink C code (that’s in an S-function block) has a mexPrintf(“Waiting for PX4 to connect on TCP port 4560…\n”); that is apparently never executing. Here’s the C code snippet on the chance it’s helpful…
static void mdlStart(SimStruct *S)
{
ssSetRWorkValue(S, 0, 0.0);
static std::string eStatus;
try
{
static SILConnector sil_connector("0.0.0.0",4560);
mexPrintf("Waiting for PX4 to connect on TCP port 4560...\n");
sil_connector.open();
mexPrintf("PX4 connected on TCP port 4560.\n");
ssSetPWorkValue(S,0,(void *)&sil_connector);
}
catch (const std::exception &e)
{
eStatus = std::string(e.what());
ssSetErrorStatus(S, eStatus.c_str());
}
}
Thanks in advance for any help. I’ve followed the steps others have treaded before me to get this sim connected and running, but it’s difficult since nothing is obviously broken for me (even though something is).
