Hi, I have a error when running this code
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", "192.168.42.1") ELLO_MISSION_URL = os.environ.get("HELLO_MISSION_URL", "/home/domo/code/airsdk-samples/hello/.airsdk/out/hello-classic/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()
Here is the log message:
2023-09-06 01:25:04,664 [INFO] olympe.backend - _create_pomp_loop - Creating pomp loop 2023-09-06 01:25:04,665 [INFO] olympe.backend - _do_create - device callbacks have been added to arsdk_ctrl 2023-09-06 01:25:04,666 [INFO] olympe.scheduler - _create_pomp_loop - Creating pomp loop 2023-09-06 01:25:04,671 [INFO] olympe.media - _create_pomp_loop - Creating pomp loop 2023-09-06 01:25:04,786 [INFO] olympe.missions - _open - Opening mission 'com.parrot.missions.samples.hello' multiple times 2023-09-06 01:25:04,812 [INFO] olympe.backend - _device_added_cb - DiscoveryNet: New device has been detected: 'ANAFI Ai 002107' 2023-09-06 01:25:04,815 [INFO] olympe.drone - _connecting_cb - Connecting to device: ANAFI Ai 002107 2023-09-06 01:25:04,815 [INFO] olympe.drone - _connect_impl - Connection in progress... 2023-09-06 01:25:04,832 [INFO] olympe.drone.ANAFI Ai 002107 - _aconnected_cb - Connected to device: ANAFI Ai 002107 2023-09-06 01:25:04,832 [INFO] olympe.drone.ANAFI Ai 002107 - _aconnected_cb - {'c2d_port': 2233, 'c2d_update_port': 51, 'c2d_user_port': 21, 'proto_v': 3, 'qos_mode': 0, 'status': 0} 2023-09-06 01:25:04,832 [INFO] olympe.drone.ANAFI Ai 002107 - _create_command_interface - Command interface has been created 2023-09-06 01:25:04,835 [INFO] olympe.drone.ANAFI Ai 002107 - _send_command_impl - common.Common.CurrentDateTime(datetime='20230906T012504-0700') has been sent to the device 2023-09-06 01:25:04,846 [INFO] olympe.drone.ANAFI Ai 002107 - _send_command_impl - common.Common.AllStates() has been sent to the device 2023-09-06 01:25:05,349 [WARNING] olympe.drone.ANAFI Ai 002107 - _on_sync_done - Time synchronization failed for b'192.168.42.1' 2023-09-06 01:25:09,833 [INFO] olympe.drone.ANAFI Ai 002107 - _link_quality_cb - Link quality: tx=0, rx=-1, rx_useful=-1 2023-09-06 01:25:10,794 [ERROR] olympe.drone.ANAFI Ai 002107 - connect - '192.168.42.1 connection timed out 2023-09-06 01:25:10,795 [ERROR] olympe.drone.ANAFI Ai 002107 - _cmd_itf_cmd_send_status_cb - Command send status cancel/timeout: common.Common.CurrentDateTime ARSDK_CMD_ITF_CMD_SEND_STATUS_CANCELED, done: True 2023-09-06 01:25:10,796 [ERROR] olympe.drone.ANAFI Ai 002107 - _cmd_itf_cmd_send_status_cb - Command send status cancel/timeout: common.Common.AllStates ARSDK_CMD_ITF_CMD_SEND_STATUS_CANCELED, done: True 2023-09-06 01:25:10,796 [INFO] olympe.drone.ANAFI Ai 002107 - _disconnected_cb - Disconnected from device: ANAFI Ai 002107 2023-09-06 01:25:10,798 [ERROR] olympe.drone.ANAFI Ai 002107 - _do_connect - '192.168.42.1 connection retries failed 2023-09-06 01:25:10,801 [INFO] olympe.drone.ANAFI Ai 002107 - _on_device_removed - <olympe.arsdkng.cmd_itf.DisconnectedEvent object at 0x7f995a7dd580> 2023-09-06 01:25:10,802 [INFO] olympe.media - _websocket_event_reader - websocket closed 2023-09-06 01:25:10,803 [INFO] olympe.drone.ANAFI Ai 002107 - disconnect - Disconnection with the device OK. IP: b'192.168.42.1' Traceback (most recent call last): File "/home/domo/code/airsdk-samples/hello/hello.py", line 77, in <module> test_hello_mission() File "/home/domo/code/airsdk-samples/hello/hello.py", line 31, in test_hello_mission assert drone.connect() AssertionError 2023-09-06 01:25:10,843 [INFO] olympe.drone.ANAFI Ai 002107 - _on_device_removed - <olympe.arsdkng.cmd_itf.DisconnectedEvent object at 0x7f9973bdaaf0> 2023-09-06 01:25:10,844 [ERROR] olympe.media - _get_all_media - Unhandled exception Traceback (most recent call last): File "/home/domo/code/parrot-olympe/out/olympe-linux/staging/usr/lib/python/site-packages/olympe/concurrent/_task.py", line 132, in step result = self._coro.send(None) StopIteration: ConnectionClosed() During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/domo/code/parrot-olympe/out/olympe-linux/staging/usr/lib/python/site-packages/olympe/media.py", line 2041, in _get_all_media data = await response.json() File "/home/domo/code/parrot-olympe/out/olympe-linux/staging/usr/lib/python/site-packages/olympe/http.py", line 196, in json return json.loads(await self.text()) File "/home/domo/code/parrot-olympe/out/olympe-linux/pyenv_root/versions/3.9.5/lib/python3.9/json/__init__.py", line 346, in loads return _default_decoder.decode(s) File "/home/domo/code/parrot-olympe/out/olympe-linux/pyenv_root/versions/3.9.5/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/home/domo/code/parrot-olympe/out/olympe-linux/pyenv_root/versions/3.9.5/lib/python3.9/json/decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting ':' delimiter: line 1 column 1461 (char 1460) 2023-09-06 01:25:10,844 [WARNING] olympe.media - aconnect - Media are not yet indexed 2023-09-06 01:25:10,845 [INFO] olympe.scheduler - _destroy_pomp_loop - Pomp loop has been destroyed: subscribers_thread 2023-09-06 01:25:11,046 [INFO] olympe.backend - _destroy_pomp_loop - Pomp loop has been destroyed: Thread-3 2023-09-06 01:25:12,805 [INFO] olympe.media - _destroy_pomp_loop - Pomp loop has been destroyed: Thread-4
Is there any way to fix the problem? Thanks for your help.