Detect if drone in upside down in Python?



  • (Sorry for re-posting. I posted in the wrong category first.)

    Hi,

    I try to code an easy trigger to disconnect the drone in Python. I thought using drone.isUpsideDown() as the trigger. However, the program below has the output:
    Drone right way up
    Drone upside down

    Shouldn't in print "Drone right way up" repeatedly until I turn the drone upside down?

    from CoDrone.codrone import *
    
    drone = CoDrone()
    drone.connect("3487","COM16")
    
    while(drone.isConnected()):
        print("Drone right way up")
        if drone.isUpsideDown():
            print("Drone upside down")
            drone.disconnect()
        sleep(1)
    

Log in to reply
 

Looks like your connection to Robolink community was lost, please wait while we try to reconnect.