How to use PilotedPOI

When I start the POI (with the StartPilotedPOI command) the PilotedPOI goes into the RUNNING state. But when I send a moveBy command, the drone does not move.

Here an example code that does not work:

from __future__ import print_function  # python2/3 compatibility for the print function
import olympe
from olympe.messages.ardrone3.PilotingState import PilotedPOI, FlyingStateChanged, PositionChanged
from olympe.messages.ardrone3.Piloting import TakeOff, StartPilotedPOI, moveBy, StopPilotedPOI
from olympe.messages.ardrone3.GPSSettingsState import GPSFixStateChanged
from olympe.messages.ardrone3.GPSSettingsState import GPSFixStateChanged, HomeChanged
from olympe.messages.ardrone3.PilotingEvent import moveByEnd
import time

# Connection
drone = olympe.Drone("10.202.0.1")
drone.connection()

# Wait for GPS fix
drone(GPSFixStateChanged(_policy = 'wait'))

# Take-off
drone(
    FlyingStateChanged(state="hovering", _policy="check")
    | FlyingStateChanged(state="flying", _policy="check")
    | (
        GPSFixStateChanged(fixed=1, _timeout=10, _policy="check_wait")
        >> (
            TakeOff(_no_expect=True)
            & FlyingStateChanged(
                state="hovering", _timeout=10, _policy="check_wait")
        )
    )
).wait()

# Getting the GPS position
pos = drone.get_state(PositionChanged)
latitude = pos['latitude']
longitude = pos['longitude']
altitude = pos['altitude']

# Enabling the POI
drone(
    StartPilotedPOI(latitude, longitude, altitude)
    >> (PilotedPOI(latitude=latitude, longitude=longitude, altitude=altitude, status='RUNNING', _policy='wait') 
         | 
         PilotedPOI(latitude=latitude, longitude=longitude, altitude=altitude, status='PENDING', _policy='wait'))
).wait()

# Moving the drone 
drone(
    moveBy(5, 5, 0, 0)
    >> moveByEnd(_policy='wait')
).wait().success()

drone.disconnection()

So, how PilotedPOI works?

Thank you

Hi,

Currently, PilotedPOI only works with manual piloting commands (i.e olympe.Drone.start_piloting, olympe.Drone.piloting_pcmd, olympe.Drone.stop_piloting and/or olympe.messages.ardrone3.Piloting.PCMD).

PilotedPOI + moveBy is currently not implemented, totally doable and would be really cool. We’ll consider this feature for a future release (I can’t promise anything though).

The moveBy command is only accepted by the drone while the drone is in the “hovering” flying state. The problem here is that the drone enters the “flying” flying state the moment you send your StartPilotedPOI command so the moveBy command is rejected by the drone.