我一直在试用DroneKit Python,并且一直在使用所提供的一些示例。在掌握了一些使用DroneKit的知识之后,我已经开始编写一些python代码来执行单个任务。我唯一的问题是,我的任务的起始位置总是默认为Lat = -35.3632605, Lon = 149.1652287 -尽管我已经将主页位置设置为以下值:
start_location = LocationGlobal(51.945102, -2.074558, 10)
vehicle.home_location = start_location为了在模拟环境中设置无人机的开始位置,api中是否还有我遗漏的其他操作?
发布于 2018-08-18 04:32:48
通过使用以下命令启动DroneKit站点解决了此问题:
dronekit -sitl copter --home=51.945102,-2.074558,0,180现在开始在所需的位置模拟无人机,而不是在澳大利亚的默认位置!
发布于 2018-08-19 13:55:54
实际上,通过将参数添加到SITL启动代码中,您可以使用来自python脚本的自定义参数启动SITL,这里是一个简单的示例:
from dronekit_sitl import SITL
from dronekit import Vehicle, connect
sitl = SITL()
sitl.download('copter', '3.3', verbose=True)
sitl_args = ['-I0', '--model', 'quad', '--home=51.945102,-2.074558,0,180']
sitl.launch(sitl_args, await_ready=True, restart=True)
connection_string = 'tcp:127.0.0.1:5760'
print("Connecting to vehicle on: %s" % connection_string)
vehicle = connect(connection_string, wait_ready=True, baud=57600)https://stackoverflow.com/questions/51865923
复制相似问题