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