On Ubuntu 22.04 after upgrading parrot-airsdk to 0:7.6.0, parrot-sphinx to 2.12.2 and parrot-olympe to 7.6.1 all calls to mission.wait_ready timeout.
To test this I built the Hello World example from airsdk-samples/hello at master · Parrot-Developers/airsdk-samples · GitHub
and used the example code provided for Olympe mission installation:
import logging
import olympe
import olympe.log
import os
import pprint
from olympe.controller import Disconnected
from olympe.messages.common.Common import Reboot
from olympe.messages import mission
DRONE_IP = os.environ.get("DRONE_IP", "10.202.0.1")
HELLO_MISSION_URL = os.environ.get("HELLO_MISSION_URL", "/home/hmoilanen/Documents/DroneCoverage/Examples/DroneHelloWorld/hello/.airsdk/out/hello-pc/images/com.parrot.missions.samples.hello.tar.gz")
olympe.log.update_config({"loggers": {"olympe": {"level": "INFO"}}})
logger = logging.getLogger("olympe")
def test_hello_mission():
drone = olympe.Drone(DRONE_IP)
with drone.mission.from_path(HELLO_MISSION_URL).open() as hello:
# Mission messages modules are now available from the Python path
from olympe.airsdk.messages.parrot.missions.samples.hello.Command import Say, Hold
from olympe.airsdk.messages.parrot.missions.samples.hello.Event import count
# Mission messages are also available under the Mission.messages dictionary
assert hello.messages["parrot.missions.samples.hello"].Command.Say is Say
assert hello.messages["parrot.missions.samples.hello"].Event.count is count
# Install the 'hello' mission and reboot the drone
assert drone.connect()
assert hello.install(allow_overwrite=True)
logger.info("Mission list: " + pprint.pformat(drone.mission.list_remote()))
assert drone(Reboot() >> Disconnected()).wait()
# Connect to the drone after reboot, load and activate the 'hello' mission
assert drone.connect(retry=5)
assert hello.wait_ready(5)
# wait for the current mission to be activated
mission_activated = drone(mission.state(state="active"))
assert mission_activated.wait(), mission_activated.explain()
logger.info("Mission list: " + pprint.pformat(drone.mission.list_remote()))
# load and activate the hello mission
mission_activated = drone(
mission.load(uid=hello.uid)
>> mission.activate(uid=hello.uid)
)
assert mission_activated.wait(), mission_activated.explain()
# Make the drone say hello (nod its gimbal)
assert drone(Say()).wait()
counter = None
# Wait for 3 nod of the drone gimbal
for i in range(3):
if counter is None:
expectation = drone(count(_policy="wait")).wait(_timeout=10)
assert expectation, expectation.explain()
counter = expectation.received_events().last().args["value"]
else:
counter += 1
expectation = drone(count(value=counter)).wait(_timeout=10)
assert expectation, expectation.explain()
# Stop and disconnect
assert drone(Hold()).wait()
expectation = drone(count(_policy="wait", _timeout=15)).wait()
assert not expectation, expectation.explain()
assert drone(count(value=counter, _policy="check"))
assert drone.disconnect()
if __name__ == "__main__":
test_hello_mission()
The code successfully logs that the mission is installed
olympe - test_hello_mission - Mission list: [MissionMetadataRemote(uid='com.parrot.missions.samples.hello',
name='hello',
desc='Describe your mission here.',
version='0.0.0',
target_model_id=2330,
target_min_version='0.0.0',
target_max_version='99.99.99',
build_sdk_version='7.6.0',
build_sdk_target_arch='x64',
digest='sha512:a8dd78b829b81a191c6a6fc0841f1992cfb84cb09b8a2744aed4369888bca7b10de912ed001db6295b72362805c223e7c83ff405932a2160ca826fc42529a613')]
and eventually fails with
Traceback (most recent call last):
File "/home/foo/Documents/HelloWorld/helloworld.py", line 66, in test_hello_mission
assert hello.wait_ready(5)
AssertionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/foo/.local/lib/python3.10/site-packages/olympe/scheduler.py", line 310, in unsubscribe
future.result(subscriber.timeout)
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 460, in result
raise TimeoutError()
concurrent.futures._base.TimeoutError
From ulogcat we can see that the drone is also reporting this disconnection:
01-01 02:04:02.588 W arsdk (control-136) : net ping failures: 1
01-01 02:04:04.588 W arsdk (control-136) : net ping failures: 2
01-01 02:04:06.588 W arsdk (control-136) : net ping failures: 3
01-01 02:04:06.588 E arsdk (control-136) : net Too many ping failures
01-01 02:04:06.588 I manager_ng (control-136) : controller 'olympe': link_status=KO
01-01 02:04:06.588 I manager_ng (control-136) : controller 'olympe': disconnected
One could argue that the timeout window is too small, but even removing it i.e. having it wait indefinitely results in the same net ping failures on the drones side.
For this simulator project accessing the developer settings with FreeFlight7 is not feasible.
How should I continue debugging this? What could be the reason for these timeouts?
Before upgrading parrot-airsdk, parrot-olympe and parrot-sphinx none of the calls to mission.wait_ready resulted in a timeout.