Parrot-Developers/olympe

PDraw error introduced with release 7.6.0

Closed this issue · 4 comments

Hello,

after upgrading olympe to release 7.6.0+, I get a TimeoutError when I try to start a stream (using anafi ai).
The timeout occurs in olympe/video/pdraw.py line 1174 : return self.play(*args, **kwds)

As I am using python3.11, I did not install opengl-related libraries (pyopengl-accelerate is a bit tricky, and support goes up to 3.10). I thought at first that this may be related, but trying with python3.10 and python3.9 give the same error after adding the PDrawRenderer.

minimal script to reproduce, much like the doc example:

class VideoStream:

  def __init__(self):
      self.drone = olympe.Drone(SKYCTRL_IP)
      
  def start(self):
      self.drone.connect()
      self.drone.streaming.server_addr = "192.168.53.1:554"
      self.drone.streaming.set_callbacks(
          raw_cb=self.yuv_frame_cb,
          h264_cb=self.h264_frame_cb,
          start_cb=self.start_cb,
          end_cb=self.end_cb,
          flush_raw_cb=self.flush_cb,
      )
      self.drone.streaming.start()

callback functions can be no-op.

Starting with the 7.6.0 Olympe release, you should now use the SkyController class when connecting to a drone through a SkyController.

We should probably report an error when trying to connect to a SkyController with the "Drone" class. This used to be a supported use case. We should have deprecate this usage prior to the 7.6.0 release. Sorry for the inconvenience.

The following example works fine with the PdrawRenderer on Python 3.11.
(To install pyopengl-accelerate, you should first install the latest cython 3.0.0 beta release, currently: https://github.com/cython/cython/releases/tag/3.0.0b2 )

import queue
import tempfile
import time

import olympe
from olympe.video.renderer import PdrawRenderer


SKYCTRL_IP = "192.168.53.1"


class VideoStream:
    def __init__(self):
        self.drone = olympe.SkyController(SKYCTRL_IP)
        self.renderer = None

        self.frame_queue = queue.Queue()
        self.tempd = tempfile.mkdtemp(prefix="olympe_streaming_test_")
        print(f"Streaming output dir {self.tempd}")

    def start(self):
        self.drone.connect()
        self.drone.streaming.start()
        self.renderer = PdrawRenderer(pdraw=self.drone.streaming)

    def stop(self):
        self.drone.streaming.stop()
        self.drone.disconnect()
        if self.renderer is not None:
            self.renderer.stop()
        self.drone.destroy()


if __name__ == "__main__":
    video_stream = VideoStream()
    video_stream.start()
    time.sleep(10)
    video_stream.stop()

Thank you for your reply! Using the SkyController I cannot connect to the UAV:

2023-04-25 14:23:39,783 [INFO] 	olympe.backend - _retry_connect - CtrlBackendMuxIp failed to connect to 192.168.53.1
2023-04-25 14:23:42,784 [ERROR] 	olympe.backend - aconnect - Failed to connect to 192.168.53.1:4321: -16
2023-04-25 14:23:42,785 [INFO] 	olympe.backend - _retry_connect - CtrlBackendMuxIp failed to connect to 192.168.53.1
2023-04-25 14:23:43,782 [ERROR] 	olympe.drone - _do_connect - '192.168.53.1 connection retries failed
2023-04-25 14:23:43,782 [ERROR] 	olympe.drone - connect - '192.168.53.1 connection timed out

The skycontroller 4 version in use is the 7.0.2. Maybe I am missing some config ? But I am not sure where this could come from as using the Drone constructor to connect through the SkyController is working (for everything but video streaming).

You should update your SkyController to the latest 7.6.0 firmware release:
https://firmware.parrot.com/Versions/mpp4/s905x3/7.6.0/images/mpp4_update.tar.gz

You can update your SkyController by uploading the update file above through the SkyController web interface available at http://192.168.53.1 when your controller is connected to your PC through USB.

Thanks, this was the problem !