Skip to content

Commit

Permalink
Merge pull request #116 from MichalKormanik/panorama-feature
Browse files Browse the repository at this point in the history
Panorama feature - New feature #112
  • Loading branch information
M4GNV5 committed Nov 20, 2021
2 parents c676c67 + 4927e3a commit e950ad4
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/panorama/panorama.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#Simply import of "panoramaModule.py" and you can use each function by calling it with name of the drone inside arguments.
from djitellopy import Tello
import cv2
import time
import panoramaModule


tello = Tello()
tello.connect()

print(tello.get_battery())

tello.takeoff()
tello.move_up(500)
panoramaModule.panorama_half_clockwise(tello)
tello.land()
88 changes: 88 additions & 0 deletions examples/panorama/panoramaModule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#Module with individual panorama types defined. You can just import it and use hovever you like
#
#It will save photos from Tello inside folder that's in. You can change this by changing path inside every function.
from djitellopy import Tello
import cv2
import time

global img


def panorama_full_clockwise(tello_name):
tello = tello_name
tello.streamoff()
tello.streamon()

for i in range(4):
img = tello.get_frame_read().frame
cv2.imwrite(f'Panorama-full-clockwise_{time.time()}.jpg', img)
time.sleep(1)
tello.rotate_clockwise(80)

img = tello.get_frame_read().frame
cv2.imwrite(f'Panorama-full-clockwise_{time.time()}.jpg', img)
time.sleep(1)
tello.rotate_clockwise(40)

tello.streamoff()


def panorama_half_clockwise(tello_name):
tello = tello_name
tello.streamoff()
tello.streamon()

tello.rotate_counter_clockwise(90)

for i in range(3):
img = tello.get_frame_read().frame
cv2.imwrite(f'Panorama-half-clockwise_{time.time()}.jpg', img)
time.sleep(1)
tello.rotate_clockwise(60)

img = tello.get_frame_read().frame
cv2.imwrite(f'Panorama-half-clockwise_{time.time()}.jpg', img)
time.sleep(1)
tello.rotate_counter_clockwise(90)

tello.streamoff()


def panorama_full_counter_clockwise(tello_name):
tello = tello_name
tello.streamoff()
tello.streamon()

for i in range(4):
img = tello.get_frame_read().frame
cv2.imwrite(f'Panorama-full-counter-clockwise_{time.time()}.jpg', img)
time.sleep(1)
tello.rotate_counter_clockwise(80)

img = tello.get_frame_read().frame
cv2.imwrite(f'/Panorama-full-counter-clockwise_{time.time()}.jpg', img)
time.sleep(1)
tello.rotate_counter_clockwise(40)

tello.streamoff()


def panorama_half_counter_clockwise(tello_name):
tello = tello_name
tello.streamoff()
tello.streamon()

tello.rotate_clockwise(90)

for i in range(3):
img = tello.get_frame_read().frame
cv2.imwrite(f'Panorama-half-counter-clockwise_{time.time()}.jpg', img)
time.sleep(1)
tello.rotate_counter_clockwise(60)

img = tello.get_frame_read().frame
cv2.imwrite(f'Panorama_half_counter_clockwise-{time.time()}.jpg', img)
time.sleep(1)
tello.rotate_clockwise(90)

tello.streamoff()

0 comments on commit e950ad4

Please sign in to comment.