Companion read Heartbeat from Qgroundcontrol

Hi, I am exploring some options in the QGroundControl. I came across this setting in the QGC Application Setting. The checkbox emit heartbeat.

Some questions came to my mind,

  1. Does QGC emit heartbeat to the companion or pixhawk?
  2. If it does, how can I read/get this heartbeat that the QGC emits in the companion Raspberry Pi?

The goal I want to achieve is to check the QGC to Raspi companion connection by reading the heartbeat. If the QGC suddenly being closed/malfunctions/not sending the heartbeat the Raspi can disarm the vehicle.

Hi @BMNanda, welcome to the forum :slight_smile:

HEARTBEAT messages are an advertisement to anything that can hear them - they’re not targeted to any particular receiver.

The companion software includes MAVLink routing that acts as a relay of communications between the autopilot (e.g. ArduSub) and the control station software (e.g. QGroundControl), so any heartbeats it receives from QGC get passed on to the autopilot.

You can access it from any program that has access to the MAVLink stream - just look/wait for HEARTBEAT messages with QGC’s system ID (e.g. 255, usually, as shown in your screenshot).

This is a well-founded idea, but not the recommended approach - ArduSub already has a control station connection failsafe that you can configure (using the FS_GCS_ENABLE parameter) to trigger a vehicle disarm when the autopilot stops receiving those heartbeats :slight_smile: