Skip to content

About

ROS 2 driver for the Luxonis OAK-D and OAK-D Lite: independent color, depth, point cloud, stereo, disparity and IMU topics, one YAML config, RViz setup and a printable stand with exact TFs.

Topics

Resources

Stars

12 stars

Watchers

2 watching

Forks

Latest commit

 

History

25 Commits

Folders and files

Repository files navigation

OAK-D / OAK-D Lite driver for ROS 2

distro ROS 2 jazzy

ROS 2 node and launch file for the Luxonis OAK-D and OAK-D Lite cameras. Each stream (color, depth, point cloud, raw and rectified stereo, disparity, IMU) is independent and published in its own topic, and only the streams you enable are captured. All the parameters are in one YAML file. It also includes the camera TF frames, an RViz configuration, an optional IMU orientation filter and a printable stand for the OAK-D Lite with exact TFs.

Tested with ROS 2 Jazzy on Ubuntu 24.04 and an OAK-D Lite.

Installation

  1. Execute the below command to install the required dependencies:

    sudo wget -qO- https://docs.luxonis.com/install_dependencies.sh | bash

    Please refer to Installation documentation if any issues occur.

  2. Clone the repository and add it to your ROS 2 workspace:

    git clone https://github.com/jmguerreroh/oak_d_camera.git
  3. Install dependencies (this also installs depthai-ros, depth_image_proc and imu_filter_madgwick):

    rosdep install --from-paths src --ignore-src -r -y
  4. Build the workspace (with only ROS 2 Jazzy sourced):

    colcon build --symlink-install

Usage

To launch the OAK-D camera node with the parameters of the configuration file:

ros2 launch oak_d_camera camera.launch.py

Configuration file

All the parameters (streams, resolution, FPS, stereo settings, TF frames, stand...) are in config/camera_params.yaml, with a comment for each one. It is the only place with default values: edit it to change the default behaviour. With colcon build --symlink-install the changes apply without rebuilding.

Any parameter can also be overridden for a single run from the command line, which takes priority over the file:

ros2 launch oak_d_camera camera.launch.py color_resolution:=360p use_raw:=true

or use your own copy of the file (it must contain every parameter):

cp $(ros2 pkg prefix oak_d_camera)/share/oak_d_camera/config/camera_params.yaml my_params.yaml
ros2 launch oak_d_camera camera.launch.py params_file:=$PWD/my_params.yaml

The node can also be run directly, but it needs the file: ros2 run oak_d_camera camera_node --ros-args --params-file my_params.yaml (the point cloud is generated by the launch file, not by the node).

Invalid values or combinations stop the launch with a message that says what is wrong (they are never silently corrected).

Topics

Every topic is under the namespace parameter (oak in the file as delivered), shown here as /oak/.... Boolean values accept true/True/1.

Parameter Topics
use_color /oak/color/image, /oak/color/camera_info
use_depth /oak/stereo/depth (16UC1, millimeters), /oak/stereo/camera_info
use_pointcloud /oak/stereo/points (needs use_color and use_depth)
use_raw /oak/left/image, /oak/right/image (unrectified)
use_rect /oak/left_rect/image, /oak/right_rect/image (rectified)
use_disparity /oak/stereo/disparity (stereo_msgs/DisparityImage), /oak/disparity/camera_info
use_imu /oak/imu (raw accelerometer and gyroscope)
use_imu_orientation /oak/imu/data (the IMU with orientation, needs use_imu)

/tf, /tf_static and /robot_description are not namespaced.

Images are published with a Reliable QoS, so any standard subscriber works. If you subscribe with a Best Effort profile (e.g. qos_profile_sensor_data) large images (1080p) may lose frames because DDS drops incomplete fragmented messages. Use Reliable or a smaller color_resolution.

Viewing the streams

  • The RViz opened by the launch file shows the color image, the depth image and the point cloud. Edit rviz/camera.rviz to change it.
  • Any other image: ros2 run rqt_image_view rqt_image_view.
  • stereo/disparity is not a sensor_msgs/Image, so RViz and rqt_image_view cannot show it: ros2 run image_view disparity_view --ros-args -r image:=/oak/stereo/disparity.
  • If you open your own RViz, use the fixed frame oak_parent_frame (the parent_frame parameter) and the topics with their namespace.

Parameters

Image size and rate

  • color_resolution: 1080p, 720p, 540p or 360p. Smaller is faster. At 1080p the point cloud only reaches about 4 Hz; at 720p or less all streams run at 25-30 Hz.
  • fps: frames per second of all the cameras (1-60).

Depth and disparity

The depth is aligned to the color camera when use_color is enabled: it has the same frame (<tf_prefix>_rgb_camera_optical_frame), size (color_resolution) and camera_info as color/image, so depth, point cloud and color match pixel by pixel. Without use_color it is aligned to the right camera (640x480, frame <tf_prefix>_right_camera_optical_frame).

  • lr_check: left-right consistency check.
  • extended_disparity: shorter minimum distance. Cannot be used with subpixel.
  • subpixel: better accuracy at long range. Cannot be used with extended_disparity.
  • confidence_threshold and lr_check_threshold (0-255).
  • fix_disparity: only affects stereo/disparity. With false the message is the unmodified output of depthai_bridge, whose focal length, baseline and disparity scale do not match the calibration of the camera. With true the focal length, baseline and disparity limits come from the calibration of the camera, so depth = f * t / disparity matches stereo/depth.

See the StereoDepth documentation for details.

IMU

