用于获取相对于起点或起飞位置的 x、y 和 z 位置的无人机套件功能?

Drone-kit function for getting x, y, and z position relative to a start point or take off location?

在飞行过程中,比如使用 pixhawk,我想参考其初始起始位置保存无人机的当前位置。理想情况下,这将是以米为单位的 x、y 和 z 位置。我知道您可以使用 dronekit 保存纬度、经度或 IMU/velocity 读数,然后计算位置。但是,如果能够只调用一个为您计算 x、y 和 z 的函数,那么就没有 post-processing。

以下满足我的目的(我相信您需要 GPS 但不是肯定的):

from dronekit import connect
vehicle = connect("Connection String", baud=57600)
metersNorth = vehicle.location.local_frame.north # used for the y position
metersEast = vehicle.location.local_frame.east # used for the x position
altitude = vehicle.location.local_frame.down # used for the z position

或者在我的情况下,我的测距仪面朝下

z = vehicle.rangefinder.distance