Skycontroller3 connects to Anafi, Olympe can see Skycontroller3, but API to Anafi doesn't work?

I’ve followed the instructions in the documentation to connect the Skycontroller3 to my laptop using a USB-C to USB-A cable, and I configured the RNDIS driver. That works, and I can ping the Skycontroller3 from my laptop. The Skycontroller3 has a solid blue light, and I can control the tilt of the camera on the Anafi using the Skycontroller’s rocker button, so I know that the Skycontroller and Anafi are connected. The problem I’m having is that Olympe isn’t working to control the Anafi via the Skycontroller. Here’s my code:

import olympe
SKYCTRL_IP=‘192.168.53.1’
my_drone = olympe.Drone(SKYCTRL_IP)
my_drone.connect()

The error in the output below seems to say that the Skycontroller fails to ping the Anafi, but Olympe does connect to the Skycontroller, and I can still tilt the camera using the controller rocker. I’m really stumped by this! I was really hoping to use the Skycontroller to reliably reconnect to the Anafi because if I remove the Skycontroller, I can connect my laptop to the Anafi’s wifi, but then wifi randomly drops the connection from my laptop to the Anafi. It seems like the Skycontroller does a better job of maintaining the wifi connection than my laptop does, but it’s not very useful if I cannot programmatically control the drone from python.

Output:

2020-11-25 16:06:36,285 [INFO] olympe.backend - _device_added_cb - New device has been detected: ‘Skycontroller 3’
2020-11-25 16:06:36,287 [INFO] olympe.drone.Skycontroller 3 - _connecting_cb - Connecting to device: Skycontroller 3
2020-11-25 16:06:36,287 [INFO] olympe.drone.Skycontroller 3 - _connection_impl - Connection in progress…
2020-11-25 16:06:36,289 [INFO] olympe.drone.Skycontroller 3 - _connected_cb - Connected to device: Skycontroller 3
2020-11-25 16:06:36,290 [INFO] olympe.drone.Skycontroller 3 - _connected_cb - {‘json’: {‘arstream2_server_control_port’: 5005,
‘arstream2_server_stream_port’: 5004,
‘c2d_port’: 2233,
‘c2d_update_port’: 51,
‘c2d_user_port’: 21,
‘proto_v’: 2,
‘qos_mode’: 0,
‘status’: 0}}
2020-11-25 16:06:36,290 [INFO] olympe.drone.Skycontroller 3 - _create_command_interface - Command interface has been created: itf=None
2020-11-25 16:06:36,291 [INFO] olympe.pdraw.Skycontroller 3 - _create_pomp_loop - Creating pomp loop
2020-11-25 16:06:36,292 [INFO] olympe.pdraw.Skycontroller 3 - _create_pomp_loop - Creating pomp loop
2020-11-25 16:06:36,295 [INFO] olympe.drone.Skycontroller 3 - _send_command_impl - skyctrl.Common.CurrentDateTime(‘20201125T160636-0500’,) has been sent to the device
2020-11-25 16:06:36,297 [INFO] olympe.drone.Skycontroller 3 - _send_command_impl - skyctrl.Common.AllStates() has been sent to the device
2020-11-25 16:06:36,811 [WARNING] olympe.drone.Skycontroller 3 - _on_sync_done - Time synchronization failed for b’192.168.53.1’
net ping failures: 1
net ping failures: 2
net ping failures: 3
net Too many ping failures
2020-11-25 16:06:44,289 [INFO] olympe.drone.Skycontroller 3 - _link_status_cb - Link status: 0
2020-11-25 16:06:44,290 [ERROR] olympe.drone.Skycontroller 3 - _cmd_itf_send_status_cb - Command send status cancel/timeout: skyctrl.Common.CurrentDateTime 3, done: 1
2020-11-25 16:06:44,290 [ERROR] olympe.drone.Skycontroller 3 - _cmd_itf_send_status_cb - Command send status cancel/timeout: skyctrl.Common.AllStates 3, done: 1
2020-11-25 16:06:44,291 [INFO] olympe.drone.Skycontroller 3 - _disconnected_cb - Disconnected from device: Skycontroller 3
2020-11-25 16:06:44,292 [INFO] olympe.pdraw.Skycontroller 3 - _destroy_pomp_loop - Pomp loop has been destroyed
2020-11-25 16:06:44,295 [INFO] olympe.pdraw.Skycontroller 3 - dispose - pdraw callbacks thread loop stopped
2020-11-25 16:06:44,296 [INFO] olympe.pdraw.Skycontroller 3 - _destroy - destroying yuv buffer pool…
2020-11-25 16:06:44,299 [INFO] olympe.pdraw.Skycontroller 3 - _destroy - yuv buffer pool destroyed
2020-11-25 16:06:44,299 [INFO] olympe.pdraw.Skycontroller 3 - _destroy - pdraw thread loop stopped
2020-11-25 16:06:44,314 [ERROR] olympe.drone.Skycontroller 3 - _send_command - message skyctrl.Common.AllStates not sent: skyctrl.Common.AllStates has been sent but hasn’t been acknowledged
2020-11-25 16:06:44,316 [ERROR] olympe.drone.Skycontroller 3 - _send_states_settings_cmd - Unable get device state/settings: skyctrl.Common.AllStates for b’192.168.53.1’
Out[16]: ReturnTuple(OK=False, message=“Unable get device state/settings: skyctrl.Common.AllStates for b’192.168.53.1’”, value=None, error_code=107)
2020-11-25 16:06:44,404 [INFO] olympe.pdraw.Skycontroller 3 - _destroy_pomp_loop - Pomp loop has been destroyed

I figured out my problem. The root cause was that my docker container for Olympe was using the wrong docker network. Switching from the default docker bridge to the more permissive host network made Olympe work without any other changes. Unfortunately, this appears to break the pycharm docker integration because the docker plugin does some sort of port forwarding, but running python on the command line still works OK. Anyway, it’s not a bug in Olympe.

Hi,
what model of decker was using with pycharm?? could you advise please? Thank you.

I used the docker plugin for Pycharm to run the docker image from my Dockerfile. You have to build the Dockerfile using a command like docker build -t olympe . and then load it as a project interpreter in Pycharm. I’ll see if I can get docker-compose to fix the docker networking problem.

1 Like

Using docker-compose to set network_mode: "host" fixed it! (Docker command line --network host does the same thing.) I made a pull request on github with the relevant YML file. I really doubt this docker image can work in Windows directly, but in Linux inside a Oracle VirtualBox it works OK for me with Windows as the host OS if I set the VM networking mode to bridge the RNDIS adapter for the Skycontroller into the VM. Or I can use bridge mode to map the wifi adapter into the VM. Either way the linux guest OS gets an IP on 192.168.53.X / 192.168.42.X and can connect to the Anafi!

1 Like

I uploaded my docker image to docker hub. You can use it by: docker pull djohnsonara/olympe then docker run -it --rm --network host djohnsonara/olympe ipython . Once you’re in ipython you can use all of the olympe stuff, like import olympe and then connecting to a drone per the Olympe documentation.

1 Like