示例#1
0
def randomLocalLocation():
    dir = random.uniform(0, 2 * math.pi)
    return dronekit.LocationLocal(50 * math.cos(dir), 50 * math.sin(dir), -10)
示例#2
0
    time.sleep(0.2)
print 'Armed!'
time.sleep(2)

print 'running simple takeoff'
vehicle.simple_takeoff(1)

log = Logger()
log.write_line('N\tE\tD\tY\n')
n_time = 100
d_time = 0.1
loc = vehicle.location.local_frame
h_n = loc.north
h_e = loc.east
h_d = loc.down
home = dk.LocationLocal(h_n, h_e, h_d)
dest = dk.LocationLocal(h_n + 1, h_e - 0.3, h_d)
for i in range(n_time):
    time.sleep(d_time)
    yaw = vehicle.attitude.yaw
    loc = vehicle.location.local_frame
    N = loc.north
    E = loc.east
    D = vehicle.rangefinder.distance
    print("Coordinates: %.3f N, %.3f E, %.3f D Yaw: %3f\r" % (N, E, D, yaw))
    log.write_line('%s\t%s\t%s\t%s\n' % (N, E, D, yaw))

    if i > 3 / d_time:
        ang = 347
        r = 1
        vn = math.cos(ang * math.pi / 180) * r