ardupilot之mavlink消息--飞控接收--单向( 二 )

< 0:delay_time = 0.1elif delay_time > 60:delay_time = 60print(delay_time)time.sleep(0.1)if __name__ == '__main__':is_fly_land_reset()prearm_check()vehicle.mode = "GUIDED"vehicle.wait_for_mode("GUIDED")while vehicle.armed == False:vehicle.arm(True)print("vehicle armed...")# vehicle.simple_takeoff(alt=12)vehicle.wait_simple_takeoff(alt= 12,epsilon=2)while vehicle.location.local_frame.down > -8:print(vehicle.location.local_frame.down)time.sleep(0.5)print("Begin to navigation...")while True:lat = 39.1036 + random.random() * 32 * 1e-4lon = 117.16 + random.random() * 66 * 1e-4alt = 30location_send = dronekit.LocationGlobalRelative(lat, lon, alt)# vehicle.simple_goto(location=location_send)# goto(-100, -130, goto_position_target_global_int)goto_position_target_global_int(location_send)# goto_position_target_local_ned(vehicle,5,2,-20)# master.mav.set_position_target_global_int_send(#0,#master.target_system,#master.target_component,#6,#lat*1e7,#lon*1e7,#alt,#0,0,0,#0,0,0,#0,0,0, force_mavlink1=True)print("target lat=%f,\t lon=%f,\t current lat=%f,\t lon=%f"%(lat, lon, vehicle.location.global_frame.lat, vehicle.location.global_frame.lon))random_time = random.random()*9.9+0.1time.sleep(random_time)