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