我正在使用英特尔航空RTF无人机和PX4,我想测试这架无人机的简单起飞,但我遵循的脚本没有给我结果,它只是武装无人机和解除武装,但从来没有起飞这是脚本:
#! /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") 正如我所说的,它只是武装了几秒钟和解除武装,我做错了什么??问候
发布于 2018-08-13 18:01:43
Dronekit并不正式支持PX4飞行堆栈,你应该使用Dronecode SDK for PX4 (https://sdk.dronecode.org/en/)或者将你的飞行堆栈改为ArduPilot,但是对PX4的支持也是有限的,你可以在这里https://dev.px4.io/en/robotics/dronekit.html上了解到。
https://stackoverflow.com/questions/50885030
复制相似问题