Currently I am testing uwb system with ArduCopter, using sky viper fly indoor, I am inputing the pos value with mavlink (GPS_INPUT), params change with GPS_TYPE to 14(MAV), the uwb pos error is ±15cm and fresh rate is 5Hz, below is the mavlink input code with DroneKit
fix_type = 4
sat_visible = 20
epoch = 315964782
cur = datetime.datetime.utcnow()
ts = cur - datetime.datetime(1970,1,1)
epoch_sec = ts.total_seconds() - epoch
time_week = epoch_sec / 604800.0
time_week_ms = (epoch_sec % 604800) * 1000.0 + ts.microseconds*0.001
time_us = current
# ignore_flags = mavutil.mavlink.GPS_INPUT_IGNORE_FLAG_VEL_HORIZ
ignore_flags = 0
res = get_location_metres(22.9514009, 113.8685862, pos[1], pos[0])
lat, lon = res[0], res[1]
alt_amsl = pos[2]
hdop = np.linalg.norm(np.array([eop[1], eop[0]]))
vdop = 2.0
vn = vel[1]
ve = vel[0]
vd = vel[2]
spd_acc = 0.1
hor_acc = 0.1
vert_acc = 0.02
print(lat, lon, alt_amsl, vn, ve, vd)
msg = vehicle.message_factory.gps_input_encode(
time_us, # time_boot_ms (not used)
0, # gps_id
ignore_flags, # gps_flag
int(time_week_ms),
int(time_week),
fix_type,
int(lat*1e7),
int(lon*1e7),
alt_amsl,
hdop,
vdop,
vn,
ve,
vd,
spd_acc,
hor_acc,
vert_acc,
sat_visible) # Satellites visible
vehicle.send_mavlink(msg)
The problem is when I take off the drone in ALT_HOLD, the switch to loiter mode, the drone just fly away in one direction, which value should I look after in data flash log to figure out what’s wrong
dataflash log is here https://drive.google.com/open?id=1-TVg_3DwVpq1Z2DHzt9YvCD3P_PxmC4k
params is here https://drive.google.com/open?id=1myIlEHI8MG23_qE1BoSvtzp3GO44jJl4