After moveByEnd event. Drone still in flying state

When I try to run the following script for a simulated ANAFI drone:
flyingAction = drone(
>> FlyingStateChanged(state=“hovering”, _timeout=5)
>> moveBy(5, 0, 0, 0)
>> FlyingStateChanged(state=“hovering”, _timeout=5)

the flyingAction.success() returns false and .timedout is true even though the drone reached the target position.
When I checked the FlyingState with drone.get_state(FlyingStateChanged)[‘state’] I got the state “flying” instead of “hovering”.

I checked the event messages from the drone and I found moveByEnd was received.
Info _recv_cmd_cb ardrone3.PilotingEvent.moveByEnd(dX=4.900875568389893, dY=-0.008952170610427856, dZ=-0.0010880827903747559, dPsi=6.517730799515675e-10, error=MoveByEnd_Error.ok)*

Can you help find why it doesn’t change to hovering.
I tried this code in order to troubleshoot the example in the documentation which results in RuntimeError “Cannot complete the flying action”.


Thanks for reporting this issue.

This is related to a recent change in the ANAFI firmware.

After a successful moveBy command when the drone send a moveByEnd event, the drone flying state used to go back to “hovering”.

Instead of that, the drone now end up in the “flying” state. I am currently investigating this issue and will get back to you when I’ll have more information.

In the meantime, since the moveBy command already expect the moveByEnd event for you, you can just remove the second FlyingStateChanged(state=“hovering”).