我正在使用带有PX4的英特尔Aero RTF无人机,我想测试这款无人机的简单起飞,但是我所遵循的脚本没有给我结果它只是武装了dron和disarms但从未起飞 这是脚本:
#! /usr/bin/python
from dronekit import connect, VehicleMode, LocationGlobalRelative
import time
vehicle = connect('tcp:127.0.0.1:5760', wait_ready=False)
def arm_and_takeoff(aTarget):
### I commented this lines because the code doesn't pass from
this loop ###
#print 'Pre arm-checks'
#while not vehicle.is_armable:
# print "Initializing...'
# time.sleep(1)
print 'Arming motors'
vehicle.mode = VehicleMode("GUIDED")
vehicle.armed = True
while not vehicle.armed:
print "waiting for arming"
time.sleep(1)
print "Take Off!"
vehicle.simpe_takeoff(aTarget)
while True:
print "Altitude: ",vehicle.location.global_relative_frame.alt
if vehicle.location.global_relative_frame.alt >= aTarget * 0.95:
print "Altitude target reached"
break
time.sleep(1)
arm_and_takeoff(10)
print "Take off complete!"
time.sleep(10)
print "Landing"
vehicle.mode = VehicleMode("LAND")
正如我所说的只是武器几秒钟和解除武装,我做错了什么? 此致
答案 0 :(得分:0)
Dronekit不正式支持PX4飞行堆栈,您应该使用Dronecode SDK for PX4(https://sdk.dronecode.org/en/)或将fligh stack更改为ArduPilot,但是对PX4的支持有限,您也可以在这里阅读有关内容{ {3}}。