Basic Setup

For integrating in ROS2 ecosystem, we have dedicated DepthAI ROS Package for it. For quick prototyping and testing, we can use DepthAI Pip Package.

Install Commands

# Create virtual environment
python -m venv .env

# Activate virtual environment
source .env/bin/activate

pip install depthai

Using packages from virtual environment doesnot integrate with ROS2 ecosystem. We had install packages in the home directory.

Useful Packages

For viewing frames live from a python script, you need opencv.

pip install opencv-python

Read/Write Access through USB

Error: [depthai] [warning] Insufficient permissions to communicate with X_LINK_UNBOOTED device with name "1.2". Make sure udev rules are set

# Setup proper udev rules
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules
sudo udevadm control --reload-rules && sudo udevadm trigger

Debugging

For getting debug messages in console from python script, we need to set debug message level:

  1. critical

  2. error

  3. warn

  4. info

  5. debug

  6. trace

Official Debug Guide Documentation: For details

You need to set DEPTHAI_LEVEL environment variable to one of above values.

Temporary setting

DEPTHAI_LEVEL=debug python3 script.py

Permanent setting

# Put Environment Variable in .bashrc
echo "export DEPTHAI_LEVEL=debug" >> ~/.bashrc
python3 script.py