Exemplo n.º 1
0
def launchMambo():
    mambo = Mambo(mamboAddr, use_wifi=False)
    print("Connecting to mambo...")
    success = mambo.connect(num_retries=3)
    print("Connected: %s" % success)

    if (success):
        print("Initial Sleeping")
        mambo.smart_sleep(2)
        mambo.ask_for_state_update()
        mambo.smart_sleep(2)

        print("***Mission Started!*** \n")

        print("0. Close Claw")
        mambo.close_claw()
        mambo.smart_sleep(2)

        print("1. Taking off")
        mambo.safe_takeoff(2)
        mambo.smart_sleep(2)

        print("2. Rotating -45 degress anti-clock in-place")
        mambo.turn_degrees(-45)
        mambo.smart_sleep(2)

        print("3. Moving Forward 50")
        mambo.fly_direct(roll=0,
                         pitch=100,
                         yaw=0,
                         vertical_movement=30,
                         duration=1)
        mambo.smart_sleep(2)

        print("4. Open Claw")
        mambo.open_claw()
        mambo.smart_sleep(3)

        print("5. Close Claw")
        mambo.close_claw()
        mambo.smart_sleep(3)

        print("6. Rotating 180 degress anti-clock in-place")
        mambo.turn_degrees(180)
        mambo.smart_sleep(2)

        print("7. Moving Forward 50")
        mambo.fly_direct(roll=0,
                         pitch=100,
                         yaw=0,
                         vertical_movement=-30,
                         duration=1)
        mambo.smart_sleep(2)

        print("8. Rotating -135 degress anti-clock in-place")
        mambo.turn_degrees(-135)
        mambo.smart_sleep(2)

        print("9. Landing")
        mambo.safe_land(5)
        mambo.smart_sleep(3)

        print("***Mission Completed!***\n")

        print("Disconnecting mambo...")
        mambo.disconnect()
Exemplo n.º 2
0
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)

    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")