Hello !
I am trying to make PDraw work (“without olympe”), I manage to make it work outside of a docker and copied the code to make it work inside a docker. Here is an abstract of my code :
class Example:
def __init__(self):
# Creation of a queue for YUV frames
self.frame_queue = queue.Queue()
# Creation of a thread for YUV frames processing
self.processing_thread = threading.Thread(target=self.yuv_frame_processing)
self.pdraw = Pdraw()
rospy.logdebug(f"Init OK")
def start(self):
self.pdraw.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,
)
if not self.started:
# assert self.pdraw.start(url=self.drone_url)
# self.drone.streaming.start()
assert self.pdraw.play(url=self.drone_url) # Default url = real drone, url=self.drone_url /url="rtsp://192.168.42.1/live"
assert self.pdraw.wait(PdrawState.Playing, timeout=5)
self.started = True
self.processing_thread.start()
rospy.logdebug("THREAAAAAD")
def stop(self):
if self.started:
print("STOOOOOOOOOOOOOOOOOP")
self.processing_thread.join()
assert self.pdraw.close()
assert self.pdraw.dispose()
def flush_cb(self, stream):
print("FLUSH")
if stream["vdef_format"] != olympe.VDEF_I420:
return True
while not self.frame_queue.empty():
self.frame_queue.get_nowait().unref()
print("Emptying queue")
return True
def start_cb(self):
rospy.logdebug("STAAAAAAAAAAAAAAAART")
pass
def end_cb(self):
rospy.logdebug("STOOOOOOOOOOOOOOOOP CB")
pass
def yuv_frame_cb(self, yuv_frame):
# print("YUV FRAME CB")
yuv_frame.ref()
self.frame_queue.put_nowait(yuv_frame)
def yuv_frame_processing(self):
while self.started:
try:
rospy.logdebug(f"Queue size before getting: {self.frame_queue.qsize()}")
yuv_frame = self.frame_queue.get(timeout=0.1)
rospy.logdebug(f"Processing frame, queue size: {self.frame_queue.qsize()}")
except queue.Empty:
rospy.logdebug("Queue empty")
continue
rospy.logdebug("AHHHHHHHHHHHHHHH")
yuv_frame.unref()
if __name__ == '__main__':
rospy.init_node('pdrawreader', anonymous = False, log_level = rospy.DEBUG)
pdrawReader = PDrawReader()
pdrawReader.start()
But when I run my docker :
Init OK
| [DEBUG] [1738746140.620782]: DRONE URL : rtsp://192.168.42.1/live
| 2025-02-05 10:02:20,625 [INFO] olympe.pdraw - Pdraw._pdraw_new - Pdraw interface has been created
| 2025-02-05 10:02:20,626 [INFO] olympe.pdraw - Pdraw._open_url - Opening pdraw url OK: b'rtsp://192.168.42.1/live'
| 2025-02-05 10:02:20,748 [INFO] olympe.pdraw - Pdraw._select_media - _select_media: idx=0 media_id=1 name=Front camera (AirSDK) default=True
| 2025-02-05 10:02:20,749 [WARNING] olympe.pdraw - Pdraw._select_media - media_name DefaultVideo is unavailable. Selecting the default media instead: Front camera (AirSDK)
| 2025-02-05 10:02:20,794 [INFO] olympe.pdraw - Pdraw._ready_to_play - _ready_to_play(1) called
| [DEBUG] [1738746140.795809]: STAAAAAAAAAAAAAAAART
| [DEBUG] [1738746140.804356]: Queue size before getting: 0
| [DEBUG] [1738746140.805026]: THREAAAAAD
| 2025-02-05 10:02:20,904 [INFO] olympe.pdraw - Pdraw._close_stream_impl - Closing pdraw demuxer OK
| 2025-02-05 10:02:20,904 [INFO] olympe.pdraw - Pdraw._ready_to_play - _ready_to_play(0) called
| [DEBUG] [1738746140.904974]: STOOOOOOOOOOOOOOOOP CB
| 2025-02-05 10:02:20,905 [ERROR] ulog - pomp - fd=20, cb=0x7fe5f5a43260 still in loop
| 2025-02-05 10:02:20,905 [ERROR] ulog - pomp - fd=24, cb=0x7fe5f5a43260 still in loop
| 2025-02-05 10:02:20,905 [ERROR] ulog - pomp - fd=26, cb=0x7fe5f42ecfd0 still in loop
| 2025-02-05 10:02:20,906 [ERROR] ulog - pomp - fd=19, cb=0x7fe5f5a43260 still in loop
| 2025-02-05 10:02:20,906 [ERROR] ulog - pomp - fd=21, cb=0x7fe5f5a37d80 still in loop
| 2025-02-05 10:02:20,907 [ERROR] ulog - pomp - fd=23, cb=0x7fe5f5a43260 still in loop
| 2025-02-05 10:02:20,907 [ERROR] ulog - pomp - fd=25, cb=0x7fe5f42ecdb0 still in loop
| 2025-02-05 10:02:20,907 [ERROR] ulog - pomp - fd=27, cb=0x7fe5f5a43260 still in loop
| 2025-02-05 10:02:20,907 [ERROR] olympe.pdraw - PompLoopThread._destroy_pomp_loop - Error while destroying pomp loop: -16
| [DEBUG] [1738746140.908026]: Queue empty
| [DEBUG] [1738746140.909349]: Queue size before getting: 0
| 2025-02-05 10:02:21,007 [INFO] olympe.pdraw - PompLoopThread._destroy_pomp_loop - Pomp loop has been destroyed: Thread-6
| [DEBUG] [1738746141.010928]: Queue empty
| [DEBUG] [1738746141.014818]: Queue size before getting: 0
| [DEBUG] [1738746141.118887]: Queue empty
| [DEBUG] [1738746141.122761]: Queue size before getting: 0
| [DEBUG] [1738746141.226938]: Queue empty
| [DEBUG] [1738746141.230937]: Queue size before getting: 0
| [DEBUG] [1738746141.334503]: Queue empty
| [DEBUG] [1738746141.338198]: Queue size before getting: 0
| [DEBUG] [1738746141.441428]: Queue empty
| [DEBUG] [1738746141.444921]: Queue size before getting: 0
| [DEBUG] [1738746141.548882]: Queue empty
| [DEBUG] [1738746141.552702]: Queue size before getting: 0
| [DEBUG] [1738746141.656407]: Queue empty
| [DEBUG] [1738746141.658846]: Queue size before getting: 0
It seems that I am not receiving any frame, that the raw_cb is not triggered but I don’t know why, do you have any idea ?
For further info dependencies in my docker file :
# install olympe
RUN apt-get update
RUN apt install curl git python3 zlib1g-dev libglfw3-dev libsdl2-dev cmake qtbase5-dev build-essential -y
RUN python -m pip install --upgrade pip ;\
pip3 install parrot-olympe==7.0.1
# Install opencv
RUN python3 -m pip install opencv-python
I am working with an anafi ai that I can ping inside the docker.
Hope you can help me on this one I am really stuck ! Thanks !