예제 #1
0
def start_tello():
    '''
    Connects to drone and sets velocities and speed to 0
    Cycles drone stream
    '''
    #makes drone and connects to it
    drone = Tello()
    drone.connect()

    #sets all drones velocity to 0
    drone.forward_backward_velocity = 0
    drone.left_right_velocity = 0
    drone.up_down_velocity = 0
    drone.yaw_velocity = 0
    drone.speed = 0

    #cycles drone stream off and on
    drone.streamoff()
    drone.streamon()

    #prints drone's battery at start
    time.sleep(5)
    print(drone.get_battery())

    return drone
예제 #2
0
def new_drone() -> Tello:
    drone = Tello()
    drone.connect()
    drone.for_back_velocity = 0
    drone.left_right_velocity = 0
    drone.up_down_velocity = 0
    drone.yaw_velocity = 0
    drone.speed = 0
    drone.streamoff()
    drone.streamon()
    return drone
예제 #3
0
def initializeTello():
    myDrone = Tello()
    myDrone.connect()
    myDrone.for_back_velocity = 0
    myDrone.up_down_velocity = 0
    myDrone.speed = 0
    myDrone.left_right_velocity = 0
    myDrone.yaw_velocity = 0
    myDrone.streamoff()
    myDrone.stream_on
    return myDrone
 def initialize(self):
     myDrone = Tello()
     myDrone.connect()
     myDrone.for_back_velocity = 0
     myDrone.left_right_velocity = 0
     myDrone.up_down_velocity = 0
     myDrone.yaw_velocity = 0
     myDrone.speed = 0
     print(myDrone.get_battery())
     myDrone.streamoff()
     myDrone.streamon()
     return myDrone
예제 #5
0
def initializeTello():
    tccdrone = Tello()
    tccdrone.connect()
    tccdrone.for_back_velocity = 0
    tccdrone.left_right_velocity = 0
    tccdrone.up_down_velocity = 0
    tccdrone.yaw_velocity = 0
    tccdrone.speed = 0
    print(tccdrone.get_battery())
    tccdrone.streamoff()
    tccdrone.streamon()
    return tccdrone
예제 #6
0
def initializeTello():
    JwTello = Tello()
    JwTello.connect()
    JwTello.for_back_velocity = 0
    JwTello.left_right_velocity = 0
    JwTello.up_down_velocity = 0
    JwTello.yaw_velocity = 0
    JwTello.speed = 0
    print(JwTello.get_battery())
    JwTello.streamoff()
    JwTello.streamon()
    return JwTello
예제 #7
0
def initializeDrone():
    drone = Tello()
    drone.connect()
    drone.for_back_velocity = 0
    drone.left_right_velocity = 0
    drone.up_down_velocity = 0
    drone.yaw_velocity = 0
    drone.speed = 0
    print(drone.get_battery())
    drone.streamoff()
    drone.streamon()
    return drone
예제 #8
0
def intializeTello():
    # CONNECT TO TELLO
    myDrone = Tello()
    myDrone.connect()
    myDrone.for_back_velocity = 0
    myDrone.left_right_velocity = 0
    myDrone.up_down_velocity = 0
    myDrone.yaw_velocity = 0
    myDrone.speed = 0
    # print(myDrone.get_battery())
    myDrone.streamoff()
    myDrone.streamon()
    return myDrone
예제 #9
0
def initTello():
    tello = Tello()
    tello.connect()
    tello.for_back_velocity = 0
    tello.left_right_velocity = 0
    tello.up_down_velocity = 0
    tello.yaw_velocity = 0
    tello.speed = 0
    print(tello.get_battery())
    # tello.streamoff()
    tello.streamon()
    tello.takeoff()
    return tello
예제 #10
0
def initializeTello():

    drone = Tello()
    connection = drone.connect()

    if connection:
        drone.for_back_velocity = 0
        drone.left_right_velocity = 0
        drone.up_down_velocity = 0
        drone.yaw_velocity = 0
        drone.speed = 0

        drone.streamoff()
        drone.streamon()
        print(f"\n\n\n\n\nBATTERY: {drone.get_battery()}")

    return connection, drone
예제 #11
0
def initializeTello():
    # METHOD: CONNECT TO TELLO

    myDrone = Tello()  # Create a Tello object
    myDrone.connect()  # Connect PC to Tello ()
    # Set all velocity and speed of drone to 0
    myDrone.for_back_velocity = 0
    myDrone.left_right_velocity = 0
    myDrone.up_down_velocity = 0
    myDrone.yaw_velocity = 0
    myDrone.speed = 0

    print(myDrone.get_battery())  # Print out percentage of battery
    myDrone.streamoff()  # Turn off video stream of drone
    myDrone.streamon()  # Turn on video stream of drone
    print("battery: ", myDrone.get_battery())
    return myDrone
