Adding UDEV Rules for Luxonis OAK-D Depth Camera to TurtleBot4 Lite

The TurtleBot4 is a very interesting platform, complete with LIDAR for Nav and an OAK-D Depth Camera. By default, the LIDAR is actually sufficient for the robot to perform it’s navigation tasks, and so the OAK-D is not active in the standard launch profile.

I wanted to do some experiments with the OAK-D, but when I went to launch the OAK-D node, I found that the TurtleBot4 could not actually find the OAK-D device that was plugged in via USB.

It’s relatively straightforward to remedy this problem, so I wanted to document it in case anyone else runs into the same issue and needs a quick fix.

Bringing up the OAK-D Camera Node on the TurtleBot4

The complete description of how to launch the OAK-D camera and how the library is set up is available in the official TurtleBot4 Documentation:

However, when I ran it on my box stock TurtleBot4 Lite, I got the following error:

ubuntu@ubuntu:~/depthai$ ros2 launch turtlebot4_bringup

[INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2022-11-20-18-59-55-548555-ubuntu-2641
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [rgb_stereo_node-1]: process started with pid [2643]
[rgb_stereo_node-1] [2022-11-20 18:59:59.901] [warning] Insufficient permissions to communicate with X_LINK_BOOTED device having name "2.1". Make sure udev rules are set
[rgb_stereo_node-1] [2022-11-20 19:00:00.134] [warning] Insufficient permissions to communicate with X_LINK_BOOTED device having name "2.1". Make sure udev rules are set
[rgb_stereo_node-1] terminate called after throwing an instance of 'std::runtime_error'
[rgb_stereo_node-1]   what():  No available devices
[ERROR] [rgb_stereo_node-1]: process has died [pid 2643, exit code -6, cmd '/opt/ros/galactic/lib/depthai_examples/rgb_stereo_node --ros-args --params-file /tmp/launch_params_8jszvnq3 --params-file /tmp/launch_params_5ck5axoq --params-file /tmp/launch_params_roc_w0ra --params-file /tmp/launch_params_tzwortpt --params-file /tmp/launch_params_t2wn8ynb --params-file /tmp/launch_params_psp8218b --params-file /tmp/launch_params_hrmdqvdy --params-file /tmp/launch_params_qnfys6pj --params-file /tmp/launch_params_2nk6jor6 --params-file /tmp/launch_params_vni5pwn_ --params-file /tmp/launch_params_077v8juj --params-file /tmp/launch_params_1iwjvfmv --params-file /tmp/launch_params_9sp8t9ka --params-file /tmp/launch_params_7_yq26z5'].

So, not exactly what we had hoped for – the scripts could not access the device.

How to Install UDEV Rules for OAK-D Camera on Turtlebot4

I did a bit of a longer tour, installing the DepthAI Demo Scripts by following their tutorial found here: because I was kind of interested in their tools and SDK. This is a worthwhile journey if you wish to learn more about the OAK-D and DepthAI platform. However, it’s not strictly necessary in order to remedy the problem.

To create UDEV rules for the OAK-D camera, you run the following commands in the Linux terminal of your TurtleBot4:

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

Following that, you can either reboot the Pi, or plug and unplug the USB cable from the bottom of the camera to restart it.

Did it Work?

Once you’ve restarted the machine (or plugged and unplugged the camera), you should be able to see the camera in your usb device list:

ubuntu@ubuntu:~/depthai$ lsusb

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
Bus 001 Device 005: ID 03e7:2485 Intel Movidius MyriadX
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

If that’s the case, then you should be all set to run with either the DepthAI demo code or TurtleBot4 ROS Nodes for the OAKD Camera. Have fun!

Leave a Reply

Your email address will not be published. Required fields are marked *