Files
Sim-Tello-KI-fun/example_exercises/8_rotate.py
Andrew Johnson 26b19a909f First Version (#1)
Co-authored-by: Anujith Muraleedharan <140189296+AnujithM@users.noreply.github.com>
2025-03-22 16:06:45 +01:00

48 lines
739 B
Python
Executable File

from tello_sim.tello_sim_client import TelloSimClient
import time
ROTATION_DEGREES = 180
# Create a Tello instance
tello = TelloSimClient()
# Connect to Tello
tello.connect()
print("Starting flying in ...")
for i in range(3, 0, -1):
print(i)
time.sleep(1)
def pause():
print("Hovering for...")
for i in range(3, 0, -1):
print(i)
time.sleep(1)
# Takeoff
print("Take off")
tello.takeoff()
pause()
print(f"Rotating clockwise {ROTATION_DEGREES} degrees")
tello.rotate_clockwise(ROTATION_DEGREES)
pause()
print(f"Rotating counter clockwise {ROTATION_DEGREES} degrees")
tello.rotate_counter_clockwise(ROTATION_DEGREES)
pause()
print("Landing")
# Land
tello.land()
# End the connection
tello.end()