|
| 1 | +# depthai-ros |
| 2 | +main branch supports ROS Melodic, ROS Noetic, ROS2 Foxy & Galactic. Might also work on kinetic too. |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +### Install from ros binaries |
| 7 | + |
| 8 | +Add USB rules to your system |
| 9 | +``` |
| 10 | +echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules |
| 11 | +sudo udevadm control --reload-rules && sudo udevadm trigger |
| 12 | +``` |
| 13 | +Install depthai-ros. (Available for Noetic, foxy, galactic and humble) |
| 14 | +`sudo apt install ros-<distro>-depthai-ros` |
| 15 | + |
| 16 | +## Install from source |
| 17 | + |
| 18 | +### Install dependencies |
| 19 | + |
| 20 | +The following script will install depthai-core and update usb rules and install depthai devices |
| 21 | + |
| 22 | +``` |
| 23 | +sudo wget -qO- https://raw.githubusercontent.com/luxonis/depthai-ros/main/install_dependencies.sh | sudo bash |
| 24 | +``` |
| 25 | +if you don't have opencv installed then try `sudo apt install libopencv-dev` |
| 26 | + |
| 27 | + |
| 28 | +if you don't have rosdep installed and not initialized please execute the following steps: |
| 29 | +1. `sudo apt install python-rosdep`(melodic) or `sudo apt install python3-rosdep` |
| 30 | +2. `sudo rosdep init` |
| 31 | +3. `rosdep update` |
| 32 | + |
| 33 | +### Setting up procedure |
| 34 | +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. |
| 35 | + |
| 36 | +1. `mkdir -p dai_ws/src` |
| 37 | +2. `cd dai_ws/src` |
| 38 | +3. `git clone https://github.com/luxonis/depthai-ros.git` |
| 39 | +4. `cd ../..` |
| 40 | +5. `rosdep install --from-paths src --ignore-src -r -y` |
| 41 | +6. `source /opt/ros/<ros-distro>/setup.bash` |
| 42 | +7. `catkin_make` (For ROS1) `colcon build` (for ROS2) |
| 43 | +8. `source devel/setup.bash` (For ROS1) & `source install/setup.bash` (for ROS2) |
| 44 | + |
| 45 | + |
| 46 | +<!-- |
| 47 | +7. `cd ~` |
| 48 | +8. `git clone https://github.com/luxonis/depthai-core.git --branch develop` |
| 49 | +9. `cd ~/depthai-core` |
| 50 | +10. `mkdir build` |
| 51 | +11. `cmake .. -D BUILD_SHARED_LIBS=ON` |
| 52 | +12. `cmake --build . --parallel --config Release --target install` |
| 53 | +13. `cd ~` |
| 54 | +14. `mkdir -p dai_ws/src` |
| 55 | +15. `cd dai_ws/src` |
| 56 | +16. `git clone https://github.com/luxonis/depthai-ros.git --branch noetic-devel` |
| 57 | +17. `git clone https://github.com/luxonis/depthai-ros-examples.git --branch noetic-devel` |
| 58 | +18. `git clone https://github.com/ros-perception/vision_msgs.git --branch noetic-devel` |
| 59 | +19. `cd ~/dai_ws` |
| 60 | +20. `source /opt/ros/<ros-distro>/setup.zsh` |
| 61 | +21. `catkin_make_isolated --cmake-args -D depthai_DIR=${depthai-core insall directory}/lib/cmake/depthai` --> |
| 62 | + |
| 63 | +<!-- 1. `cd ~` |
| 64 | +2. `git clone --recursive https://github.com/luxonis/depthai-core.git --branch develop` |
| 65 | +3. `cd ~/depthai-core` |
| 66 | +4. `mkdir build` |
| 67 | +5. `cd build` |
| 68 | +6. `cmake .. -DBUILD_SHARED_LIBS=ON` |
| 69 | +7. `cmake --build . --config Release --target install` |
| 70 | +8. `cd ~` |
| 71 | +9. `mkdir -p dai_ws/src` |
| 72 | +10. `cd dai_ws/src` |
| 73 | +11. `git clone https://github.com/luxonis/depthai-ros.git --branch noetic-devel` |
| 74 | +12. `git clone https://github.com/luxonis/depthai-ros-examples.git --branch noetic-devel` |
| 75 | +13. `git clone https://github.com/ros-perception/vision_msgs.git --branch noetic-devel` |
| 76 | +14. `cd ~/dai_ws` |
| 77 | +15. `source /opt/ros/<ros-distro>/setup.bash` or `source /opt/ros/<ros-distro>/setup.zsh` if using zsh instead of bash |
| 78 | +16. `catkin_make_isolated --cmake-args -Ddepthai_DIR=~/depthai-core/build/install/lib/cmake/depthai` (Melodic) |
| 79 | +17. `catkin_make_isolated --cmake-args -D depthai_DIR=~/depthai-core/build/install/lib/cmake/depthai` (Noetic) --> |
| 80 | + |
| 81 | +## Executing an example |
| 82 | + |
| 83 | +### ROS1 |
| 84 | +1. `cd dai_ws` (Our workspace) |
| 85 | +2. `source devel/setup.bash` |
| 86 | +3. `roslaunch depthai_examples stereo_inertial_node.launch` - example node |
| 87 | +For more examples please check the launch files. |
| 88 | + |
| 89 | +### ROS2 |
| 90 | +1. `cd dai_ws` (Our workspace) |
| 91 | +2. `source install/setup.bash` |
| 92 | +3. `ros2 launch depthai_examples stereo_inertial_node.launch.py` - example node |
| 93 | +For more examples please check the launch files. |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | +## Running Examples |
| 98 | + |
| 99 | +### Mobilenet Publisher: |
| 100 | +#### ROS1: |
| 101 | +##### OAK-D |
| 102 | +``` |
| 103 | +roslaunch depthai_examples mobile_publisher.launch camera_model:=OAK-D |
| 104 | +``` |
| 105 | +##### OAK-D-LITE |
| 106 | +``` |
| 107 | +roslaunch depthai_examples mobile_publisher.launch camera_model:=OAK-D-LITE |
| 108 | +``` |
| 109 | +##### With visualizer |
| 110 | +``` |
| 111 | +roslaunch depthai_examples mobile_publisher.launch | rqt_image_view -t /mobilenet_publisher/color/image |
| 112 | +``` |
| 113 | + |
| 114 | +#### ROS2: |
| 115 | + |
| 116 | +##### OAK-D |
| 117 | +``` |
| 118 | +ros2 launch depthai_examples mobile_publisher.launch.py camera_model:=OAK-D |
| 119 | +``` |
| 120 | + |
| 121 | +##### OAK-D-LITE |
| 122 | +``` |
| 123 | +ros2 launch depthai_examples mobile_publisher.launch.py camera_model:=OAK-D-LITE |
| 124 | +``` |
| 125 | + |
| 126 | + |
| 127 | +### Testing results |
| 128 | +- ImageConverter - Tested using `roslaunch depthai_examples stereo_inertial_node.launch` && `roslaunch depthai_examples rgb_publisher.launch`' |
| 129 | +- ImgDetectionCnverter - tested using `roslaunch depthai_examples mobile_publisher.launch` |
| 130 | +- SpatialImgDetectionConverter - Ntested using `roslaunch depthai_examples stereo_inertial_node.launch` |
| 131 | + |
| 132 | + |
| 133 | +### Users can write Custom converters and plug them in for bridge Publisher. |
| 134 | +If there a standard Message or usecase for which we have not provided a ros msg or |
| 135 | + converter feel free to create a issue or reach out to us on our discord community. We would be happy to add more. |
0 commit comments