amymcgovern / pyparrot

Python interface for Parrot Drones
MIT License
275 stars 129 forks source link

Mambo parrot doesn t fly #227

Closed magdaa07 closed 8 months ago

magdaa07 commented 8 months ago

Hello I tried to make a mambo parrot drone fly with this code and it doesn't work, I get the following error: image

The drone doesn t take off

from pyparrot.Minidrone import Mambo

mambo = Mambo(use_wifi=True)
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)

    if (mambo.sensors.flying_state != "emergency"):
        print("flying state is %s" % mambo.sensors.flying_state)
        print("Flying direct: going up")
        mambo.fly_direct(roll=0, pitch=0, yaw=0, vertical_movement=20, duration=10)

        # print("flip left")
        # print("flying state is %s" % mambo.sensors.flying_state)
        # success = mambo.flip(direction="left")
        # print("mambo flip result %s" % success)
        # mambo.smart_sleep(5)
        #
        # print("flip right")
        # print("flying state is %s" % mambo.sensors.flying_state)
        # success = mambo.flip(direction="right")
        # print("mambo flip result %s" % success)
        # mambo.smart_sleep(5)
        #
        # print("flip front")
        # print("flying state is %s" % mambo.sensors.flying_state)
        # success = mambo.flip(direction="front")
        # print("mambo flip result %s" % success)
        # mambo.smart_sleep(5)
        #
        # print("flip back")
        # print("flying state is %s" % mambo.sensors.flying_state)
        # success = mambo.flip(direction="back")
        # print("mambo flip result %s" % success)
        # mambo.smart_sleep(5)

        print("landing")
        print("flying state is %s" % mambo.sensors.flying_state)
        mambo.safe_land(5)
        mambo.smart_sleep(5)

    print("end")
    mambo.disconnect()
`