Try to get the instrument panel to work with a fake drone sending mavlink data

Hi,

I’m running this script on my machine, that should emulate a drone.
The end goal is to be able to display the mavlink data into the instrument panel of QGC.
I’m able to see the data coming from mavlink in the mavlink inspector, but not in the intrument panel.
Is it because I’m streaming the wrong messages, the wrong heartbeat status, or is it because I don’t get the “Connected status”=

import time
from pymavlink import mavutil

# Create a connection to QGroundControl
master = mavutil.mavlink_connection('udpout:127.0.0.1:14550', source_system=1)
# Function to send fake heartbeat
def send_heartbeat():
    master.mav.heartbeat_send(
        mavutil.mavlink.MAV_TYPE_QUADROTOR,  # Type
        mavutil.mavlink.MAV_AUTOPILOT_PX4,   # Autopilot
        0,  # Base mode
        0,  # Custom mode
        mavutil.mavlink.MAV_STATE_STANDBY,   # System status
        1   # Component ID
    )

# Function to send fake GPS data
def send_gps():
    master.mav.gps_raw_int_send(
        int(time.time() * 1e6),  # Timestamp (converted to microseconds)
        3,  # Fix type 3: 3D fix
        int(37.7725 * 1e7),  # Latitude in 1E7 degrees
        int(-122.4058 * 1e7),  # Longitude
        500000,  # Altitude in mm
        500, 500,  # GPS HDOP and VDOP
        20000,  # Velocity in 100ths m/s
        100,  # Course over ground
        8   # Satellites visible
    )

while True:
    send_heartbeat()
    send_gps()
    time.sleep(1)

Thanks a lot in advance.
J

I’m not a developer, but recently build QGC from source and looked at various files.
I believe QGC uses firmware specific files for both Ardupilot based FC’s and PX4 based FC’s.
Those are then used to load specifics like flight-modes into the system and if no relevant associated file is found nothing is processed. That’s the reason why each FC firmware version has got it’s own sub-folder within a folder called “FirmwarePlugin”
See here:

Hey,
Thanks a lot for your reply.
I tried to mimic what was coming from PX4 gazebo simulator for heartbeat and sys_status, to see if it would change the "disconnected* status from qgc, but it still didn’t work

Do you maybe know if it is possible to see someting in the instrument panel without having the “connected” status ?
https://docs.qgroundcontrol.com/master/en/FlyView/FlyView.html#instrument_panel

I doubt it. Why should it show anything if QGC doesn’t know what and from where it is coming from?

In my case QGC sees the messages in mavlink inspector, that’s why I wondered if regardless of the connected status, it can display the information it has in the instrument panel.

Yeah, but Mavlink inspector is more of a diagnostic tool. In other words less restrictive

You’ll probably have more luck if you send firmware specific info along with it. I’ll have a look at my mavlink messages from my drone next time I boot the FC up. But almost certain there is initially a firmware specific message like “Arducopter 4.4.2”