• DepthAI-v2ROS
  • AttributeError: 'OakCamera' object has no attribute 'ros_stream'

I'm following the tutorial here:

luxonis/depthaiblob/main/depthai_sdk/examples/streaming/ros_publishing.py

from depthai_sdk import OakCamera
import depthai
with OakCamera(usb_speed=depthai.UsbSpeed.HIGH) as oak: 
   color = oak.create_camera('color', resolution='720p', encode='jpeg', fps=5) 
   color.config_color_camera(isp_scale=(2,3)) 
   left = oak.create_camera('left', resolution='400p', encode='jpeg',fps=5) 
   right = oak.create_camera('right', resolution='400p', encode='jpeg',fps=5) 

   imu = oak.create_imu() 
   imu.config_imu(report_rate=40, batch_report_threshold=5)

   oak.ros_stream([left, right, color, imu]) 
   # oak.visualize(left)
   oak.start(blocking=True)

And when I run I get two separate issues:

alansrobotlab@alfie:~/Documents/PlatformIO/Projects/alfie$ /bin/python /home/alansrobotlab/Documents/PlatformIO/Projects/alfie/startoak.py
/home/alansrobotlab/.local/lib/python3.10/site-packages/depthai_sdk/oak_camera.py:237: UsbWarning: 
  Device connected in USB2 mode! This might cause some issues. 
  In such case, please try using a (different) USB3 cable, 
  or force USB2 mode 'with OakCamera(usbSpeed=depthai.UsbSpeed.HIGH)'
warnings.warn("Device connected in USB2 mode! This might cause some issues. "
Closing OAK camera
Traceback (most recent call last):
File "/home/alansrobotlab/Documents/PlatformIO/Projects/alfie/startoak.py", line 12, in <module>
oak.ros_stream([left, right, color, imu]
AttributeError: 'OakCamera' object has no attribute 'ros_stream'

First the description of how to bring up the camera in USB2 mode. The message in the output calls the parameter usbSpeed but it's not recognized only usb_speed is valid. Anyhoo it doesn't honor the flag, gives a warning then closes the camera.

The second problem is that there's no "ros_stream" method for the OakCamera object. This is in ubuntu 22.04 humble with 2.90 packages.

What am I doing wrong?

Alan

    alansrobotlab AttributeError: 'OakCamera' object has no attribute 'ros_stream'

    There should be --> luxonis/depthaiblob/main/depthai_sdk/src/depthai_sdk/integrations/ros/ros2_streaming.py
    Make sure you are using the latest version.

    alansrobotlab First the description of how to bring up the camera in USB2 mode. The message in the output calls the parameter usbSpeed but it's not recognized only usb_speed is valid. Anyhoo it doesn't honor the flag, gives a warning then closes the camera.

    This signifies the USB cable/or USB port on your PC only supports 2.0 speeds, which is much slower than 3.2.

    Thanks,
    Jaka

    ooh, ok. my installed version of depthai_sdk was actually 1.9 something.

    I retraced all my steps starting with pip install depthai-sdk and saw the older version.

    I removed the older version then reinstalled. Thanks!

    Alan