The IMU of the OAK-D and OAK-D Lite (BMI270) only sends raw accelerometer and gyroscope data, so imu has no orientation and the IMU display of RViz does not rotate. With use_imu_orientation the launch file also starts a Madgwick filter (imu_filter_madgwick) on the computer that publishes imu/data with the orientation. The orientation is relative to gravity: the yaw is not absolute because there is no magnetometer. In RViz, add an Imu display on /oak/imu/data with the fixed frame oak_parent_frame.

Axes. Following REP 145 the IMU is published as the sensor reports it, in <tf_prefix>_imu_frame, and the URDF says how it is mounted in the camera. On the OAK-D Lite the axes of the sensor are x right, y up, z backwards (with the camera flat the accelerometer reads +9.8 on y), not the ROS body axes (x forward, y left, z up). Use the TF oak_base_frame -> oak_imu_frame to move the data to the body axes.

Frames and placement

  • tf_prefix: prefix of the camera frames. The frame names in this document use the prefix oak.
  • parent_frame: frame the camera (or its stand) is placed in, e.g. your robot base or the table. base_frame: base frame of the camera.
  • cam_pos_x, cam_pos_y, cam_pos_z (m), cam_roll, cam_pitch, cam_yaw (rad): pose of the camera (or of the stand if use_stand) in parent_frame.
  • camera_model: OAK-D or OAK-D-LITE.
  • use_stand: mount the camera on the printable stand (OAK-D Lite only, see Printable stand). stand_tilt: version of the stand, 15 (camera tilted 15 degrees down) or 0 (vertical).

Launch options

  • namespace: namespace of all the topics and nodes. Use namespace:=/ (or an empty value in your YAML) to publish in the root.
  • use_rviz: open RViz.
  • respawn: restart the camera node if the camera is lost.

Troubleshooting

  • No OAK camera found: check the cable and port, and that the Luxonis udev rules are installed (see Installation).
  • The camera is in use by another process: close the other camera_node or DepthAI program.
  • Connection with the camera lost: the camera was unplugged, crashed or stopped sending frames for 5 s. The node exits with code 2. Launch with respawn:=true to restart it automatically.
  • Dropped frames or low FPS: connect to USB 3 and disable the streams you do not need.
  • Nothing appears in RViz: check that the fixed frame is oak_parent_frame and that each display uses the topic with its namespace (/oak/color/image). Changing cam_pos_* only moves the camera with respect to parent_frame, so it is not visible if the fixed frame is the camera itself.
  • The build fails with Unknown CMake command "ament_target_dependencies": the workspace was built with ROS Rolling loaded. This package needs Jazzy: use a terminal with only /opt/ros/jazzy sourced and delete build/ and install/ before building again.

Printable stand (OAK-D Lite)

There are two versions of the stand, to print in PLA (99 x 110 mm base, no supports needed, print it with the base on the bed). The camera is screwed to the back plate through its two VESA holes with 2 x M4x10 screws. The USB-C port and the tripod thread are on the bottom of the camera, so the camera floats about 55 mm above the table to leave room for the plug and the cable.

stand_tilt STL Camera
15 (default) meshes/oak_d_lite_stand_tilt15.stl (91 mm high) tilted 15 degrees towards the table
0 meshes/oak_d_lite_stand_tilt0.stl (86 mm high) looks horizontally; the plate is behind the origin, so the hole is visible from above
ros2 launch oak_d_camera camera.launch.py use_stand:=true stand_tilt:=0

The camera frames then hang from the stand: oak_parent_frame (parent_frame) -> oak_stand_base -> oak_mount -> oak_base_frame -> oak_rgb_camera_optical_frame, ...

  • oak_stand_base is on the table plane (z = 0). x points forward (where the camera looks), y to the left, z up (the vertical).
  • Its origin is the 3 mm through hole in the center of the base. To find the point of the table that is the origin, look through the hole or mark it with a pencil (with stand_tilt:=15 tilted forward, because the back plate is above it). Two shallow grooves on the top face also show the axes: one pointing forward ends in the letter X, and one along y has the letter Y at its +y (left) end.
  • The pose of the camera in oak_stand_base is already in the URDF (from the geometry of the stand and the official Luxonis CAD).
  • Use cam_pos_x/y/z and cam_yaw to say where the stand is placed in parent_frame (e.g. in your robot's base or in a table frame).

Depth, point cloud and color/image are all in oak_rgb_camera_optical_frame, so a pixel and a point of the table can be converted with the camera intrinsics (color/camera_info) and one TF lookup between oak_stand_base and oak_rgb_camera_optical_frame.

Optional: position cross. meshes/oak_d_lite_stand_locator.stl is a cross (140 x 140 mm, print it flat) that marks the origin of oak_stand_base on the table. Stick it to the table (e.g. with double-sided tape) and put the stand on top: the arms fit into two slots under the base and the central pin into the hole, so the stand is centered and not rotated. The slots have 0.2 mm of clearance per side, adjust them if your printer needs more. With the cross in place the hole is filled by the pin, so take the cross off to mark the point with a pencil.

Accuracy. The camera pose comes from the CAD, not from a measurement of your printed stand: the print tolerance (PLA, about 0.2-0.3 mm) and the exact position of the lens inside the housing (a few mm along the optical axis) are not included. Check it with any object of known position on the table and correct the offsets in urdf/oak_d_lite_stand.urdf.xacro if you need more accuracy.

About

This project was made by José Miguel Guerrero, Associate Professor at Universidad Rey Juan Carlos.

Copyright © 2024-2026.

Twitter

License

This work is licensed under the terms of the MIT license.

License: MIT

About

ROS 2 driver for the Luxonis OAK-D and OAK-D Lite: independent color, depth, point cloud, stereo, disparity and IMU topics, one YAML config, RViz setup and a printable stand with exact TFs.

Topics

Resources

Stars

12 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages