olympe code

Hi, everyone. Can anybody help me?
I’m new to olympe and i’m having problems with the
I copied the code available on the parrot website, but it’s giving some problem with the first assert, so it just takes off and doesn’t do anything else.

# -*- coding: UTF-8 -*-

import olympe
from olympe.messages.ardrone3.Piloting import TakeOff, moveBy, Landing
from olympe.messages.ardrone3.PilotingState import FlyingStateChanged


if __name__ == "__main__":
    drone = olympe.Drone(DRONE_IP)
    assert drone(TakeOff() >> FlyingStateChanged(state="hovering", _timeout=5)).wait().success()
    assert drone(moveBy(10, 0, 0, 0) >> FlyingStateChanged(state="hovering", _timeout=5)).wait().success()
    assert drone(Landing()).wait().success()

Traceback (most recent call last):
  File "./", line 12, in <module>
    assert drone(TakeOff() >> FlyingStateChanged(state="hovering", _timeout=5)).wait().success()

Are you using a physical drone or the simulator ?

1 Like

dont put assert in front of your commands… it should works


No, i used virtual drone with de sphinx and olympe.

I will try this. Thanks.

This works, but i have a question. Why with the assert it doesn’t work, since the code I put comes from the parrot site of the topic moveby?


Have you tried increasing the FlyingStateChanged timeout value?
Sphinx and olympe are not running in the same clock which could lead to real time issues.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.