我正在尝试构建我的第一个doing python程序,我正在用一些例子进行一些测试,但是我无法连接到我的UAV(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")发布于 2016-02-19 00:00:25
现在获得dk支持的最佳位置可能在这里:https://discuss.dronekit.io/c/python
作为回答,我还没有在Linux上尝试过这个。我怀疑连接字符串是正确的,但是您可能还必须使用baud=57600设置波特率。
https://stackoverflow.com/questions/35469440
复制相似问题