Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
afgoo opened this issue Jul 1, 2024 · 5 comments
Open

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

afgoo opened this issue Jul 1, 2024 · 5 comments

Comments

@afgoo
Copy link

afgoo commented Jul 1, 2024

I am trying to use the record example from gen2-record-replay, and am getting an error: ImportError: cannot import name 'realsense_msgs__msg__StreamInfo' 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
Copy link
Member

Erol444 commented Jul 1, 2024

@afgoo could you first do pip install rosbags?

@afgoo
Copy link
Author

afgoo commented Jul 2, 2024

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

@Erol444
Copy link
Member

Erol444 commented Jul 2, 2024

@afgoo is it version rosbags==0.9.11?

@afgoo
Copy link
Author

afgoo commented Jul 2, 2024

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
Copy link
Author

afgoo commented Jul 4, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants