PCMD is repeated automatically with SkyController

I have read in other forum topics here that by using the command olympe.messages.ardrone3.Piloting.PCMD you should have to send this frequently to make the drone move and if you stop sending this command the drone should stop within 500ms. However, it seems like this is not true for me. For me the drone does not stop if I stop sending this command. Instead it continues to execute the last command until I send another command. And even worse, it also remembers the last command after I land the drone and do another takeoff, then it continues to carry out the last PCMD sent.
For example, I send one TakeOff and after 10ms I send one, and only one, olympe.messages.ardrone3.Piloting.PCMD(true, 0, 0, 0, 1.5, 0). The drone then starts ascending and does not stop until I take over the control with SkyController (yes I have the SkyController connected to the computer with usb and connect to the drone through this). If I then land with the SkyController and then press the takeoff button on the SkyController, the drone takes off and then directly continues to ascend until I again pulls it down with the SkyController joysticks.
If I run the same test in Sphinx it woks as expected, meaning that it stops ascending after about 500ms after the PCMD command is sent and does not remember the last command sent.

1 Like

Hi,

You should not rely on the 500ms timeout on the PCMD. It is only here as a failsafe for network losses, and thus is not enabled on the ā€˜Controllerā€™->SkyController link (which is assumed to be reliable). The proper way to ensure that the drone stops is to send a PCMD(false, 0, 0, 0, 0, 0) message.

Regards,
Nicolas.

Thank you for that information.
I donā€™t want to sound rude or hard but I find it really remarkable that this is not pinpointed or even mentioned in your documentation. I have spent days to find this problem and have been so very close to crash my drone several times because of this. I think the behavior in the SkyController is incorrect. It should stop the drone when you stop sending the PCMD, exactly as it does in Sphinx and as I hope it does when you are connected directly to the drone. This is how it works for other manufacturers that I have tested.
Is there any other difference between the Sphinx and the SkyController of this magnitude? I became really scared now of continued development work. Please document all such differences so that the development with Sphinx and testing with SkyController can be more trustworthy.

And an even scarier thought that just came to meā€¦ What will happen if my python program crashes before I have time to send a PCMD(false, 0, 0, 0, 0, 0) message? Will the drone then just continue to fly away until it looses wifi signal? In that case it would be impossible to create a ā€œsafeā€ autonomous drone service.

To address your concerns, here are some elements of answer:

  • The PCMD command has no inherent duration, and thus all of our software (FreeFlight and the SkyController) uses a timer to send them periodically. GroundSDK (the mobile, higher-level API) does not exposes a way to send a single PCMD, but setPitch/setRoll(ā€¦) functions. On this API, it ā€œfeelsā€ more obvious that you have to set back the roll/pitch to zero when you want to stop. As I said, the 500ms timeout was designed as a failsafe for bad wifi conditions. Since Olympe allows you to send individual commands, we might add the same timeout to the SkyController in a future version to handle cases like this, but you should still try to send a zero command when you want to stop.

  • The difference you see is not a difference between Sphinx and an actual drone, it is a difference between a direct connection and a connection through a SkyController. Note than you can test your work with a physical SkyController, itself connected to a simulated drone (as explained in the Sphinx documentation). You should observe the same behavior with this setup as you observe with a physical drone.

  • If your program crashes, the SkyController will detect it (which can take a few seconds, though), and will revert to itā€™s own commands (which should be ā€œzeroā€ if youā€™re not moving the joysticks). Unplugging the SkyController from the computer will trigger this behavior too.

Hope this clarifies the behavior.

Regards,
Nicolas.

Thank you Nicolas for a very good and explaining answer.
I didnā€™t know I could connect the SkyController to Sphinx. I will definitely try that.
I am glad to hear that the SkyController takes over the command if my program crashes. I just tried that and I can confirm that it works (feels good).
I am also glad to hear that you are considering to add the timeout even to the SkyController. In our autonomous drone application it would fit into the safety handling much better.
Regards
Mikael