Drone twitching during GuidedFlight

Hi,

I’m working with the GuidedPilotingItf to give my drone a set of Directive to follow. But each time I give a new directive, the drone is twitching. It looks that it tries to hover before following the next directive.

Do you think it’s the normal SDK behaviour or a problem in my code ?

Here’s a short video of the problem : https://easyupload.io/5p8r99

And my code to send directive :

GuidedPilotingItf guidedPilotingItf = drone.getPilotingItf(GuidedPilotingItf.class);

        Timer t = new Timer();
        t.scheduleAtFixedRate(new TimerTask() {
            @Override
            public void run() {
                guidedPilotingItf.move(new GuidedPilotingItf.RelativeMoveDirective(10, 0, 0, 0, null));
            }
        }, 2000, 1000);

NB : I tried to change the interval at which I send directives but I still have twitching

Did you ever find a solution to this issue?

Hi,

Each time guidedPilotingItf.move is called, the currently executing move is cancelled, and the new one is executed. This will always produce the twitch you observe.

If you want something smoother, you need to define a flight plan and execute it using FlightPlanPilotingItf.

Also, Timer may (will?) call your TimerTask on a background thread, and from there, you must not call into GroundSdk APIs; GroundSDk APIs are only safe to call from the android main thread.

Best regards.

Mathieu