Dronekit——Introduction
参考:http://python.dronekit.io/about/overview.html
关于Dronekit
DroneKit-Python允许开发人员创建在板载协同计算机上运行的应用程序,并使用低延迟链接与ArduPilot飞行控制器通信。板载应用程序可以显着增强自动驾驶,为vehicles行为增加更多智能,以及执行计算密集或时间敏感的任务(例如,计算机视觉,路径规划或3D建模)。DroneKit-Python还可用于地面站点应用程序,通过更高延迟的RF链路与vehicles进行通信。
API通过MAVLink与vehicles通信。它提供对连接vehicles遥测,状态和参数信息的编程访问,并实现任务管理和对vehicles运动和操作的直接控制。
API 功能
API features
The API provides classes and methods to:
- Connect to a vehicle (or multiple vehicles) from a script
- Get and set vehicle state/telemetry and parameter information.
- Receive asynchronous notification of state changes.
- Guide a UAV to specified position (GUIDED mode).
- Send arbitrary custom messages to control UAV movement and other hardware (GUIDED mode).
- Create and manage waypoint missions (AUTO mode).
- Override RC channel settings
Migrating to DKPY 2.0
移植到DKPY2.0
DroneKit-Python 2.0 has undergone a significant architectural evolution when compared to version 1.x (the library changed from a MAVProxy extension to a standalone Python module). The API itself remains similar, with the most important difference being that you now need to specify the vehicle target address inside the script.
与版本1.x相比,DroneKit-Python 2.0经历了重大的架构演变(该库从MAVProxy扩展更改为独立的Python模块)。API本身仍然类似,最重要的区别是您现在需要在脚本中指定vehicles目标地址。
Launching scripts
启动脚本
some_python_script.py
或者
python some_python_script.py
Connecting to a vehicle
You must specify the target vehicle address in your script
你必须在脚本中明确指出目标vehicle的地址
下面的代码片段显示了如何导入connect()方法并使用它返回连接Vehicle对象。
from dronekit import connect
# Connect to the Vehicle (in this case a UDP endpoint)
vehicle = connect('127.0.0.1:14550', wait_ready=True)
Note
The wait_ready=True
parameter ensures that connect()
won’t return untilVehicle.parameters
and most other default attributes have been populated with values from the vehicle. Check out Vehicle.wait_ready()
for more information (this method is used by the connect()
implementation).
connect()
also has arguments for setting the baud rate, returning your own custom vehicle classes and setting the length of the connection timeout.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)