Building QGC to recognise non-Pixhawk telemetry links

Hello, I am working on a project where I am using two modes of telemetry links to a PX4 flight controller, one is the standard Wi-Fi and the other is sub-GHz LoRa which will accept only a limited set of MAVLink messages. Is there a way to build QGC such that it recognises and accepts MAVLink messages from a USB connection that is not PX4 or telemetry radio?

Alternatively, is it possible for QGC to retrieve a MAVLink message from a UDP connection and recognise it as a telemetry link (eg: the MAVLink message is routed from USB to an internal UDP port which connects to QGC)?

I know of the high latency/iridium mode but that requires the PX4 to have established and maintain two telemetry links (one each for high and low latency) , while I would like for it to switch between links when needed.

Many thanks in advance

Generally, GQC is ready to connect on UDP and\or serial connection as these are the main methods.
If your USB connection identifies as a virtual COM port, it might “just work”.
Same goes for UDP.

I’m not sure however what’s the minimal message set and rates for it to be count as a “live” connection in QGC.
I can know Mission Planner allows you to connect to pretty much anything that broadcasts a Mavlink heartbeat.

Thanks for the response! As long as it recognises a heartbeat incoming from the connection, it will automatically recognise and connect to it? Does it remain open and listening to all connections until it establishes the connection? Does Mission Planner only need to receive one heartbeat without any of the other messages to establish a connection?

Many thanks in advance

As an addition to my post, I’m hoping to develop something similar to the High Latency Protocol but with my own custom message instead of the HIGH_LATENCY2 message. From my understanding, in this protocol the GCS initiates the switching between latency modes, would it be possible for the PX4/companion computer to signal this instead?

I’m also looking up on how to add my own custom MAVLink mode (similar to the normal/onboard/config/iridium modes), but have had no luck so far

Any advice on how to proceed would be greatly appreciated. Thank you

As for how Mission Planner behaves - I’m not really sure. If I remember correctly a heartbeat is enough, but I think it should be at 1Hz interval or greater.

High latency - no idea.

Custom Mavlink mode - I didn’t see it in any of the documentation pages but it’s simple enough to have a look here PX4-Autopilot/…/mavlink_main.cpp and search for MAVLINK_MODE_CUSTOM. See how other modes are defined and define yourself a new custom mode.
Another option that can work is for the other device to request a message stream.

@melc it sounds ideal in your situation to create a new mavlink stream with a subset of messages. This would require edits to PX4 Firmware but are going to be a tailored solution to your problem whereas high latency is a really paired down set of messages and the normal mavlink stream is too much data.

You would simply add your custom mode in this switch-case

Then follow this guide to set up the streams on the flight controller side: MAVLink Messaging | PX4 Guide (main)

1 Like

Thank you for the reply. I tried sending heartbeats over USB to connect to both QGC and Mission Planner respectively, and neither connected. However, UDP connection works so I built a USB-to-UDP bridge so the heartbeat messages received at the LoRa module is forwarded to a local UDP port, which is picked up by QGC.

Thanks for the reply. I’m currently working on it, studying how best to emulate the MAVLink Iridium mode but with the companion computer initiating the switch in modes rather than the ground station. The flight controller side seems simple enough, it’s just the QGC side that I’m focusing on now. Will update once there is progress and everything is working well.

Update: I have modified the QGC software by closely emulating the high latency mode and it works, sort of. When streamed alone, the message can be seen in MAVLink Inspector but homepage shows it is disconnected. But when it is first connected via Wi-Fi UDP and switched to LoRa, it will disconnect for a couple seconds before reconnecting and continues showing that it is connected, but is unable to update any parameters or its location on the map. This is similar behaviour to high latency mode so it makes sense.

Now I am working on creating a sort of “bidirectional protocol”, where users can send commands to the PX4 controller via LoRa for emergency actions such as RTL. Will update and publish a github link if successful.