"Failsafe enabled: no datalink" when flying around using MAVROS services

Hello world!

I would like to fly to some waypoints using MAVROS.
Therefore I dispatch MAV_CMD_DO_REPOSITION commands to the /mavros/cmd/command service.
This works as long as QGroundControl is running. Since I really don’t use it for anything though, I would like my script to work without a running QGC instance as well.
But it doesn’t: arming and takeoff are possible, but it lands right afterwards stating WARN [commander_tests] Failsafe enabled: no datalink.

What does QGC do to make it work, i.e. what do I have to do to avoid having to run QGC?

Thank you!

Appendix:

  • I’m using SITL gazebo simulation
  • rostopic echo /diagnostics states FCU connection is present
  • the only difference in the ulogs is the telemetry_status topic showing up when running QGC, but I don’t really know what that means…
  • MAVROS offboard control works without QGC
1 Like

Turns out the mavlink shell also works as a valid datalink.
I’ve been able to identify the responsible passages and came up with a little “datalink thread”, which solves my issue. It goes like this:

import threading
from pymavlink import mavutil

class MavHeartbeatThread(threading.Thread):
    def __init__(self, interval=1.):
        super(MavHeartbeatThread, self).__init__()
        self.interval = interval
        self.running = False

    def run(self):
        self.running = True
        self.mavlink_connection = mavutil.mavlink_connection('0.0.0.0:14550', autoreconnect=True, baud=57600)
        self.mavlink_connection.wait_heartbeat()
        while self.running:
            self.mavlink_connection.mav.heartbeat_send(mavutil.mavlink.MAV_TYPE_GCS,
                mavutil.mavlink.MAV_AUTOPILOT_GENERIC, 0, 0, 0)
            time.sleep(self.interval)

    def stop(self):
        self.running = False
1 Like