Thank you for your explanation ! @EliotBR
I have another question, that is, when I switch to GUIDED mode in QGC, there will be an error in MAV_COM(176). I have sent location information to my rov through the GPS_INPUT message, and my robot also displays location in the QGC and GLOBAL_POSITION_INT message. EK3_SRC1_POSXY, EK3_SRC1_YVELXY has been set to GPS. Do I need to set other parameters? Or is it because my location information is missing some key factors?
Here is the sending location code:
def send_gps_input(master, lat, lon, hdop, fix_quality, numsats):
try:
time_usec = int(time.time() * 1e6)
lat_int = int(lat * 1e7)
lon_int = int(lon * 1e7)
# GPS_INPUT_IGNORE_FLAGS
ignore_flags = (mavutil.mavlink.GPS_INPUT_IGNORE_FLAG_VEL_HORIZ |
mavutil.mavlink.GPS_INPUT_IGNORE_FLAG_VEL_VERT |
mavutil.mavlink.GPS_INPUT_IGNORE_FLAG_SPEED_ACCURACY)
master.mav.gps_input_send(
time_usec, # Timestamp (micros since boot or Unix epoch)
0, # ID of the GPS for multiple GPS inputs
# Flags indicating which fields to ignore (see GPS_INPUT_IGNORE_FLAGS enum).
# All other fields must be provided.
ignore_flags,
0, # GPS time (milliseconds from start of GPS week)
0, # GPS week number
fix_quality, # 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK
lat_int, # Latitude (WGS84), in degrees * 1E7
lon_int, # Longitude (WGS84), in degrees * 1E7
0, # Altitude (AMSL, not WGS84), in m (positive for up)
int(hdop * 100), # GPS HDOP horizontal dilution of position in m
1, # GPS VDOP vertical dilution of position in m
0, # GPS velocity in m/s in NORTH direction in earth-fixed NED frame
0, # GPS velocity in m/s in EAST direction in earth-fixed NED frame
0, # GPS velocity in m/s in DOWN direction in earth-fixed NED frame
0, # GPS speed accuracy in m/s
0, # GPS horizontal accuracy in m
0, # GPS vertical accuracy in m
numsats # Number of satellites visible.
)
print(f"GPS_INPUT sent: lat={lat}, lon={lon}, hdop={hdop}, numsats={numsats}")
except Exception as e:
print(f"Failed to send GPS_INPUT: {e}")