Beispiel #1
0
def data_collection(data_file='data.csv'):
    tello = Tello()
    tello.connect()
    #tello.takeoff()

    start = time.time()
    posx = []
    posy = []
    posz = []
    pitch = []
    roll = []
    yaw = []
    while time.time() - start < 10:
        state = tello.get_current_state()
        print(state)
        posx.append(float(state['agx']))
        posy.append(float(state['agy']))
        posz.append(float(state['agz']))
        pitch.append(float(state['pitch']))
        roll.append(float(state['roll']))
        yaw.append(float(state['yaw']))

    #tello.land()
    d = {
        'x': posx,
        'y': posy,
        'z': posz,
        'pitch': pitch,
        'roll': roll,
        'yaw': yaw
    }
    df = pd.DataFrame(data=d)
    df.dropna(inplace=True)
    df.to_csv('data.csv')
from djitellopy import Tello
import sys, time

if len(sys.argv) > 1:
    tello = Tello(sys.argv[1])
else:
    tello = Tello()

tello.connect()

speed = tello.query_speed()
snr = tello.query_wifi_signal_noise_ratio()
sdk = tello.query_sdk_version()
serial = tello.query_serial_number()

print("Speed = ", speed)
print("Battery = ", tello.get_battery())
print("Duration = ", tello.get_flight_time())
print("Height = ", tello.get_height())
print("Distance = ", tello.get_distance_tof())
print("Barometer = ", tello.get_barometer())
print("Attitude = ", tello.get_pitch(), tello.get_roll(), tello.get_yaw())
print("WiFi SNR = ", snr)
print("SDK Version = ", sdk)
print("Serial Number = ", serial)

print(tello.get_current_state())
Beispiel #3
0
tello.connect()

print("Test 1 - Take off - Rotate - Land")
tello.takeoff()
tello.rotate_clockwise(360)
tello.land()

print("Test 2 - Take off - forward - back - left - right - Land")
tello.takeoff()
tello.move_forward(30)
tello.move_back(30)
tello.move_left(30)
tello.move_right(30)
tello.land()

print("Test 3 - Take off - Ascend - Descend - Land")
tello.takeoff()
tello.move_up(50)
tello.move_down(50)
tello.land()

print("Test 4 - Telemetry")
tello.takeoff()
tello.get_battery()
tello.get_current_state()
tello.get_height()
tello.get_pitch()
tello.get_roll()
tello.get_yaw()
tello.land