-
Notifications
You must be signed in to change notification settings - Fork 88
Add ROS2 Jazzy support #332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ros2
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # ROS 2 OpenVINO Toolkit Environment (master f1b1ca4d914186a1881b87f103be9c6e910c9d80) | ||
|
|
||
| FROM osrf/ros:jazzy-desktop | ||
|
|
||
| # Set non-interactive mode for APT | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| # setting proxy env --option | ||
| # If needed, enable the below ENV setting by correct proxies. | ||
| # ENV http_proxy=your_proxy | ||
| # ENV https_proxy=your_proxy | ||
|
|
||
| # Maintainer information | ||
| LABEL maintainer="Jayabalaji Sathiyamoorthi <[email protected]>" | ||
|
|
||
| SHELL ["/bin/bash", "-c"] | ||
|
|
||
| # Install dependencies, OpenVINO, and librealsense2 | ||
| RUN apt update && \ | ||
| apt install -y --no-install-recommends \ | ||
| curl wget gnupg2 lsb-release nano software-properties-common \ | ||
| apt-transport-https libyaml-cpp-dev ros-jazzy-libyaml-vendor \ | ||
| libssl-dev libusb-1.0-0-dev libudev-dev pkg-config \ | ||
| libgtk-3-dev git cmake build-essential nano && \ | ||
| # Add OpenVINO GPG key and repository | ||
| wget -qO- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor -o /etc/apt/trusted.gpg.d/intel.gpg && \ | ||
| echo "deb https://apt.repos.intel.com/openvino ubuntu24 main" | tee /etc/apt/sources.list.d/intel-openvino.list && \ | ||
| apt update && \ | ||
| apt-get install -y openvino-2025.2.0 && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Build librealsense2 | ||
| WORKDIR /root/ | ||
| RUN git clone --branch v2.55.1 --single-branch https://github.com/IntelRealSense/librealsense.git && \ | ||
| cd librealsense && \ | ||
| mkdir build && \ | ||
| cd build && \ | ||
| cmake ../ && \ | ||
| make uninstall && make clean && make -j7 && make install && \ | ||
| rm -rf /root/librealsense | ||
|
|
||
| # build ros2 openvino toolkit | ||
| WORKDIR /root | ||
| RUN mkdir -p ros2_ws/src | ||
| WORKDIR /root/ros2_ws/src | ||
| RUN git clone https://github.com/intel/ros2_object_msgs.git | ||
| #change the branch before merge | ||
| RUN git clone -b ros2_jazzy https://github.com/jb-balaji/ros2_openvino_toolkit.git | ||
| RUN git clone -b humble https://github.com/ros-perception/vision_opencv.git | ||
| WORKDIR /root/ros2_ws | ||
| RUN source /opt/ros/jazzy/setup.bash \ | ||
| && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| # ROS2 OpenVINO Toolkit Docker Image | ||
|
|
||
| This repository contains a Dockerfile for building a Docker image with ROS2 and the OpenVINO toolkit. The image is based on the `osrf/ros:jazzy-desktop` base image and includes additional tools and libraries for working with OpenVINO and librealsense. | ||
|
|
||
| ## Features | ||
|
|
||
| - ROS2 Jazzy Desktop | ||
| - OpenVINO Toolkit version 2025.2.0 | ||
| - librealsense2 | ||
| - User setup with `sudo` privileges | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Docker installed on your system | ||
| - Network connection & correct proxy settings for downloading base images and dependencies | ||
|
|
||
| ## Building the Docker Image | ||
|
|
||
| To build the Docker image, use the following command. The default OpenVINO version is `2025.2.0`. | ||
|
|
||
| ```bash | ||
| docker build -t ros2_openvino_image . | ||
|
|
||
| ``` | ||
|
|
||
| if you are behind a proxy server use the following command, | ||
|
|
||
| ```bash | ||
| docker build --build-arg "HTTP_PROXY=http://<your-proxy.com>:<your-port>" -t ros2_openvino_image . | ||
|
|
||
| ``` | ||
| ## Download the Models from OpenVINO Model Zoo (OMZ) | ||
| OMZ tools are provided for downloading and converting OMZ models in OpenVINO 202x versions.</br> | ||
| Refer to: [OMZ-tool_guide](https://pypi.org/project/openvino-dev/) | ||
| Refer to: [OMZ Models](https://github.com/openvinotoolkit/open_model_zoo/tree/2024.6.0/models) | ||
|
|
||
| ```bash | ||
| omz_downloader --print_all | ||
| ``` | ||
|
|
||
| * Download the optimized Intermediate Representation (IR) of model (execute once), for example: | ||
|
|
||
| ```bash | ||
| omz_downloader --list <ros2-ws>/src/ros2_openvino_toolkit/data/model_list/download_model.lst -o /opt/openvino_toolkit/models/ | ||
| ``` | ||
|
|
||
| ## Running the Docker Container | ||
|
|
||
| To run the Docker container, use the following command: | ||
|
|
||
| ```bash | ||
| docker run -it --rm --name ros2_openvino_container ros2_openvino_image | ||
|
|
||
| ``` | ||
|
|
||
| To run the Docker container with GUI support, use the following command: | ||
|
|
||
| ```bash | ||
| docker run -itd -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev:/dev --privileged=true --name ros2_openvino_container ros2_openvino_image | ||
|
|
||
| ``` | ||
|
|
||
| To run the Docker container with the volumes containing models and images, use the following command: | ||
|
|
||
| ```bash | ||
| docker run -itd -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev:/dev -v /opt:/opt -v /data:/data --privileged=true --name ros2_openvino_container ros2_openvino_image | ||
| ``` | ||
|
|
||
| #### Explanation of Options | ||
|
|
||
| * -itd: Combines three flags: | ||
|
|
||
| -i: Runs the container in interactive mode, keeping the standard input open. | ||
| -t: Allocates a pseudo-TTY, which is useful for interactive applications. | ||
| -d: Runs the container in detached mode, allowing it to run in the background. | ||
|
|
||
| * -e DISPLAY=$DISPLAY | ||
|
|
||
| ###### Sets the DISPLAY environment variable inside the container to match the host's DISPLAY variable. This is necessary for GUI applications to display on the host's screen. | ||
|
|
||
| * -v /tmp/.X11-unix:/tmp/.X11-unix | ||
|
|
||
| ###### Mounts the X11 Unix socket from the host to the container. This is required for GUI applications to communicate with the X server on the host. | ||
|
|
||
| * -v /dev:/dev | ||
|
|
||
| ###### Mounts the /dev directory from the host to the container, allowing the container to access hardware devices. This is often necessary for applications that interact with hardware, such as cameras or GPUs. | ||
|
|
||
| * -v /opt:/opt | ||
|
|
||
| ###### Mounts the /opt directory from the host to the container, allowing the container to access the models installed from OpenVINO Model Zoo. | ||
|
|
||
| * -v /data:/data | ||
|
|
||
| ###### Mounts the /data directory from the host to the container, that contains the images and labels. Replace this with the folder of your images and labels. | ||
|
|
||
| * --privileged=true | ||
|
|
||
| ###### Grants the container extended privileges, allowing it to access all devices on the host and perform operations that are typically restricted. This is necessary for certain applications that require direct hardware access. | ||
|
|
||
| * --name ros2_openvino_container | ||
|
|
||
| ###### Assigns the name ros2_openvino_container to the running container, making it easier to reference in subsequent Docker commands. | ||
|
|
||
| * ros2_openvino_image | ||
|
|
||
| ###### Specifies the name of the Docker image to run. Replace this with the actual name of your built image if it differs. | ||
|
|
||
| ### Notes | ||
|
|
||
| * Ensure that your host's X11 server is configured to allow connections from the Docker container. You may need to run xhost +local:docker on the host to permit this. | ||
|
|
||
| * The --privileged flag provides the container with elevated permissions, which can pose security risks. Use it only when necessary and understand the implications. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,8 +15,8 @@ LABEL maintainer="Jayabalaji Sathiyamoorthi <[email protected] | |
|
|
||
| SHELL ["/bin/bash", "-c"] | ||
|
|
||
| # Define build argument for OpenVINO version (2025.0.0 , 2024.6.0, 2023.3.0) | ||
| ARG OPENVINO_VERSION=2025.0.0 | ||
| # Define build argument for OpenVINO version (2025.2.0 , 2024.6.0, 2023.3.0) | ||
| ARG OPENVINO_VERSION=2025.2.0 | ||
|
|
||
| # Extract the major version from the full version string | ||
| ENV OPENVINO_MAJOR_VERSION=${OPENVINO_VERSION%%.*} | ||
|
|
@@ -26,7 +26,11 @@ ENV OPENVINO_MAJOR_VERSION=${OPENVINO_VERSION%%.*} | |
| RUN apt update && \ | ||
| apt install -y --no-install-recommends wget curl gnupg2 lsb-release software-properties-common apt-transport-https nano && \ | ||
| wget -qO- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor -o /etc/apt/trusted.gpg.d/intel.gpg && \ | ||
| echo "deb https://apt.repos.intel.com/openvino/${OPENVINO_MAJOR_VERSION} ubuntu22 main" | tee /etc/apt/sources.list.d/intel-openvino-${OPENVINO_MAJOR_VERSION}.list && \ | ||
| if [ "$OPENVINO_MAJOR_VERSION" = "2025" ]; then \ | ||
| echo "deb https://apt.repos.intel.com/openvino ubuntu22 main" > /etc/apt/sources.list.d/intel-openvino.list; \ | ||
| else \ | ||
| echo "deb https://apt.repos.intel.com/openvino/${OPENVINO_MAJOR_VERSION} ubuntu22 main" > /etc/apt/sources.list.d/intel-openvino-${OPENVINO_MAJOR_VERSION}.list; \ | ||
| fi && \ | ||
| apt update && \ | ||
| apt-get install -y openvino-${OPENVINO_VERSION} && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ add_library(${PROJECT_NAME} SHARED | |
| ament_target_dependencies(${PROJECT_NAME} | ||
| "yaml_cpp_vendor" | ||
| ) | ||
| target_link_libraries(${PROJECT_NAME} /usr/lib/x86_64-linux-gnu/libyaml-cpp.so) | ||
|
||
|
|
||
| if(BUILD_TESTING) | ||
| find_package(ament_lint_auto REQUIRED) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||
| Pipelines: | ||||||
| - name: people | ||||||
| inputs: [Image] | ||||||
| input_path: to/be/set/image_path | ||||||
| input_path: /home/skl/catkin_ws/src/ros2_openvino_toolkit/data/images/sample_faces.jpg | ||||||
|
||||||
| input_path: /home/skl/catkin_ws/src/ros2_openvino_toolkit/data/images/sample_faces.jpg | |
| input_path: ${HOME}/catkin_ws/src/ros2_openvino_toolkit/data/images/sample_faces.jpg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a personal GitHub repository 'jb-balaji/ros2_openvino_toolkit' instead of the official Intel repository may introduce maintenance and reliability concerns for production use.