在飞行过程中,比如说使用pixhawk,我想根据无人机的初始起始位置保存无人机的当前位置。理想情况下,这将是以米为单位的x、y和z位置。我知道你可以使用dronekit保存lat、lon或IMU/速度读数,然后计算位置。然而,如果能够只调用一个为您计算x、y和z的函数,那么就没有后处理了,那将是非常棒的。
以下内容符合我的要求(我认为您需要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