예제 #12
0
def main():
    # CONNECT TO TELLO
    me = Tello()
    me.connect()
    me.for_back_velocity = 0
    me.left_right_velocity = 0
    me.up_down_velocity = 0
    me.yaw_velocity = 0
    me.speed = 0

    print(me.get_battery())

    me.streamoff()
    me.streamon()
    ########################

    me.takeoff()
    flyCurve(me, 160, 50)
    time.sleep(5)
    me.land()
예제 #13
0
def initTello():
    myDrone = Tello()
    myDrone.connect()

    #set velicties to 0
    myDrone.for_back_velocity = 0
    myDrone.left_right_velocity = 0
    myDrone.up_down_velocity = 0
    myDrone.yaw_velocity = 0
    myDrone.speed = 0

    # get battery status
    print(myDrone.get_battery())

    # turn off stream
    myDrone.streamoff()

    # stream on
    myDrone.streamon()
    return myDrone
예제 #14
0
    def __init__(self):
        self.width = 640
        self.height = 480

        me = Tello()
        me.connect()
        me.forward_backward_velocity = 0
        me.left_right_velocity = 0
        me.up_down_velocity = 0
        me.yaw_velocity = 0
        me.speed = 0

        battery = me.get_battery()
        if battery <= 15:
            print("[ERROR] - battery under 15% ")
            sys.exit(0)

        me.streamoff()
        me.streamon()

        self.me = me
        self.takeoff = False
        self.frame = None
예제 #15
0
def test_tello():
    drone.move_left(20)
    time.sleep(3)
    drone.rotate_clockwise(90)
    time.sleep(3)
    drone.move_forward(10)


#----------------------------------------------------------------------------------------------

if tello_drone:
    # init Tello
    drone = Tello()
    drone.connect()
    drone.for_back_velocity = 0
    drone.left_right_velocity = 0
    drone.up_down_velocity = 0
    drone.yaw_velocity = 0
    drone.speed = 0
    print(drone.get_battery())
    drone.streamoff()
    drone.streamon()

else:
    cap = cv2.VideoCapture(0)

width = 640
height = 480

fileOut = cv2.VideoWriter('detectionTello.avi',
                          cv2.VideoWriter_fourcc(*'XVID'), 20, (width, height))
예제 #16
0
from djitellopy import Tello
import cv2
import time

######################################################################
width = 320  # WIDTH OF THE IMAGE
height = 240  # HEIGHT OF THE IMAGE
startCounter = 0  #  0 FOR FIGHT 1 FOR TESTING
######################################################################

# CONNECT TO TELLO
tello = Tello()
tello.connect()

tello.for_back_velocity = 0
tello.left_right_velocity = 0
tello.up_down_velocity = 0
tello.yaw_velocity = 0
tello.speed = 0

while True:
    tello.streamon()

    # GET THE IMGAE FROM TELLO
    frame_read = tello.get_frame_read()
    myFrame = frame_read.frame
    img = cv2.resize(myFrame, (width, height))

    # TO GO UP IN THE BEGINNING
    if startCounter == 0:
        tello.takeoff()
from djitellopy import Tello
import cv2
import numpy as np

width = 640  # 이미지의 초기 폭
height = 480  # 이미지의 초기 높이
deadZone = 100 # 경계값

startCounter =0    # 비행 모드 / 검사 모드 전환 변수, startCounter = 0 : Flight Mode

# 텔로 연결, 초기 속도값 설정(전/후/좌/우, 상하, Yaw 속도 = 0)
me = Tello()
me.connect()
me.for_back_velocity = 0
me.left_right_velocity = 0
me.up_down_velocity = 0
me.yaw_velocity = 0
me.speed = 0

print(me.get_battery())  # 텔로 잔여 배터리 값 출력

me.streamoff()           # 텔로 카메라 off/on
me.streamon()

#################################################################

frameWidth = width
frameHeight = height

# 전역변수로 imgContour, dir(direction) 설정
global imgContour
예제 #18
0
from djitellopy import Tello
import cv2
import numpy as np

width = 640
height = 480
deadZone = 100

startCounter = 0

me = Tello()
me.connect()
me.for_back_velocity = 0
me.left_right_velocity = 0
me.up_down_velocity = 0
me.yaw_velocity = 0
me.speed = 0

print(me.get_battery())

me.streamoff()
me.streamon()

frameWidth = width
frameHeight = height
# cap = cv2.VideoCapture(1)
# cap.set(3, frameWidth)
# cap.set(4, frameHeight)
# cap.set(10,200)

global imgContour
예제 #19
0
import cv2
import numpy as np


width = 480  # width of the image
height = 360  # height of the image
deadZone = 100


startCounter = 0        # startCounter = 1, Inspection Mode, startCounter = 0, Flight Mode

# CONNECT TO TELLO                        # Tello Connect, Initial velocity settings
us = Tello()
us.connect()
us.for_back_velocity = 0
us.left_right_velocity = 0
us.up_down_velocity = 0
us.yaw_velocity = 0
us.speed = 0


print(us.get_battery())

us.streamoff()
us.streamon()
########################

frameWidth = width
frameHeight = height
# cap = cv2.VideoCapture(1)
# cap.set(3, frameWidth)