"Waiting for Vehicle Connection" - Custom UDP - What is the connection sequence?

Hi All, I’m trying to connect QGroundControl to a custom autopilot via MavLink over UDP (currently all on localhost), but am only having partial success.

If I start up a px4_sitl simulator, the connection to QGC is made successfully. I can then kill the simulator, and run my code, which currently only sends heartbeats, status, gps position, and attitude messages. I can see the messages in the MavLink Inspector, and QGC updates the moving map and attitude indicators happily. That’s the partial success…

But, if I disconnect from the vehicle, or if I try to start QGC without the px4_sitl simulator running I just get “Waiting for Vehicle Connection”. I can still see my messages showing up in the MavLink Inspector. Everything is getting through, but I just seem to be missing something that results in a “Connection”. I have read the communications flow doc: https://dev.qgroundcontrol.com/en/communication_flow.html but it didn’t really provide any insight. From that doc it would appear that a Heartbeat message should be sufficient to raise a vehicle connection…but that doesn’t seem to be the case since I’m showing heartbeats in the MavLink Inspector.

Can anyone point me in the right direction? At this time I don’t know whether to start poking through the PX4 source, or the QGC source. Some hints here would be greatly appreciated.


Just a bit more info:

To implement my code I borrowed heavily from the example here: https://mavlink.io/en/mavgen_c/example_c_udp.html

In the notes they acknowledge that QGC will not show a “Connection” when using this example. But what is the missing link/handshake to create a connection?

Problem Solved…but I’m not sure if this is a bug or not.

I had my Mav component ID set to 200 (arbitrarily chosen), and as soon as I put it to 1 it connected.

So, with a Mav Sys ID of 1, and a Component ID of 1 it will connect.

But why won’t it connect with a different component ID? Are they supposed to be enumerated serially?

At any rate…I can now proceed!

Ok, it’s not a bug…just not super well documented. QGC will only accept connections from Autopilot components…so the COMP_ID needs to be 1 (or a couple PixHawk variants) as described in the MultiVehicleManager.cc