Hi and welcome to the main depthai-ros respository!
Supported ROS versions:
- Noetic
- Galactic
- Humble
For development check out respective git branches.
Add USB rules to your system
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
Install depthai-ros. (Available for Noetic, foxy, galactic and humble)
sudo apt install ros-<distro>-depthai-ros
You can additionally build and run docker images on your local machine. To do that, add USB rules as in above step, clone the repository and inside it run (it matters on which branch you are on):
docker build --build-arg USE_RVIZ=1 -t depthai-ros .
If you find out that you run out of RAM during building, you can also set BUILD_SEQUENTIAL=1
to build packages one at a time, it should take longer, but use less RAM.
RUN_RVIZ
arg means rviz will be installed inside docker. If you want to run it you need to also execute following command (you'll have to do it again after restarting your PC):
xhost +local:docker
Then you can run your image in following way:
docker run -it -v /dev/:/dev/ --privileged -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix depthai-ros
will run an interactive docker session.
docker run -it -v /dev/:/dev/ --privileged -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix depthai_ros roslaunch depthai_examples stereo_inertial_node.launch
Will only start stereo_inertial_node
launch file (you can try different commands).
docker run -it -v /dev/:/dev/ --privileged -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix depthai_ros roslaunch depthai_examples stereo_inertial_node.launch.py
The following script will install depthai-core and update usb rules and install depthai devices
sudo wget -qO- https://raw.githubusercontent.com/luxonis/depthai-ros/main/install_dependencies.sh | sudo bash
if you don't have opencv installed then try sudo apt install libopencv-dev
if you don't have rosdep installed and not initialized please execute the following steps:
sudo apt install python-rosdep
(melodic) orsudo apt install python3-rosdep
sudo rosdep init
rosdep update
The following setup procedure assumes you have cmake version >= 3.10.2 and OpenCV version >= 4.0.0. We selected dai_ws
as the name for a new folder, as it will be our depthai ros workspace.
mkdir -p dai_ws/src
cd dai_ws/src
git clone https://github.com/luxonis/depthai-ros.git
cd ../..
rosdep install --from-paths src --ignore-src -r -y
source /opt/ros/<ros-distro>/setup.bash
catkin_make
(For ROS1)colcon build
(for ROS2)source devel/setup.bash
(For ROS1) &source install/setup.bash
(for ROS2)
cd dai_ws
(Our workspace)source devel/setup.bash
roslaunch depthai_examples stereo_inertial_node.launch
- example node For more examples please check the launch files.
cd dai_ws
(Our workspace)source install/setup.bash
ros2 launch depthai_examples stereo_inertial_node.launch.py
- example node For more examples please check the launch files.
roslaunch depthai_examples mobile_publisher.launch camera_model:=OAK-D
roslaunch depthai_examples mobile_publisher.launch camera_model:=OAK-D-LITE
roslaunch depthai_examples mobile_publisher.launch | rqt_image_view -t /mobilenet_publisher/color/image
ros2 launch depthai_examples mobile_publisher.launch.py camera_model:=OAK-D
ros2 launch depthai_examples mobile_publisher.launch.py camera_model:=OAK-D-LITE
- ImageConverter - Tested using
roslaunch depthai_examples stereo_inertial_node.launch
&&roslaunch depthai_examples rgb_publisher.launch
' - ImgDetectionCnverter - tested using
roslaunch depthai_examples mobile_publisher.launch
- SpatialImgDetectionConverter - Ntested using
roslaunch depthai_examples stereo_inertial_node.launch
If there a standard Message or usecase for which we have not provided a ros msg or converter feel free to create a issue or reach out to us on our discord community. We would be happy to add more.