After moveByEnd event. Drone still in flying state

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

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 asyncaction.py example in the documentation which results in RuntimeError “Cannot complete the flying action”.

Hi,

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”).

Regards

Nicolas

Hello Tareq,

For your information, this is a regression in the (simulated) Anafi firmware introduced somewhere between the 1.2.4 and the 1.3.2 Anafi firmware release. This will be fixed in the future Anafi firmware release (probably in a 1.6.x).

Please note that some commands are silently ignore by the drone if it is not in the “hovering” state (this is the case of the moveTo command).

As a workaround, you can send an “hovering command” (actually a PCMD(1, 0, 0, 0, 0, 0) ) after the moveBy command. This will force the Anafi to go back in the “hovering” state.

Nicolas