I’m trying to control the ANAFI Ai drone from my Macbook using a docker container, while i know this isn’t technically supported I want to be able to use it for testing AirSDK flightplans so I have a couple of questions.
- While the drone responds to my requests, it does not work all the time. I keep getting error messages.
2022-07-14 12:44:59,365 [INFO] olympe.backend - _do_create - device callbacks have been added to arsdk_ctrl
2022-07-14 12:44:59,366 [INFO] olympe.scheduler - _create_pomp_loop - Creating pomp loop
2022-07-14 12:44:59,371 [INFO] olympe.media - _create_pomp_loop - Creating pomp loop
2022-07-14 12:44:59,437 [INFO] olympe.backend - _device_added_cb - DiscoveryNet: New device has been detected: ‘ANAFI Ai 001995’
2022-07-14 12:44:59,441 [INFO] olympe.drone - _connecting_cb - Connecting to device: ANAFI Ai 001995
2022-07-14 12:44:59,441 [INFO] olympe.drone - _connect_impl - Connection in progress...
2022-07-14 12:44:59,588 [INFO] olympe.drone.ANAFI Ai 001995 - _connected_cb - Connected to device: ANAFI Ai 001995
2022-07-14 12:44:59,589 [INFO] olympe.drone.ANAFI Ai 001995 - _connected_cb - {‘c2d_port’: 2233,
‘c2d_update_port’: 51,
‘c2d_user_port’: 21,
‘proto_v’: 3,
‘qos_mode’: 0,
‘status’: 0}
2022-07-14 12:44:59,589 [INFO] olympe.drone.ANAFI Ai 001995 - _create_command_interface - Command interface has been created
/usr/local/lib/python3.8/dist-packages/tzlocal/unix.py:164: UserWarning: Can not find any timezone configuration, defaulting to UTC.
warnings.warn(‘Can not find any timezone configuration, defaulting to UTC.’)
2022-07-14 12:44:59,591 [INFO] olympe.drone.ANAFI Ai 001995 - _send_command_impl - common.Common.CurrentDateTime(datetime=‘20220714T124459+0000’) has been sent to the device
2022-07-14 12:44:59,593 [INFO] olympe.drone.ANAFI Ai 001995 - _send_command_impl - common.Common.AllStates() has been sent to the device
2022-07-14 12:45:00,097 [WARNING] olympe.drone.ANAFI Ai 001995 - _on_sync_done - Time synchronization failed for b'192.168.42.1'
ç2022-07-14 12:45:04,590 [INFO] olympe.drone.ANAFI Ai 001995 - _link_quality_cb - Link quality: tx=0, rx=-1, rx_useful=-1
2022-07-14 12:45:05,376 [ERROR] olympe.drone.ANAFI Ai 001995 - connect - ’192.168.42.1 connection timed out
2022-07-14 12:45:05,377 [WARNING] olympe.drone.ANAFI Ai 001995 - async_disconnect - Cannot disconnect while a connection is in progress
2022-07-14 12:45:05,377 [ERROR] olympe.drone.ANAFI Ai 001995 - disconnect - Cannot disconnect properly: True <olympe.arsdkng.discovery.DiscoveryNet object at 0x7fded7c65910>
2022-07-14 12:45:05,378 [INFO] olympe.pdraw.ANAFI Ai 001995 - _create_pomp_loop - Creating pomp loop
2022-07-14 12:45:05,380 [INFO] olympe.pdraw.ANAFI Ai 001995 - _create_pomp_loop - Creating pomp loop
2022-07-14 12:45:05,382 [INFO] olympe.drone.ANAFI Ai 001995 - _send_command_impl - gimbal.set_target(gimbal_id=0, control_mode=‘position’, yaw_frame_of_reference=‘none’, yaw=0.0, pitch_frame_of_reference=‘absolute’, pitch=45.0, roll_frame_of_reference=‘none’, roll=0.0) has been sent to the device
2022-07-14 12:45:07,588 [ERROR] ulog - arsdk - net Too many ping failures
2022-07-14 12:45:07,589 [INFO] olympe.drone.ANAFI Ai 001995 - _link_status_cb - Link status: 0
2022-07-14 12:45:07,590 [INFO] olympe.pdraw.ANAFI Ai 001995 - _destroy_pomp_loop - Pomp loop has been destroyed: Thread-4
2022-07-14 12:45:07,696 [INFO] olympe.pdraw.ANAFI Ai 001995 - _destroy_pomp_loop - Pomp loop has been destroyed: Thread-3
2022-07-14 12:45:07,698 [INFO] olympe.drone.ANAFI Ai 001995 - _disconnected_cb - Disconnected from device: ANAFI Ai 001995
2022-07-14 12:45:07,700 [INFO] olympe.drone.ANAFI Ai 001995 - _on_device_removed - <olympe.arsdkng.cmd_itf.DisconnectedEvent object at 0x7fded7b75880>
2022-07-14 12:45:07,701 [INFO] olympe.media - _websocket_event_reader - websocket closed
2022-07-14 12:45:07,703 [INFO] olympe.drone.ANAFI Ai 001995 - _on_device_removed - <olympe.arsdkng.cmd_itf.DisconnectedEvent object at 0x7fded7b753a0>
2022-07-14 12:45:07,704 [INFO] olympe.drone.ANAFI Ai 001995 - disconnect - Disconnection with the device OK. IP: b'192.168.42.1'
2022-07-14 12:45:07,721 [INFO] olympe.drone.ANAFI Ai 001995 - _on_device_removed - <olympe.arsdkng.cmd_itf.DisconnectedEvent object at 0x7fded7b75a30>
2022-07-14 12:45:07,722 [INFO] olympe.media - _shutdown - olympe.media shutdown
2022-07-14 12:45:07,722 [INFO] olympe.scheduler - _destroy_pomp_loop - Pomp loop has been destroyed: subscribers_thread
2022-07-14 12:45:08,028 [INFO] olympe.backend - _destroy_pomp_loop - Pomp loop has been destroyed: Thread-1
2022-07-14 12:45:08,706 [INFO] olympe.media - _destroy_pomp_loop - Pomp loop has been destroyed: Thread-2
Docker image
FROM ubuntu:focal
SHELL [“/bin/bash”, “-c”]
RUN DEBIAN_FRONTEND=“noninteractive” \
apt-get update && \
apt-get install -y python3 python3-distutils curl libgl1 && \
rm -rf /var/lib/apt/lists/*
RUN python3 <(curl https://bootstrap.pypa.io/get-pip.py)
RUN python3 -m pip install parrot-olympe
# For testing purposes
COPY main.py .
ENTRYPOINT [ “python3", “main.py” ]
Olympe script
import os
import time
import olympe
from olympe.messages.ardrone3.Piloting import TakeOff, Landing
from olympe.messages import gimbal
DRONE_IP = os.environ.get(“DRONE_IP”, “192.168.42.1")
def test_connection():
drone = olympe.Drone(DRONE_IP)
drone.connect()
drone(gimbal.set_target(
gimbal_id=0,
control_mode=“position”,
yaw_frame_of_reference=“none”, # None instead of absolute
yaw=0.0,
pitch_frame_of_reference=“absolute”,
pitch=45.0,
roll_frame_of_reference=“none”, # None instead of absolute
roll = 0.0,
)).wait()
drone.disconnect()
if __name__ == “__main__“:
test_connection()
I’m wondering what the issue is, since it seems that it can’t get a proper connection. The implementation worked perfectly from the Ubuntu computer, but on the Macbook its unreliable. I’m wondering why that might be the case, and if there is any way to fix it.
- My second question is to know if it is possible to activate AirSDK flightplans without using Olympe? I am able to upload flightplans to a simulated drone by using curl requests, but from doing research I can’t seem to find any way off activating them without using Olympe. There isn’t any documentation on the API.