luxonis / depthai-experiments

Experimental projects we've done with DepthAI.
MIT License
838 stars 369 forks source link

cannot import name 'realsense_msgs__msg__StreamInfo' in record.py #527

Open afgoo opened 4 months ago

afgoo commented 4 months ago

I am trying to use the record example from gen2-record-replay, and am getting an error: ImportError: cannot import name 'realsense_msgsmsgStreamInfo' from 'rosbags.typesys.types' . I am trying to record depth and colour streams for later playback using this command: python record.py -save color depth --fps 10

Oak-d PoE Pro Python 3.11.1 depthai 2.26.0.0 depthai_sdk 1.2.3

DeprecationWarning: Use constructor taking 'UsbSpeed' instead device = stack.enter_context(dai.Device(openvino_version, device_info, usb2Mode=False)) Traceback (most recent call last): File "C:\Projects\camera tests\depthai-experiments-master\depthai-experiments-master\gen2-record-replay\record.py", line 145, in <module> run() File "C:\Projects\camera tests\depthai-experiments-master\depthai-experiments-master\gen2-record-replay\record.py", line 95, in run recording.start() # Start recording ^^^^^^^^^^^^^^^^^ File "c:\users\afgoo\AppData\local\Programs\Python\Python311\Lib\site-packages\depthai_sdk\record.py", line 135, in start self.process = Thread(target=_run, args=(self._getRecorders(), self.frame_q)) ^^^^^^^^^^^^^^^^^^^^ File "c:\users\afgoo\AppData\local\Programs\Python\Python311\Lib\site-packages\depthai_sdk\record.py", line 95, in _getRecorders recorders['depth'] = RosbagRecorder(self.path, self.device, self.getSizes()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\users\afgoo\AppData\local\Programs\Python\Python311\Lib\site-packages\depthai_sdk\recorders\rosbag_recorder.py", line 247, in __init__ self.write_streamInfo(depth=True) File "c:\users\afgoo\AppData\local\Programs\Python\Python311\Lib\site-packages\depthai_sdk\recorders\rosbag_recorder.py", line 332, in write_streamInfo from rosbags.typesys.types import realsense_msgs__msg__StreamInfo as StreamInfo ImportError: cannot import name 'realsense_msgs__msg__StreamInfo' from 'rosbags.typesys.types' (c:\users\afgoo\AppData\local\Programs\Python\Python311\Lib\site-packages\rosbags\typesys\types.py)

I have also tried installing depthai 2.17.0.0, as in the requirements. The installation failed in building the wheels, but I have managed to get it installed with python 3.8. Unfortunately, this throws different errors:

Traceback (most recent call last): File "record.py", line 145, in <module> run() File "record.py", line 95, in run recording.start() # Start recording File "C:\Users\afgoo\AppData\Local\Programs\Python\Python38\lib\site-packages\depthai_sdk\record.py", line 135, in start self.process = Thread(target=_run, args=(self._getRecorders(), self.frame_q)) File "C:\Users\afgoo\AppData\Local\Programs\Python\Python38\lib\site-packages\depthai_sdk\record.py", line 95, in _getRecorders recorders['depth'] = RosbagRecorder(self.path, self.device, self.getSizes()) File "C:\Users\afgoo\AppData\Local\Programs\Python\Python38\lib\site-packages\depthai_sdk\recorders\rosbag_recorder.py", line 233, in __init__ from rosbags.typesys.types import sensor_msgs__msg__CamInfo as CamInfo ImportError: cannot import name 'sensor_msgs__msg__CamInfo' from 'rosbags.typesys.types' (C:\Users\afgoo\AppData\Local\Programs\Python\Python38\lib\site-packages\rosbags\typesys\types.py)

Erol444 commented 4 months ago

@afgoo could you first do pip install rosbags?

afgoo commented 4 months ago

@Erol444 Thanks - I have already installed rosbags with pip on both python 3.8 and 3.11.

Erol444 commented 4 months ago

@afgoo is it version rosbags==0.9.11?

afgoo commented 4 months ago

No, pip install rosbags installed version 0.10.3 in python 3.11 and 0.9.23 in python 3.8. I'll try 0.9.11.

afgoo commented 4 months ago

rosbags v0.9.11 works with python 3.8 and depthai 2.17.0.0.

However, I am still having issues with the recorder. It is able to record the 'color' stream, and/or the 'left' stream. It fails when recording the 'right' stream, or the 'depth' stream. The right stream creates the calib.json, but no data file, and the 'depth' stream creates a very small (~5 kB) .bag file, which seems to have no data.