예제 #1
0
    use_wifi=True)  # address is None since it only works with WiFi anyway
print("trying to connect to mambo now")
success = mambo.connect(num_retries=3)
print("connected: %s" % success)

if (success):
    # get the state information
    print("sleeping")
    mambo.smart_sleep(1)
    mambo.ask_for_state_update()
    mambo.smart_sleep(1)
    mambo.safe_takeoff(5)

    while True:
        # take photo
        if mambo.take_picture():
            ls = mambo.groundcam.get_groundcam_pictures_names()
            print("picture taken %d" % ls.__len__())
            try:
                print(ls[-1])
                frame = mambo.groundcam.get_groundcam_picture(
                    ls[-1], True)  # get frame which is the first in the array

                if frame is not None:
                    if frame is not False:
                        cv2.imshow("Groundcam", frame)
                        cv2.waitKey(1)
            except:
                print("empty gallery")
        else:
            print("picture failed")
예제 #2
0
# 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(1)
    mambo.ask_for_state_update()
    mambo.smart_sleep(1)
    mambo.safe_takeoff(5)
    # take the photo
    pic_success = mambo.take_picture()
    # need to wait a bit for the photo to show up
    mambo.smart_sleep(0.5)
    picture_names = mambo.groundcam.get_groundcam_pictures_names(
    )  #get list of

    print(picture_names)
    frame = mambo.groundcam.get_groundcam_picture(picture_names[0],
                                                  True)  #get frame
    if frame is not None:
        if frame is not False:
            cv2.imshow("Groundcam", frame)
            cv2.waitKey(100)

    mambo.safe_land(5)
    mambo.disconnect()
예제 #3
0
def safe_land():

    print("landing")
    mambo.safe_land(5)
    mambo.smart_sleep(5)
    mambo.safe_emergency(5)

    print("disconnect")
    mambo.disconnect()


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)
    mambo.smart_sleep(2)

    mambo.take_picture()

    print("landing")
    mambo.safe_land(5)
    mambo.smart_sleep(5)

    print("disconnect")
    mambo.disconnect()