Looks like STATUS_TEXT is not sent if heartbeat from GCS is lost

I’m curious why STATUSTEXT.hpp mavlink stream has a condition

if (_mavlink->is_connected()) {

This condition means that STATUS_TEXTs will be sent to the GCS only if vehicle received heartbeat from GCS no later that 1.5 seconds ago. Looks like STATUSTEXT is the only stream that has this condition. First I thought that it was made to make STATUS_TEXT more “reliable”, like we send it only if we know that GCS is alive and if not, we keep it in queue for later. But couple lines below there is this code:

// don't send stale messages 
if (hrt_elapsed_time(&mavlink_log.timestamp) < 2_s) {

2 seconds! So if we lost even one heartbeat from GCS and status message appeared at that moment, it will be definitely lost.Do you have any ideas?

Are you loosing any STATUS_TEXT messages? if so what’s your setup between autopilot and gcs?

We are. It’s hard to say what is the reason of loosing exactly so i’m curious about this code.

we have wifi\UDP channel between GCS and PX4.

Comment from 2022-02-11