大疆OSDK开发-在模拟器中画个一箭穿心

大疆OSDK开发-在模拟器中画个一箭穿心

使用OSDK中的自主航线飞行的例子,在模拟器中画一个心形轨迹。

首先计算心形坐标,如下是python程序:

from math import *
import matplotlib.pyplot as plt
xs = []
ys = []
n = 30
increment = 0.00001
# 天安门中心GPS点
longitude,latitude = 116.353349,40.036001
for i in range(n):
    t = i*(2*pi/n)
    x = latitude + (increment * (20 * sin(t) * sin(t) * sin(t)+20));
    y = longitude + (increment * (12 * cos(t) - 5 * cos(2 * t) - 2 * cos(3 * t) - cos(4 * t)+15.5));
    xs.append(x)
    ys.append(y)
plt.plot(xs,ys)

提供一个GPS坐标的例子,如下: 

// 生成的GPS爱心例子
116.353544 40.036201 520
116.35355282879326 40.03620279749101 520
116.35357503386933 40.036214457670646 520
116.35359990169943 40.03624161496203 520
116.35361548391181 40.0362830824612 520
116.353614 40.036330903810565 520
116.35359462305898 40.03637304774006 520
116.35356249568093 40.03639773111012 520
116.35352504816997 40.03639773111012 520
116.35348809830056 40.03637304774006 520
116.353454 40.036330903810565 520
116.35342253188651 40.0362830824612 520
116.353393376941 40.03624161496203 520
116.35336814363927 40.036214457670646 520
116.35335043404885 40.03620279749101 520
116.35334399999999 40.036201 520
116.35335043404885 40.03619920250899 520
116.35336814363927 40.03618754232935 520
116.353393376941 40.03616038503797 520
116.35342253188651 40.03611891753879 520
116.353454 40.03607109618943 520
116.35348809830056 40.03602895225994 520
116.35352504816997 40.036004268889876 520
116.35356249568093 40.036004268889876 520
116.35359462305898 40.03602895225994 520
116.353614 40.03607109618943 520
116.35361548391181 40.03611891753879 520
116.35359990169943 40.03616038503797 520
116.35357503386933 40.03618754232935 520
116.35355282879326 40.03619920250899 520

效果图如下:

 

猜你喜欢

转载自blog.csdn.net/Challovactor/article/details/113173049