Dynamically Interrupting and Resuming a Drone's MoveBy Mission for Hovering

Hi everyone,

I’m currently working on a project with a Parrot drone using the Olympe library and I’ve encountered a challenge that I hope to get some insights on.

I have a drone mission where I need the drone to move forward a certain distance (let’s say 40 meters) using a command like self.drone(moveBy(40, 0, 0, 0, _timeout=1)).wait().success(). However, I want to be able to dynamically interrupt this movement based on user input (or another trigger) and make the drone hover before it completes the 40-meter distance. After hovering for a while, the drone should then resume its mission to complete the remaining distance.

Current Workaround:
As a workaround, I’ve tried splitting the 40-meter distance into smaller 1-meter increments and checking for the trigger after each increment:

for i in range(40):
    if some_trigger:
        hover()  # Custom function to hover
    else:
        self.drone(moveBy(1, 0, 0, 0, _timeout=1)).wait().success()

This method works, but it feels a bit inelegant and possibly inefficient. I’m wondering if there’s a better or more standard way to achieve this kind of dynamic control interruption and resumption.

Thanks in advance for your help!

Hi @rushikesh-slu,

You can use the command CancelMoveBy to stop the drone during a MoveBy, but you need to get the position of your drone to complete the last part of your MoveBy.

Another solution is to use the command MoveTo and CancelMoveBy. It is like MoveBy with GPS positions.

Regards,
Axel

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