from dronekit import connect, VehicleMode
# 连接到SITL模拟器
vehicle = connect('127.0.0.1:14550', wait_ready=True)
# 获取一些基本信息
print("Get some vehicle attribute values:")
print(" GPS: %s" % vehicle.gps_0)
print(" Battery: %s" % vehicle.battery)
print(" Last Heartbeat: %s" % vehicle.last_heartbeat)
print(" Is Armable?: %s" % vehicle.is_armable)
print(" System status: %s" % vehicle.system_status.state)
print(" Mode: %s" % vehicle.mode.name)
# 关闭连接
vehicle.close()