0

我正在尝试构建我的第一个dronekit python 程序,并且正在使用一些示例进行一些测试,但我无法连接到我的无人机(Iris+)。我插入了 USB 收音机(3DR 915 MHz),然后放了vehicle = connect('/dev/ttyUSB0', wait_ready=True). 实际上我不知道我应该输入哪个字符串。在此先感谢各位,我需要一些帮助!

我的代码:

print "Start simulator (SITL)"
from dronekit_sitl import SITL
sitl = SITL()
sitl.download('copter', '3.3', verbose=True)
sitl_args = ['-I0', '--model', 'quad', '--home=-35.363261,149.165230,584,353']
sitl.launch(sitl_args, await_ready=True, restart=True)

# Import DroneKit-Python
from dronekit import connect, VehicleMode
import time

# Connect to the Vehicle.
print "Connecting to vehicle on: '/dev/ttyUSB0'"
vehicle = connect('/dev/ttyUSB0', wait_ready=True)

# Get some vehicle attributes (state)
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    # settable

# Close vehicle object before exiting script
vehicle.close()

# Shut down simulator
sitl.stop()
print("Completed")
4

1 回答 1

0

现在获得 dk 支持的最佳地点可能在这里:https ://discuss.dronekit.io/c/python

作为回答,我没有在 Linux 上尝试过这个。我怀疑连接字符串是正确的,但您可能还必须使用 baud=57600 设置波特率

于 2016-02-19T00:00:25.733 回答