index = label.index('laptop') output_image = addLaser(output_image,index) if 'dog' in label: log.append('{}: Dog identified...woof'.format(datetime.now())) else: output_image = img mpID, x, y, z = missionPadXYZ() if mpID == -1: mp_str = "404: Mission Pad Not Found" else: mp_str = "Mission Pad:{} at X:{} Y:{} Z:{}".format(mpID, x, y, z) bat_str = "Battery: {}%".format(tello.get_battery()) temp_str = "Temperature: {} F".format(round(tello.get_temperature()*(9/5)+32),1) alt_str = "Altitude: {}cm".format(tello.get_distance_tof()) textOnFrame(output_image, [bat_str, temp_str, alt_str, mp_str]) movie.write(output_image) cv2.imshow('Drone TV', output_image) if cv2.waitKey(1) & 0xFF == ord('q'): tello.streamoff() cv2.destroyAllWindows() break if flyMission == True and inFlight == False: tello.takeoff() inFlight = True if flyMission == True and inFlight == True: t2 = datetime.now()
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())
# yaw in degree drone.get_speed_x() drone.get_speed_y() drone.get_speed_z() # get speed in int drone.get_acceleration_x() drone.get_acceleration_y() drone.get_acceleration_z() # get acceleration in int drone.get_height() # get height in cm drone.get_distance_tof() # current distance from tof in cm drone.get_barometer() # barometer measurement in cm drone.get_flight_time() # flight time in s drone.get_battery() # get battery percentage ############################## ####### control functions : ##############################