-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from MichalKormanik/panorama-feature
Panorama feature - New feature #112
- Loading branch information
Showing
2 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |