mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 17:51:20 +00:00
64 lines
1.8 KiB
Python
64 lines
1.8 KiB
Python
"""
|
|
Demo the direct flying for the python interface
|
|
|
|
Author: Amy McGovern
|
|
"""
|
|
|
|
from pyparrot.Minidrone import Mambo
|
|
|
|
# you will need to change this to the address of YOUR mambo
|
|
mamboAddr = "d0:3a:69:b9:e6:5a"
|
|
|
|
# make my mambo object
|
|
# remember to set True/False for the wifi depending on if you are using the wifi or the BLE to connect
|
|
mambo = Mambo(mamboAddr, use_wifi=False)
|
|
|
|
print("trying to connect")
|
|
success = mambo.connect(num_retries=3)
|
|
print("connected: %s" % success)
|
|
|
|
if (success):
|
|
# get the state information
|
|
print("sleeping")
|
|
mambo.smart_sleep(2)
|
|
mambo.ask_for_state_update()
|
|
mambo.smart_sleep(2)
|
|
|
|
print("taking off!")
|
|
mambo.safe_takeoff(5)
|
|
|
|
#print("Flying direct: going forward (positive pitch)")
|
|
#mambo.fly_direct(roll=0, pitch=50, yaw=0, vertical_movement=0, duration=1)
|
|
|
|
print("Showing turning (in place) using turn_degrees")
|
|
mambo.turn_degrees(90)
|
|
mambo.smart_sleep(2)
|
|
mambo.turn_degrees(-90)
|
|
mambo.smart_sleep(2)
|
|
mambo.turn_degrees(180)
|
|
mambo.smart_sleep(2)
|
|
mambo.turn_degrees(180)
|
|
mambo.smart_sleep(2)
|
|
|
|
#print("Flying direct: yaw")
|
|
#mambo.fly_direct(roll=0, pitch=0, yaw=50, vertical_movement=0, duration=1)
|
|
|
|
#print("Flying direct: going backwards (negative pitch)")
|
|
#mambo.fly_direct(roll=0, pitch=-50, yaw=0, vertical_movement=0, duration=0.5)
|
|
|
|
#print("Flying direct: roll")
|
|
#mambo.fly_direct(roll=50, pitch=0, yaw=0, vertical_movement=0, duration=1)
|
|
|
|
#print("Flying direct: going up")
|
|
#mambo.fly_direct(roll=0, pitch=0, yaw=0, vertical_movement=50, duration=1)
|
|
|
|
#print("Flying direct: going around in a circle (yes you can mix roll, pitch, yaw in one command!)")
|
|
#mambo.fly_direct(roll=25, pitch=0, yaw=50, vertical_movement=0, duration=3)
|
|
|
|
print("landing")
|
|
mambo.safe_land(5)
|
|
mambo.smart_sleep(5)
|
|
|
|
print("disconnect")
|
|
mambo.disconnect()
|