From a6cc0c613629a8dabdd09374e44fad690158db31 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Thu, 26 Oct 2023 11:57:20 +0900 Subject: [PATCH 01/29] push anvil ros2 environment setup ansible script for testing on anvil --- ansible/roles/ros2/tasks/main.yaml | 522 +++++------------------------ 1 file changed, 88 insertions(+), 434 deletions(-) diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index bcf68f2..028be4f 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -1,460 +1,114 @@ +- name: Confirm locale + block: + - name: Generate locale files + ansible.builtin.command: + cmd: locale-gen en_US en_US.UTF-8 + - name: Update locale settings + ansible.builtin.command: + cmd: update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 + become: true + - name: Fix python interpreter version to 3 set_fact: - ansible_python_interpreter: /usr/bin/python3.6 + ansible_python_interpreter: /usr/bin/python3.8 -- name: Setup dependencies +- name: Prepare Jetson scripts + block: + - name: Define directory name + set_fact: + jetson_script_dir: "{{ ansible_env.HOME }}/jetson_scripts" + - name: Create directory + ansible.builtin.file: + path: "{{ jetson_script_dir }}" + state: directory + - name: Define file name + set_fact: + opencv_install_deps_script: "{{ jetson_script_dir }}/opencv_install_deps.sh" + - name: Define file name + set_fact: + opencv_install_script: "{{ jetson_script_dir }}/opencv_install.sh" + - name: Define file name + set_fact: + ros2_build_script: "{{ jetson_script_dir }}/ros2_build.sh" + - name: Download OpenCV deps script + ansible.builtin.get-uri: + url: https://raw.githubusercontent.com/dusty-nv/jetson-containers/L4T-R35.3.1/scripts/opencv_install_deps.sh + dest: "{{ opencv_install_deps_script }}" + - name: Download OpenCV install script + ansible.builtin.get-uri: + url: https://raw.githubusercontent.com/dusty-nv/jetson-containers/L4T-R35.3.1/scripts/opencv_install.sh + dest: "{{ opencv_install_script }}" + - name: Download ROS2 Humble install script + ansible.builtin.get-uri: + url: https://raw.githubusercontent.com/dusty-nv/jetson-containers/L4T-R35.3.1/scripts/ros2_build.sh + dest: "{{ ros2_build_script }}" + +- name: Install dependencies block: - - name: Apt install + - name: Install jetpack ansible.builtin.apt: name: - - curl - - wget - - gnupg - - gnupg2 - - lsb-release - - ca-certificates - - software-properties-common - - apt-transport-https + - nvidia-jetpack install_recommends: false update_cache: true - - name: Add ROS2 source list - shell: echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null - - name: Download gpg key - ansible.builtin.uri: - url: https://raw.githubusercontent.com/ros/rosdistro/master/ros.key - dest: /usr/share/keyrings/ros-archive-keyring.gpg - follow_redirects: all - - name: Apt install + - name: Install OpenCV deps + ansible.builtin.command: + cmd: "{{ opencv_install_deps_script }}" + - name: Install PCL deps ansible.builtin.apt: name: - - nvidia-jetpack - - build-essential - - cmake - - git - - libbullet-dev - - libpython3-dev - - python3-wheel - - python3-colcon-common-extensions - - python3-flake8 - - python3-pip - - python3-numpy - - python3-pytest-cov - - python3-rosdep - - python3-setuptools - - python3-vcstool - - python3-rosinstall-generator - - libasio-dev - - libtinyxml2-dev - - libcunit1-dev - libflann-dev + - libboost-filesystem-dev + - libboost-date-time-dev + - libboost-iostreams-dev install_recommends: false update_cache: true become: true -- name: add CUDA into PATH - set_fact: - environment: - PATH: "/usr/local/cuda/bin:{{ ansible_env.PATH }}" - -- name: Python parts - ansible.builtin.pip: - name: - - wheel - - argcomplete - - flake8-blind-except - - flake8-builtins - - flake8-class-newline - - flake8-comprehensions - - flake8-deprecated - - flake8-docstrings - - flake8-import-order - - flake8-quotes - - pytest-repeat - - pytest-rerunfailures - - pytest - - pybind11-global - - importlib_resources - extra_args: -U - become: true # need to sudo privilege to install packages globally - -- name: Prepare for dependencies' source build +- name: Install PCL block: - name: Define directory name set_fact: - source_build_dir: "{{ ansible_env.HOME }}/source_builds" - - name: Create directory + pcl_directory: "{{ ansible_env.HOME }}/pcl" + - name: Create build directory ansible.builtin.file: - path: "{{ source_build_dir }}" - state: directory - -- name: Check Boost build directory existence - ansible.builtin.stat: - path: "{{ source_build_dir }}/boost_1_74_0" - register: boost_build_dir_exist - -- name: Build and install Boost - block: - - name: "{{ block_name }}: Download and extract source" + path: pcl_directory + - name: Download and extract PCL 1.12.1 source ansible.builtin.unarchive: - src: https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.gz - dest: "{{ source_build_dir }}" + url: https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.12.1/source.tar.gz + dest: "{{ pcl_directory }}" remote_src: yes - - name: "{{ block_name }}: Build boost" - shell: ./bootstrap.sh --prefix=/usr/local --with-python=python3 && ./b2 install -j7 - args: - chdir: "{{ source_build_dir }}/boost_1_74_0" - become: true - vars: - block_name: Boost - when: not boost_build_dir_exist.stat.exists - -- name: Check PCL build directory existence - ansible.builtin.stat: - path: "{{ source_build_dir }}/pcl" - register: pcl_build_dir_exist - -- name: Build and install PCL - block: - - name: "{{ block_name }}: Download and extract source" - ansible.builtin.unarchive: - src: https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.12.1/source.tar.gz - dest: "{{ source_build_dir }}" - remote_src: yes - - set_fact: - pcl_build_dir: "{{ source_build_dir }}/pcl/build" - - name: "{{ block_name }}: Create build directory" + - name: Create build directory ansible.builtin.file: - path: "{{ pcl_build_dir }}" + path: "{{ pcl_directory }}/pcl/build" state: directory - - name: "{{ block_name }}: cmake" - shell: cmake -DCMAKE_BUILD_TYPE=Release .. - args: - chdir: "{{ pcl_build_dir }}" + - name: Run cmake + ansible.builtin.command: + cmd: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc .. + chdir: "{{ pcl_directory }}/pcl/build" environment: PATH: "/usr/local/cuda/bin:{{ ansible_env.PATH }}" - - name: "{{ block_name }}: build" - shell: make -j7 install - args: - chdir: "{{ pcl_build_dir }}" - become: true - vars: - block_name: PCL - when: not pcl_build_dir_exist.stat.exists - -- name: Check fmt build directory existence - ansible.builtin.stat: - path: "{{ source_build_dir }}/fmt-8.1.1" - register: fmt_build_dir_exist - -- name: Build and install fmt - block: - - name: "{{ block_name }}: Download and extract source" - ansible.builtin.unarchive: - src: https://github.com/fmtlib/fmt/archive/refs/tags/8.1.1.tar.gz - dest: "{{ source_build_dir }}" - remote_src: yes - - set_fact: - fmt_build_dir: "{{ source_build_dir }}/fmt-8.1.1/build" - - name: "{{ block_name }}: Create build directory" - ansible.builtin.file: - path: "{{ fmt_build_dir }}" - state: directory - - name: "{{ block_name }}: cmake" - shell: cmake -DBUILD_SHARED_LIBS=TRUE .. - args: - chdir: "{{ fmt_build_dir }}" - - name: "{{ block_name }}: build" - shell: make -j7 install - args: - chdir: "{{ fmt_build_dir }}" - become: true - vars: - block_name: fmt - when: not fmt_build_dir_exist.stat.exists - -- name: Check Range-v3 build directory existence - ansible.builtin.stat: - path: "{{ source_build_dir }}/range-v3" - register: range_v3_build_dir_exist - -- name: Build and install Range-v3 - block: - - name: "{{ block_name }}: Download source" - ansible.builtin.git: - repo: https://github.com/ericniebler/range-v3.git - dest: "{{ source_build_dir }}/range-v3" - depth: 1 - version: 0.11.0 - - set_fact: - range_v3_build_dir: "{{ source_build_dir }}/range-v3/build" - - name: "{{ block_name }}: Create build directory" - ansible.builtin.file: - path: "{{ range_v3_build_dir }}" - state: directory - - name: "{{ block_name }}: cmake" - shell: cmake -DCMAKE_BUILD_TYPE=Release -DRANGE_V3_TESTS=Off -DRANGE_V3_EXAMPLES=Off .. - args: - chdir: "{{ range_v3_build_dir }}" - - name: "{{ block_name }}: build" - shell: make -j7 install - args: - chdir: "{{ range_v3_build_dir }}" - become: true - vars: - block_name: Range-v3 - when: not range_v3_build_dir_exist.stat.exists - -- name: Check OpenCV build directory existence - ansible.builtin.stat: - path: "{{ source_build_dir }}/jetson-containers" - register: opencv_build_dir_exist - -- name: Build and install OpenCV - block: - - name: "{{ block_name }}: Download install script" - ansible.builtin.git: - repo: https://github.com/dusty-nv/jetson-containers.git - dest: "{{ source_build_dir }}/jetson-containers" - version: L4T-R35.1.0 - - name: "{{ block_name }}: install dependencies" - shell: ./opencv_install_deps.sh - args: - chdir: "{{ source_build_dir }}/jetson-containers/scripts" - become: true - - name: "{{ block_name }}: execute install script" - shell: ./opencv_install.sh https://nvidia.box.com/shared/static/5v89u6g5rb62fpz4lh0rz531ajo2t5ef.gz OpenCV-4.5.0-aarch64.tar.gz - args: - chdir: "{{ source_build_dir }}/jetson-containers/scripts" - become: true - vars: - block_name: OpenCV - when: not opencv_build_dir_exist.stat.exists - -- name: Check YAML build directory existence - ansible.builtin.stat: - path: "{{ source_build_dir }}/yaml-cpp" - register: yaml_cpp_build_dir_exist - -- name: Build and install YAML - block: - - name: "{{ block_name }}: Download source" - ansible.builtin.git: - repo: https://github.com/jbeder/yaml-cpp.git - dest: "{{ source_build_dir }}/yaml-cpp" - version: yaml-cpp-0.6.0 - - set_fact: - yaml_cpp_build_dir: "{{ source_build_dir }}/yaml-cpp/build" - - name: "{{ block_name }}: Create build directory" - ansible.builtin.file: - path: "{{ yaml_cpp_build_dir }}" - state: directory - - name: "{{ block_name }}: cmake" - shell: cmake -DBUILD_SHARED_LIBS=ON .. - args: - chdir: "{{ yaml_cpp_build_dir }}" - - name: "{{ block_name }}: build" - shell: make -j7 install - args: - chdir: "{{ yaml_cpp_build_dir }}" - become: true - vars: - block_name: YAML - when: not yaml_cpp_build_dir_exist.stat.exists - -- name: Upgrade CMake - block: - - name: "{{ block_name }}: update gpg key" - shell: wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null - # Follow drirections here: https://apt.kitware.com/ - - name: "{{ block_name }}: update repository info" - ansible.builtin.apt_repository: - repo: "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ {{ ansible_distribution_release }} main" - filename: kitware - - name: "{{ block_name }}: apt update" - ansible.builtin.apt: - update_cache: true - state: present - # - name: "{{ block_name }}: delete gpg key" - # ansible.builtin.file: - # path: /usr/share/keyrings/kitware-archive-keyring.gpg - # state: absent - - name: "{{ block_name }}: install kitware-arcyhive-keyring" - ansible.builtin.apt: - name: kitware-archive-keyring - - name: "{{ block_name }}: install newer cmake" - ansible.builtin.apt: - name: cmake - install_recommends: false - state: latest - become: true - vars: - block_name: Upgrade CMake - -- name: update GCC - block: - - name: "{{ block_name }}: update repository info" - ansible.builtin.apt_repository: - repo: ppa:ubuntu-toolchain-r/test - - name: "{{ block_name }}: install gcc11" - ansible.builtin.apt: - name: - - gcc-11 - - g++-11 - install_recommends: false - update_cache: true - - name: "{{ block_name }}: set gcc11 as default" - community.general.alternatives: - name: gcc - path: /usr/bin/gcc-11 - link: /usr/bin/gcc - state: selected - subcommands: - - name: g++ - path: /usr/bin/g++-11 - link: /usr/bin/g++ - - become: true - vars: - block_name: update GCC - -- name: Check ROS build directory existence - ansible.builtin.stat: - path: /opt/ros/{{ ros_distro }} - register: ros_build_dir_exist - -- name: Build ROS - block: - - set_fact: - ros_base_dir: "/opt/ros/{{ ros_distro }}" - - set_fact: - ros_src_dir: "{{ ros_base_dir }}/src" - - name: "{{ block_name }}: Create base directory" - ansible.builtin.file: - path: "{{ ros_base_dir }}" - state: directory - become: true - - name: "{{ block_name }}: Create soruce directory" - ansible.builtin.file: - path: "{{ ros_base_dir }}/src" - state: directory - become: true - - name: "{{ block_name }}: generate repository list using rosinstall_generator" - shell: "rosinstall_generator --deps --rosdistro {{ ros_distro }} ros_base launch_xml launch_yaml launch_testing launch_testing_ament_cmake demo_nodes_cpp demo_nodes_py example_interfaces camera_calibration_parsers camera_info_manager cv_bridge vision_opencv vision_msgs image_geometry image_pipeline image_transport compressed_image_transport compressed_depth_image_transport pcl_msgs perception_pcl --exclude rmw_connextdds > /tmp/ros2.{{ ros_distro }}.ros_base.rosinstall" - - name: "{{ block_name }}: copy repository list to target ddirectory" - ansible.builtin.copy: - src: "/tmp/ros2.{{ ros_distro }}.ros_base.rosinstall" - dest: "{{ ros_base_dir }}/ros2.{{ ros_distro }}.ros_base.rosinstall" - become: true - - name: "{{ block_name }}: clone all repositories via vcs" - shell: "vcs import src < ros2.{{ ros_distro }}.ros_base.rosinstall" - args: - chdir: "{{ ros_base_dir }}" - become: true - - name: "{{ block_name }}: remove ament_cmake for update" - ansible.builtin.file: - path: "{{ ros_src_dir }}/ament_cmake" - state: absent - become: true - - name: "{{ block_name }}: clone ament_cmake from git" - ansible.builtin.git: - repo: https://github.com/ament/ament_cmake - dest: "{{ ros_src_dir }}/ament_cmake" - version: humble - become: true - - name: "{{ block_name }}: clone diagnostics from git" - ansible.builtin.git: - repo: https://github.com/ros/diagnostics - dest: "{{ ros_src_dir }}/diagnostics" - version: ros2 - become: true - - name: "{{ block_name }}: remove rmw_connextdds entry from rmw_implementation" - ansible.builtin.replace: - path: "{{ ros_src_dir }}/rmw_implementation/package.xml" - regexp: .*rmw_connextdds.*\n - become: true - - stat: - path: /etc/ros/rosdep/sources.list.d/20-default.list - register: ros_sources_list_file - - name: "{{ block_name }}: rosdep init" - shell: rosdep init - become: true - when: not ros_sources_list_file.stat.exists - - name: "{{ block_name }}: rosdep update" - shell: rosdep update - become: true - - name: rosdep install - shell: rosdep install -y --ignore-src --from-paths src --rosdistro humble --skip-keys "libopencv-dev libopencv-contrib-dev libopencv-imgproc-dev python-opencv python3-opencv" - args: - chdir: "{{ ros_base_dir }}" - become: true - - name: "{{ block_name }}: correct file list under /var/lib/apt/lists" - ansible.builtin.find: - paths: /var/lib/apt/lists - hidden: true - recurse: true - file_type: any - register: file_under_var_lib_apt_lists - - name: "{{ block_name }}: remove all file under /var/lib/apt/lists" - ansible.builtin.file: - path: "{{ item.path }}" - state: absent - with_items: "{{ file_under_var_lib_apt_lists.files }}" - become: true - - name: "{{ block_name }}: apt-get clean" - ansible.builtin.apt: - clean: true - become: true - - name: "{{ block_name }}: apt-get purge pybind11-dev" - ansible.builtin.apt: - name: pybind11-dev - purge: true - become: true - - name: "{{ block_name }}: install pybind11-global" - ansible.builtin.pip: - name: pybind11-global - extra_args: -U - become: true - - name: "{{ block_name }}: apt-get purge libyaml-cpp-dev" - ansible.builtin.apt: - name: libyaml-cpp-dev - purge: true - become: true - - name: "{{ block_name }}: colcon build" - shell: colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=Release -DPython3_EXECUTABLE=$(which python3.6) - args: - chdir: "{{ ros_base_dir }}" - become: true - vars: - block_name: Build ROS - when: not ros_build_dir_exist.stat.exists - -- name: Downgrade GCC as version 11 is too high for old CUDA version that is used in L4T - block: - - name: "{{ block_name }}: install gcc-8" - ansible.builtin.apt: - name: - - gcc-8 - - g++-8 - update_cache: true - - name: "{{ block_name }}: set gcc-8 as default" - community.general.alternatives: - name: gcc - path: /usr/bin/gcc-8 - link: /usr/bin/gcc - state: selected - subcommands: - - name: g++ - path: /usr/bin/g++-8 - link: /usr/bin/g++ + - name: Install PCL + ansible.builtin.command: + cmd: make -j7 install + chdir: "{{ pcl_directory }}/pcl/build" + become: true + +- name: Install OpenCV + ansible.builtin.command: + cmd: "{{ opencv_install_script }} {{ opencv_url }} {{ opencv_deb }}" + +- name: Build ROS2 Humble + ansible.builtin.command: + cmd: "{{ ros2_build_script }}" + environment: + ROS_DISTRO: "{{ ros_distro }}" + ROS_PKG: ros_base + ROS_ROOT: "/opt/ros/{{ ros_distro }}" + +- name: Install extra edge-auto-jetson dependency + ansible.builtin.apt: + name: libtheora-dev + install_recommends: false + update_cache: true become: true - vars: - block_name: Downgrade gcc to 8 - -- name: Add sourcing command in user's bashrc - ansible.builtin.blockinfile: - path: "{{ ansible_env.HOME }}/.bashrc" - state: present - marker: "# {mark} ros2" - block: | - source {{ ros_base_dir }}/install/setup.bash - when: not ros_build_dir_exist.stat.exists From a8c9cdb91d77fb07f8b8a76e8cea3e0cc8b4c4a5 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Thu, 26 Oct 2023 14:06:18 +0900 Subject: [PATCH 02/29] fix typo --- ansible/roles/ros2/tasks/main.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index 028be4f..25de6c9 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -31,15 +31,15 @@ set_fact: ros2_build_script: "{{ jetson_script_dir }}/ros2_build.sh" - name: Download OpenCV deps script - ansible.builtin.get-uri: + ansible.builtin.get_url: url: https://raw.githubusercontent.com/dusty-nv/jetson-containers/L4T-R35.3.1/scripts/opencv_install_deps.sh dest: "{{ opencv_install_deps_script }}" - name: Download OpenCV install script - ansible.builtin.get-uri: + ansible.builtin.get_url: url: https://raw.githubusercontent.com/dusty-nv/jetson-containers/L4T-R35.3.1/scripts/opencv_install.sh dest: "{{ opencv_install_script }}" - name: Download ROS2 Humble install script - ansible.builtin.get-uri: + ansible.builtin.get_url: url: https://raw.githubusercontent.com/dusty-nv/jetson-containers/L4T-R35.3.1/scripts/ros2_build.sh dest: "{{ ros2_build_script }}" From 0b4aa148369f1e1fc5bcaa7895d826ec08199aef Mon Sep 17 00:00:00 2001 From: nvidia Date: Thu, 26 Oct 2023 15:01:10 +0900 Subject: [PATCH 03/29] make jetson-containers scripts executable --- ansible/roles/ros2/tasks/main.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index 25de6c9..b1d2159 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -34,14 +34,26 @@ ansible.builtin.get_url: url: https://raw.githubusercontent.com/dusty-nv/jetson-containers/L4T-R35.3.1/scripts/opencv_install_deps.sh dest: "{{ opencv_install_deps_script }}" + - name: Make OpenCV deps script executable + ansible.builtin.file: + dest: "{{ opencv_install_deps_script }}" + mode: u+x - name: Download OpenCV install script ansible.builtin.get_url: url: https://raw.githubusercontent.com/dusty-nv/jetson-containers/L4T-R35.3.1/scripts/opencv_install.sh dest: "{{ opencv_install_script }}" + - name: Make OpenCV install script executable + ansible.builtin.file: + dest: "{{ opencv_install_script }}" + mode: u+x - name: Download ROS2 Humble install script ansible.builtin.get_url: url: https://raw.githubusercontent.com/dusty-nv/jetson-containers/L4T-R35.3.1/scripts/ros2_build.sh dest: "{{ ros2_build_script }}" + - name: Make ROS2 Humble install script executable + ansible.builtin.file: + dest: "{{ ros2_build_script }}" + mode: u+x - name: Install dependencies block: From 907353398a1dabad867fc6caec4e065d4809a3be Mon Sep 17 00:00:00 2001 From: nvidia Date: Thu, 26 Oct 2023 15:51:33 +0900 Subject: [PATCH 04/29] small fixes --- ansible/roles/ros2/tasks/main.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index b1d2159..7cf1a4d 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -84,10 +84,11 @@ pcl_directory: "{{ ansible_env.HOME }}/pcl" - name: Create build directory ansible.builtin.file: - path: pcl_directory + path: "{{ pcl_directory }}" + state: directory - name: Download and extract PCL 1.12.1 source ansible.builtin.unarchive: - url: https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.12.1/source.tar.gz + src: https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.12.1/source.tar.gz dest: "{{ pcl_directory }}" remote_src: yes - name: Create build directory From 775897bd91d9acad132053b98ca857c886bd3102 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Thu, 26 Oct 2023 15:54:38 +0900 Subject: [PATCH 05/29] remove variables for opencv_url and opencv_deb --- ansible/roles/ros2/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index 7cf1a4d..60fcc84 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -109,7 +109,7 @@ - name: Install OpenCV ansible.builtin.command: - cmd: "{{ opencv_install_script }} {{ opencv_url }} {{ opencv_deb }}" + cmd: "{{ opencv_install_script }} https://nvidia.box.com/shared/static/2hssa5g3v28ozvo3tc3qwxmn78yerca9.gz OpenCV-4.5.0-aarch64.tar.gz" - name: Build ROS2 Humble ansible.builtin.command: From 8c4a20551dbee486a5ff4200e3d2553c343c91ab Mon Sep 17 00:00:00 2001 From: nvidia Date: Thu, 26 Oct 2023 16:09:07 +0900 Subject: [PATCH 06/29] add become: true for opencv install and ros2 build scripts --- ansible/roles/ros2/tasks/main.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index 60fcc84..8cf825c 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -110,6 +110,7 @@ - name: Install OpenCV ansible.builtin.command: cmd: "{{ opencv_install_script }} https://nvidia.box.com/shared/static/2hssa5g3v28ozvo3tc3qwxmn78yerca9.gz OpenCV-4.5.0-aarch64.tar.gz" + become: true - name: Build ROS2 Humble ansible.builtin.command: @@ -118,6 +119,7 @@ ROS_DISTRO: "{{ ros_distro }}" ROS_PKG: ros_base ROS_ROOT: "/opt/ros/{{ ros_distro }}" + become: true - name: Install extra edge-auto-jetson dependency ansible.builtin.apt: From 7bb9eb9517e282d12f6f83e2d7acd079e8c9a7e4 Mon Sep 17 00:00:00 2001 From: nvidia Date: Thu, 26 Oct 2023 17:19:50 +0900 Subject: [PATCH 07/29] do not install jetpack in ros2 role --- ansible/roles/ros2/tasks/main.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index 8cf825c..58c24ad 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -57,12 +57,12 @@ - name: Install dependencies block: - - name: Install jetpack - ansible.builtin.apt: - name: - - nvidia-jetpack - install_recommends: false - update_cache: true +# - name: Install jetpack +# ansible.builtin.apt: +# name: +# - nvidia-jetpack +# install_recommends: false +# update_cache: true - name: Install OpenCV deps ansible.builtin.command: cmd: "{{ opencv_install_deps_script }}" From b20003dca280cf4b4f41a4e21439f0d65e6da8ba Mon Sep 17 00:00:00 2001 From: nvidia Date: Thu, 26 Oct 2023 17:22:22 +0900 Subject: [PATCH 08/29] change network configuration and run entire setup --- ansible/roles/ptp4l_client/defaults/main.yaml | 2 +- ansible/setup.yaml | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ansible/roles/ptp4l_client/defaults/main.yaml b/ansible/roles/ptp4l_client/defaults/main.yaml index 1ce1cdf..e33c8f8 100644 --- a/ansible/roles/ptp4l_client/defaults/main.yaml +++ b/ansible/roles/ptp4l_client/defaults/main.yaml @@ -1 +1 @@ -ptp4l_client_interface: eth1 +ptp4l_client_interface: mgbe0 diff --git a/ansible/setup.yaml b/ansible/setup.yaml index f7dfee4..8f61e66 100644 --- a/ansible/setup.yaml +++ b/ansible/setup.yaml @@ -5,15 +5,15 @@ - network_config: ros: interface_address: 192.168.2.2 - interface_name: eth1 + interface_name: mgbe0 dhcp: - interface_name: eth0 - - ptp4l_client_interface: eth1 + interface_name: mgbe1 + - ptp4l_client_interface: mgbe0 vars_prompt: - - name: prompt_install_camera_driver - prompt: |- - [Warning] Do you want to install/update the TIER IV camera driver? [y/N] - private: false +# - name: prompt_install_camera_driver +# prompt: |- +# [Warning] Do you want to install/update the TIER IV camera driver? [y/N] +# private: false - name: prompt_configure_network prompt: |- [Warning] Do you want to configure the network? This configuration may overwrite the IP address of the specific network interface [y/N] @@ -22,11 +22,11 @@ - role: autoware - role: cuda - role: cyclonedds - - role: docker +# - role: docker - role: vcstool - role: calibration_tools - - role: tier4_hdr_camera_driver - when: prompt_install_camera_driver == 'y' +# - role: tier4_hdr_camera_driver +# when: prompt_install_camera_driver == 'y' - role: ros2 - role: ptp4l_client when: prompt_configure_network == 'y' From 187dbee8c0b729cf08f6eb8f7b705113b4ea03a5 Mon Sep 17 00:00:00 2001 From: nvidia Date: Thu, 26 Oct 2023 17:34:40 +0900 Subject: [PATCH 09/29] add DEBIAN_FRONTEND=noninteractive to prevent error installing Jetpack --- ansible/setup.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ansible/setup.yaml b/ansible/setup.yaml index 8f61e66..9ff378b 100644 --- a/ansible/setup.yaml +++ b/ansible/setup.yaml @@ -34,3 +34,6 @@ when: prompt_configure_network == 'y' - role: netplan when: prompt_configure_network == 'y' + + environment: + DEBIAN_FRONTEND: noninteractive From e72b9f28d82033acf7f318da7aab46be75afda8a Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Thu, 26 Oct 2023 17:36:10 +0900 Subject: [PATCH 10/29] change python interpreter from 3.6 to 3.8 --- ansible/roles/calibration_tools/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/calibration_tools/tasks/main.yaml b/ansible/roles/calibration_tools/tasks/main.yaml index 4d3a345..6047128 100644 --- a/ansible/roles/calibration_tools/tasks/main.yaml +++ b/ansible/roles/calibration_tools/tasks/main.yaml @@ -1,6 +1,6 @@ - name: Fix python interpreter version to 3 set_fact: - ansible_python_interpreter: /usr/bin/python3.6 + ansible_python_interpreter: /usr/bin/python3.8 - name: Upgrade pip pip: From 7bc90824019885bc58ecd6e005ddf70d1b97f458 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Fri, 27 Oct 2023 14:58:42 +0900 Subject: [PATCH 11/29] Change from 10G to 1G network interface --- ansible/roles/ptp4l_client/defaults/main.yaml | 2 +- ansible/setup.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible/roles/ptp4l_client/defaults/main.yaml b/ansible/roles/ptp4l_client/defaults/main.yaml index e33c8f8..f696ae5 100644 --- a/ansible/roles/ptp4l_client/defaults/main.yaml +++ b/ansible/roles/ptp4l_client/defaults/main.yaml @@ -1 +1 @@ -ptp4l_client_interface: mgbe0 +ptp4l_client_interface: eqos0 diff --git a/ansible/setup.yaml b/ansible/setup.yaml index 9ff378b..461328c 100644 --- a/ansible/setup.yaml +++ b/ansible/setup.yaml @@ -5,10 +5,10 @@ - network_config: ros: interface_address: 192.168.2.2 - interface_name: mgbe0 + interface_name: eqos0 dhcp: interface_name: mgbe1 - - ptp4l_client_interface: mgbe0 + - ptp4l_client_interface: eqos0 vars_prompt: # - name: prompt_install_camera_driver # prompt: |- From d665519e6e6e14699a5454a4cbbd4535dbb59814 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Fri, 27 Oct 2023 15:00:05 +0900 Subject: [PATCH 12/29] temporarily remove calibration tools setup from ansible script --- ansible/setup.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/setup.yaml b/ansible/setup.yaml index 461328c..59b2e1b 100644 --- a/ansible/setup.yaml +++ b/ansible/setup.yaml @@ -24,7 +24,7 @@ - role: cyclonedds # - role: docker - role: vcstool - - role: calibration_tools +# - role: calibration_tools # - role: tier4_hdr_camera_driver # when: prompt_install_camera_driver == 'y' - role: ros2 From 4481c32daf7efb6c107306528bb5662cc7ed3363 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Fri, 27 Oct 2023 15:00:46 +0900 Subject: [PATCH 13/29] comment out ROSCube specific command --- setup-dev-env.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup-dev-env.sh b/setup-dev-env.sh index d991aff..e2ac2a5 100755 --- a/setup-dev-env.sh +++ b/setup-dev-env.sh @@ -11,10 +11,10 @@ if ! (command -v sudo >/dev/null 2>&1); then fi # Disable inactive apt repository -DISABLE_TARGET="/etc/apt/sources.list.d/roscube.list" -if [ -e ${DISABLE_TARGET} ]; then - sudo sed -i 's/.*neuron\.adlinktech\.com.*/# &/g' ${DISABLE_TARGET} -fi +# DISABLE_TARGET="/etc/apt/sources.list.d/roscube.list" +# if [ -e ${DISABLE_TARGET} ]; then +# sudo sed -i 's/.*neuron\.adlinktech\.com.*/# &/g' ${DISABLE_TARGET} +# fi # Install git if ! (command -v git >/dev/null 2>&1); then From 8fcf73edffee62d4baa772671f56b4cb62e0c069 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Fri, 27 Oct 2023 15:20:42 +0900 Subject: [PATCH 14/29] commit ptp4l host configuration for debugging --- ansible/roles/ptp4l_host/defaults/main.yaml | 2 ++ ansible/roles/ptp4l_host/files/ptp4l@.service | 13 ++++++++++++ ansible/roles/ptp4l_host/tasks/main.yaml | 21 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 ansible/roles/ptp4l_host/defaults/main.yaml create mode 100644 ansible/roles/ptp4l_host/files/ptp4l@.service create mode 100644 ansible/roles/ptp4l_host/tasks/main.yaml diff --git a/ansible/roles/ptp4l_host/defaults/main.yaml b/ansible/roles/ptp4l_host/defaults/main.yaml new file mode 100644 index 0000000..3ff8c80 --- /dev/null +++ b/ansible/roles/ptp4l_host/defaults/main.yaml @@ -0,0 +1,2 @@ +ptp4l_host_interface: + - mgbe0 diff --git a/ansible/roles/ptp4l_host/files/ptp4l@.service b/ansible/roles/ptp4l_host/files/ptp4l@.service new file mode 100644 index 0000000..b89cc64 --- /dev/null +++ b/ansible/roles/ptp4l_host/files/ptp4l@.service @@ -0,0 +1,13 @@ +[Unit] +Description=Precision Time Protocol (PTP) service +After=network-online.target + +[Service] +Type=simple +ExecStart=/usr/sbin/ptp4l -i %i -m -S -A +ExecStop=/usr/bin/pkill -f ptp4l +Restart=always +RestartSec=5 + +[Install] +WantedBy=multi-user.target network-online.target diff --git a/ansible/roles/ptp4l_host/tasks/main.yaml b/ansible/roles/ptp4l_host/tasks/main.yaml new file mode 100644 index 0000000..e134230 --- /dev/null +++ b/ansible/roles/ptp4l_host/tasks/main.yaml @@ -0,0 +1,21 @@ +- name: Install ptp4l + ansible.builtin.apt: + name: + - linuxptp + update_cache: true + become: true + +- name: Copy service template file + ansible.builtin.copy: + src: ptp4l@.service + dest: /etc/systemd/system/ + become: true + +- name: Install ptp4l client service file + ansible.builtin.systemd: + name: ptp4l@{{ item }}.service + daemon_reload: true + enabled: true + masked: false + become: true + with_items: "{{ ptp4l_host_interface }}" From 4ae927eec00dc3e4a25fea1a3341b26d8a7a1137 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Fri, 27 Oct 2023 15:22:55 +0900 Subject: [PATCH 15/29] add ptp4l_host role to setup script --- ansible/setup.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ansible/setup.yaml b/ansible/setup.yaml index 59b2e1b..525db47 100644 --- a/ansible/setup.yaml +++ b/ansible/setup.yaml @@ -30,6 +30,8 @@ - role: ros2 - role: ptp4l_client when: prompt_configure_network == 'y' + - role: ptp4l_host + when: prompt_configure_network == 'y' - role: enlarge_txqueue when: prompt_configure_network == 'y' - role: netplan From 78c4492edbbd6ac018ad15b50048b205d6ed0b39 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Fri, 27 Oct 2023 15:31:38 +0900 Subject: [PATCH 16/29] add lidar network configuration --- ansible/setup.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ansible/setup.yaml b/ansible/setup.yaml index 525db47..4500377 100644 --- a/ansible/setup.yaml +++ b/ansible/setup.yaml @@ -8,7 +8,11 @@ interface_name: eqos0 dhcp: interface_name: mgbe1 + lidar: + interface_address: 192.168.1.100 + interface_name: mgbe0 - ptp4l_client_interface: eqos0 + - ptp4l_host_interface: mgbe0 vars_prompt: # - name: prompt_install_camera_driver # prompt: |- From 28efae05bb5c366df771a1fa8220110afded29ed Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Fri, 27 Oct 2023 15:34:44 +0900 Subject: [PATCH 17/29] comment out redundant code from ptp4l_host --- ansible/roles/ptp4l_host/tasks/main.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ansible/roles/ptp4l_host/tasks/main.yaml b/ansible/roles/ptp4l_host/tasks/main.yaml index e134230..a44721d 100644 --- a/ansible/roles/ptp4l_host/tasks/main.yaml +++ b/ansible/roles/ptp4l_host/tasks/main.yaml @@ -1,15 +1,15 @@ -- name: Install ptp4l - ansible.builtin.apt: - name: - - linuxptp - update_cache: true - become: true +# - name: Install ptp4l +# ansible.builtin.apt: +# name: +# - linuxptp +# update_cache: true +# become: true -- name: Copy service template file - ansible.builtin.copy: - src: ptp4l@.service - dest: /etc/systemd/system/ - become: true +# - name: Copy service template file +# ansible.builtin.copy: +# src: ptp4l@.service +# dest: /etc/systemd/system/ +# become: true - name: Install ptp4l client service file ansible.builtin.systemd: From 4e9ceee7900f3d4afbc2ae79e00be7bee67a0f51 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Mon, 6 Nov 2023 12:43:50 +0900 Subject: [PATCH 18/29] make ansible only setup ptp master --- ansible/roles/ptp4l_host/tasks/main.yaml | 22 +++++++++++----------- ansible/setup.yaml | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ansible/roles/ptp4l_host/tasks/main.yaml b/ansible/roles/ptp4l_host/tasks/main.yaml index a44721d..e134230 100644 --- a/ansible/roles/ptp4l_host/tasks/main.yaml +++ b/ansible/roles/ptp4l_host/tasks/main.yaml @@ -1,15 +1,15 @@ -# - name: Install ptp4l -# ansible.builtin.apt: -# name: -# - linuxptp -# update_cache: true -# become: true +- name: Install ptp4l + ansible.builtin.apt: + name: + - linuxptp + update_cache: true + become: true -# - name: Copy service template file -# ansible.builtin.copy: -# src: ptp4l@.service -# dest: /etc/systemd/system/ -# become: true +- name: Copy service template file + ansible.builtin.copy: + src: ptp4l@.service + dest: /etc/systemd/system/ + become: true - name: Install ptp4l client service file ansible.builtin.systemd: diff --git a/ansible/setup.yaml b/ansible/setup.yaml index 4500377..1d0180b 100644 --- a/ansible/setup.yaml +++ b/ansible/setup.yaml @@ -32,8 +32,8 @@ # - role: tier4_hdr_camera_driver # when: prompt_install_camera_driver == 'y' - role: ros2 - - role: ptp4l_client - when: prompt_configure_network == 'y' +# - role: ptp4l_client +# when: prompt_configure_network == 'y' - role: ptp4l_host when: prompt_configure_network == 'y' - role: enlarge_txqueue From 28760b40e08252ed1009260ccd40235252b244c7 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Mon, 6 Nov 2023 14:37:55 +0900 Subject: [PATCH 19/29] change ptp interface to 1G interface --- ansible/roles/ptp4l_host/defaults/main.yaml | 2 +- ansible/setup.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible/roles/ptp4l_host/defaults/main.yaml b/ansible/roles/ptp4l_host/defaults/main.yaml index 3ff8c80..3e78086 100644 --- a/ansible/roles/ptp4l_host/defaults/main.yaml +++ b/ansible/roles/ptp4l_host/defaults/main.yaml @@ -1,2 +1,2 @@ ptp4l_host_interface: - - mgbe0 + - eth0 diff --git a/ansible/setup.yaml b/ansible/setup.yaml index 1d0180b..95c8151 100644 --- a/ansible/setup.yaml +++ b/ansible/setup.yaml @@ -10,9 +10,9 @@ interface_name: mgbe1 lidar: interface_address: 192.168.1.100 - interface_name: mgbe0 + interface_name: eth0 - ptp4l_client_interface: eqos0 - - ptp4l_host_interface: mgbe0 + - ptp4l_host_interface: eth0 vars_prompt: # - name: prompt_install_camera_driver # prompt: |- From 230978c16f7d33339fe7d4cf0d91adc5d651c678 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Wed, 8 Nov 2023 12:22:49 +0900 Subject: [PATCH 20/29] rewrite ros2 build script to add additional packages into build --- ansible/roles/ros2/defaults/main.yaml | 3 + ansible/roles/ros2/tasks/main.yaml | 163 ++++++++++++++++++++++++-- 2 files changed, 154 insertions(+), 12 deletions(-) create mode 100644 ansible/roles/ros2/defaults/main.yaml diff --git a/ansible/roles/ros2/defaults/main.yaml b/ansible/roles/ros2/defaults/main.yaml new file mode 100644 index 0000000..0875fbd --- /dev/null +++ b/ansible/roles/ros2/defaults/main.yaml @@ -0,0 +1,3 @@ +ros_root_dir: /opt/ros/humble +ros_pkg: ros_base +skip_keys: "libopencv-dev libopencv-contrib-dev libopencv-imgproc-dev python-opencv python3-opencv" diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index 58c24ad..43da85a 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -57,12 +57,12 @@ - name: Install dependencies block: -# - name: Install jetpack -# ansible.builtin.apt: -# name: -# - nvidia-jetpack -# install_recommends: false -# update_cache: true + # - name: Install jetpack + # ansible.builtin.apt: + # name: + # - nvidia-jetpack + # install_recommends: false + # update_cache: true - name: Install OpenCV deps ansible.builtin.command: cmd: "{{ opencv_install_deps_script }}" @@ -113,12 +113,151 @@ become: true - name: Build ROS2 Humble - ansible.builtin.command: - cmd: "{{ ros2_build_script }}" - environment: - ROS_DISTRO: "{{ ros_distro }}" - ROS_PKG: ros_base - ROS_ROOT: "/opt/ros/{{ ros_distro }}" + block: + - name: Add the ROS deb repo to the apt sources list + block: + - name: Install apt packages + ansible.builtin.apt: + name: + - curl + - wget + - gnupg2 + - lsb-release + - ca-certificates + install_recommends: false + update_cache: true + - name: Download ros.key + ansible.builtin.command: + cmd: "curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg" + - name: "TODO: add name" + ansible.builtin.command: + cmd: 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null' + - name: Install apt packages + ansible.builtin.apt: + name: + - build-essential + - cmake + - git + - libbullet-dev + - libpython3-dev + - python3-colcon-common-extensions + - python3-flake8 + - python3-pip + - python3-numpy + - python3-pytest-cov + - python3-rosdep + - python3-setuptools + - python3-vcstool + - python3-rosinstall-generator + - libasio-dev + - libtinyxml2-dev + - libcunit1-dev + install_recommends: false + update_cache: true + - name: Install pip packages + ansible.builtin.pip: + name: + - argcomplete + - flake8-blind-except + - flake8-builtins + - flake8-class-newline + - flake8-comprehensions + - flake8-deprecated + - flake8-docstrings + - flake8-import-order + - flake8-quotes + - pytest-repeat + - pytest-rerunfailures + - pytest + - scikit-build + - cmake + extra_args: "--upgrade --no-cache-dir" + - name: Create the ROS root directory and src directory + ansible.builtin.file: + path: "{{ ros_root_dir }}/src" + state: directory + recurse: true + - name: Download ROS packages + ansible.builtin.command: + cmd: > + "rosinstall_generator --deps --rosdistro ${ROS_DISTRO} ${ROS_PKG} + launch_xml + launch_yaml + launch_testing + launch_testing_ament_cmake + demo_nodes_cpp + demo_nodes_py + example_interfaces + camera_calibration_parsers + camera_info_manager + cv_bridge + v4l2_camera + vision_opencv + vision_msgs + image_geometry + image_pipeline + image_transport + compressed_image_transport + compressed_depth_image_transport + pcl_msgs + perception_pcl + logging_demo + udp_msgs + angles + diagnostics + tf_transformations + mrt_cmake_modules + gtest_vendor + grid_map + filters + nav2_msgs + tf2-eigen + ament_cmake_clang_format + > ros2.{{ ros_distro }}.{{ ros_pkg }}.rosinstall" + - name: Import packages to source directory + ansible.builtin.command: + cmd: "vcs import src < ros2.${ROS_DISTRO}.${ROS_PKG}.rosinstall" + - name: Install dependencies with rosdep + block: + - name: Initialize rosdep + ansible.builtin.command: + cmd: rosdep init + - name: Update rosdep + ansible.builtin.command: + cmd: rosdep update + - name: Run rosdep + ansible.builtin.command: + cmd: rosdep install -y --ignore-src --from-paths src --rosdistro {{ ros_distro }} --skip-keys {{ skip_keys }} + - name: Colcon build + ansible.builtin.command: + cmd: colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=Release + - name: Remove build files + block: + - name: Remove source directory + ansible.builtin.file: + path: "{{ ros_root_dir }}/src" + state: absent + - name: Remove log directory + ansible.builtin.file: + path: "{{ ros_root_dir }}/logs" + state: absent + - name: Remove build directory + ansible.builtin.file: + path: "{{ ros_root_dir }}/build" + state: absent + - name: Remove .rosinstall files + ansible.builtin.file: + path: "{{ ros_root_dir }}/*.rosinstall" + state: absent + - name: Clean up apt + block: + - name: Remove + ansible.builtin.file: + path: /var/lib/apt/lists/* + state: absent + - name: Apt-get clean + ansible.builtin.apt: + clean: true become: true - name: Install extra edge-auto-jetson dependency From 08eff91a5fa460689027492a8fc92e94e8ebe4b4 Mon Sep 17 00:00:00 2001 From: nvidia Date: Wed, 15 Nov 2023 13:45:50 +0900 Subject: [PATCH 21/29] save checkpoint after successful ansible setup run on Anvil --- ansible/roles/ros2/defaults/main.yaml | 2 +- ansible/roles/ros2/tasks/main.yaml | 153 ++++++++++++-------------- 2 files changed, 74 insertions(+), 81 deletions(-) diff --git a/ansible/roles/ros2/defaults/main.yaml b/ansible/roles/ros2/defaults/main.yaml index 0875fbd..8a1823a 100644 --- a/ansible/roles/ros2/defaults/main.yaml +++ b/ansible/roles/ros2/defaults/main.yaml @@ -1,3 +1,3 @@ ros_root_dir: /opt/ros/humble ros_pkg: ros_base -skip_keys: "libopencv-dev libopencv-contrib-dev libopencv-imgproc-dev python-opencv python3-opencv" +skip_keys: "libopencv-dev python3-catkin-pkg-modules" diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index 43da85a..6c0bf0d 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -77,40 +77,41 @@ update_cache: true become: true -- name: Install PCL - block: - - name: Define directory name - set_fact: - pcl_directory: "{{ ansible_env.HOME }}/pcl" - - name: Create build directory - ansible.builtin.file: - path: "{{ pcl_directory }}" - state: directory - - name: Download and extract PCL 1.12.1 source - ansible.builtin.unarchive: - src: https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.12.1/source.tar.gz - dest: "{{ pcl_directory }}" - remote_src: yes - - name: Create build directory - ansible.builtin.file: - path: "{{ pcl_directory }}/pcl/build" - state: directory - - name: Run cmake - ansible.builtin.command: - cmd: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc .. - chdir: "{{ pcl_directory }}/pcl/build" - environment: - PATH: "/usr/local/cuda/bin:{{ ansible_env.PATH }}" - - name: Install PCL - ansible.builtin.command: - cmd: make -j7 install - chdir: "{{ pcl_directory }}/pcl/build" - become: true - -- name: Install OpenCV - ansible.builtin.command: - cmd: "{{ opencv_install_script }} https://nvidia.box.com/shared/static/2hssa5g3v28ozvo3tc3qwxmn78yerca9.gz OpenCV-4.5.0-aarch64.tar.gz" - become: true +# for testing +#- name: Install PCL +# block: +# - name: Define directory name +# set_fact: +# pcl_directory: "{{ ansible_env.HOME }}/pcl" +# - name: Create build directory +# ansible.builtin.file: +# path: "{{ pcl_directory }}" +# state: directory +# - name: Download and extract PCL 1.12.1 source +# ansible.builtin.unarchive: +# src: https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.12.1/source.tar.gz +# dest: "{{ pcl_directory }}" +# remote_src: yes +# - name: Create build directory +# ansible.builtin.file: +# path: "{{ pcl_directory }}/pcl/build" +# state: directory +# - name: Run cmake +# ansible.builtin.command: +# cmd: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc .. +# chdir: "{{ pcl_directory }}/pcl/build" +# environment: +# PATH: "/usr/local/cuda/bin:{{ ansible_env.PATH }}" +# - name: Install PCL +# ansible.builtin.command: +# cmd: make -j7 install +# chdir: "{{ pcl_directory }}/pcl/build" +# become: true +# +#- name: Install OpenCV +# ansible.builtin.command: +# cmd: "{{ opencv_install_script }} https://nvidia.box.com/shared/static/2hssa5g3v28ozvo3tc3qwxmn78yerca9.gz OpenCV-4.5.0-aarch64.tar.gz" +# become: true - name: Build ROS2 Humble block: @@ -132,6 +133,7 @@ - name: "TODO: add name" ansible.builtin.command: cmd: 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null' + become: true - name: Install apt packages ansible.builtin.apt: name: @@ -140,7 +142,7 @@ - git - libbullet-dev - libpython3-dev - - python3-colcon-common-extensions +# - python3-colcon-common-extensions - python3-flake8 - python3-pip - python3-numpy @@ -152,11 +154,15 @@ - libasio-dev - libtinyxml2-dev - libcunit1-dev + - apt-utils install_recommends: false update_cache: true + become: true - name: Install pip packages ansible.builtin.pip: name: + - colcon-common-extensions + - catkin-pkg-modules - argcomplete - flake8-blind-except - flake8-builtins @@ -172,67 +178,53 @@ - scikit-build - cmake extra_args: "--upgrade --no-cache-dir" + - name: Could NOT find Python3 workaround + ansible.builtin.apt: + name: + - python3.9 + - libpython3.9* + purge: true + state: absent + become: true - name: Create the ROS root directory and src directory ansible.builtin.file: path: "{{ ros_root_dir }}/src" state: directory recurse: true + become: true +# - name: Create .rosinstall file to hold ROS packages +# ansible.builtin.file: +# path: ros2.{{ ros_distro }}.{{ ros_pkg }}.rosinstall +# state: touch - name: Download ROS packages - ansible.builtin.command: - cmd: > - "rosinstall_generator --deps --rosdistro ${ROS_DISTRO} ${ROS_PKG} - launch_xml - launch_yaml - launch_testing - launch_testing_ament_cmake - demo_nodes_cpp - demo_nodes_py - example_interfaces - camera_calibration_parsers - camera_info_manager - cv_bridge - v4l2_camera - vision_opencv - vision_msgs - image_geometry - image_pipeline - image_transport - compressed_image_transport - compressed_depth_image_transport - pcl_msgs - perception_pcl - logging_demo - udp_msgs - angles - diagnostics - tf_transformations - mrt_cmake_modules - gtest_vendor - grid_map - filters - nav2_msgs - tf2-eigen - ament_cmake_clang_format - > ros2.{{ ros_distro }}.{{ ros_pkg }}.rosinstall" + ansible.builtin.shell: + cmd: "rosinstall_generator --deps --rosdistro {{ ros_distro }} {{ ros_pkg }} launch_xml launch_yaml launch_testing launch_testing_ament_cmake demo_nodes_cpp demo_nodes_py example_interfaces camera_calibration_parsers camera_info_manager cv_bridge v4l2_camera vision_opencv vision_msgs image_geometry image_pipeline image_transport compressed_image_transport compressed_depth_image_transport pcl_msgs perception_pcl logging_demo udp_msgs angles diagnostics tf_transformations mrt_cmake_modules gtest_vendor grid_map filters nav2_msgs tf2-eigen ament_cmake_clang_format > {{ ros_root_dir }}/ros2.{{ ros_distro }}.{{ ros_pkg }}.rosinstall" + become: true - name: Import packages to source directory - ansible.builtin.command: - cmd: "vcs import src < ros2.${ROS_DISTRO}.${ROS_PKG}.rosinstall" + ansible.builtin.shell: + cmd: "vcs import src < ros2.humble.ros_base.rosinstall" + chdir: "{{ ros_root_dir }}" + become: true - name: Install dependencies with rosdep block: - - name: Initialize rosdep - ansible.builtin.command: - cmd: rosdep init - name: Update rosdep - ansible.builtin.command: + ansible.builtin.shell: cmd: rosdep update - name: Run rosdep - ansible.builtin.command: - cmd: rosdep install -y --ignore-src --from-paths src --rosdistro {{ ros_distro }} --skip-keys {{ skip_keys }} + shell: "rosdep install -y --ignore-src --from-paths src --rosdistro humble --skip-keys 'libopencv-dev python3-catkin-pkg-modules python3-rosdistro-modules libignition-math6-dev rti-connext-dds-6.0.1 ignition-math6'" + args: + chdir: "{{ ros_root_dir }}" - name: Colcon build ansible.builtin.command: cmd: colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=Release + chdir: "{{ ros_root_dir }}" + become: true - name: Remove build files block: + - name: Remove .rosinstall file + ansible.builtin.file: + path: ros2.{{ ros_distro }}.{{ ros_pkg }}.rosinstall + state: absent - name: Remove source directory ansible.builtin.file: path: "{{ ros_root_dir }}/src" @@ -249,6 +241,7 @@ ansible.builtin.file: path: "{{ ros_root_dir }}/*.rosinstall" state: absent + become: true - name: Clean up apt block: - name: Remove @@ -258,7 +251,7 @@ - name: Apt-get clean ansible.builtin.apt: clean: true - become: true + become: true - name: Install extra edge-auto-jetson dependency ansible.builtin.apt: From 3b2c6209e3011354f848585638b13e9829341fa7 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Wed, 15 Nov 2023 14:56:38 +0900 Subject: [PATCH 22/29] add install range-v3 from source and extra PCL dep --- ansible/roles/ros2/tasks/main.yaml | 116 +++++++++++++++++------------ 1 file changed, 70 insertions(+), 46 deletions(-) diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index 6c0bf0d..c8fc4e6 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -57,12 +57,6 @@ - name: Install dependencies block: - # - name: Install jetpack - # ansible.builtin.apt: - # name: - # - nvidia-jetpack - # install_recommends: false - # update_cache: true - name: Install OpenCV deps ansible.builtin.command: cmd: "{{ opencv_install_deps_script }}" @@ -73,45 +67,75 @@ - libboost-filesystem-dev - libboost-date-time-dev - libboost-iostreams-dev + - libvtk7-dev install_recommends: false update_cache: true become: true -# for testing -#- name: Install PCL -# block: -# - name: Define directory name -# set_fact: -# pcl_directory: "{{ ansible_env.HOME }}/pcl" -# - name: Create build directory -# ansible.builtin.file: -# path: "{{ pcl_directory }}" -# state: directory -# - name: Download and extract PCL 1.12.1 source -# ansible.builtin.unarchive: -# src: https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.12.1/source.tar.gz -# dest: "{{ pcl_directory }}" -# remote_src: yes -# - name: Create build directory -# ansible.builtin.file: -# path: "{{ pcl_directory }}/pcl/build" -# state: directory -# - name: Run cmake -# ansible.builtin.command: -# cmd: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc .. -# chdir: "{{ pcl_directory }}/pcl/build" -# environment: -# PATH: "/usr/local/cuda/bin:{{ ansible_env.PATH }}" -# - name: Install PCL -# ansible.builtin.command: -# cmd: make -j7 install -# chdir: "{{ pcl_directory }}/pcl/build" -# become: true -# -#- name: Install OpenCV -# ansible.builtin.command: -# cmd: "{{ opencv_install_script }} https://nvidia.box.com/shared/static/2hssa5g3v28ozvo3tc3qwxmn78yerca9.gz OpenCV-4.5.0-aarch64.tar.gz" -# become: true +- name: Install PCL + block: + - name: Define directory name + set_fact: + pcl_directory: "{{ ansible_env.HOME }}/pcl" + - name: Create build directory + ansible.builtin.file: + path: "{{ pcl_directory }}" + state: directory + - name: Download and extract PCL 1.12.1 source + ansible.builtin.unarchive: + src: https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.12.1/source.tar.gz + dest: "{{ pcl_directory }}" + remote_src: yes + - name: Create build directory + ansible.builtin.file: + path: "{{ pcl_directory }}/pcl/build" + state: directory + - name: Run cmake + ansible.builtin.command: + cmd: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc .. + chdir: "{{ pcl_directory }}/pcl/build" + environment: + PATH: "/usr/local/cuda/bin:{{ ansible_env.PATH }}" + - name: Install PCL + ansible.builtin.command: + cmd: make -j7 install + chdir: "{{ pcl_directory }}/pcl/build" + become: true + +- name: Install OpenCV + ansible.builtin.command: + cmd: "{{ opencv_install_script }} https://nvidia.box.com/shared/static/2hssa5g3v28ozvo3tc3qwxmn78yerca9.gz OpenCV-4.5.0-aarch64.tar.gz" + become: true + +- name: Install range-v3 0.11.0 + block: + - name: Define directory name + set_fact: + range_v3_directory: "{{ ansible_env.HOME }}/range-v3" + - name: Create build directory + ansible.builtin.file: + path: "{{ range_v3_directory }}" + state: directory + - name: Download and extract range-v3 0.11.0 source + ansible.builtin.unarchive: + src: https://github.com/ericniebler/range-v3/archive/refs/tags/0.11.0.tar.gz + dest: "{{ range_v3_directory }}" + remote_src: yes + - name: Create build directory + ansible.builtin.file: + path: "{{ range_v3_directory }}/range-v3/build" + state: directory + - name: Run cmake + ansible.builtin.command: + cmd: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc .. + chdir: "{{ range_v3_directory }}/range-v3/build" + environment: + PATH: "/usr/local/cuda/bin:{{ ansible_env.PATH }}" + - name: Install range-v3 + ansible.builtin.command: + cmd: make -j7 install + chdir: "{{ range_v3_directory }}/range-v3/build" + become: true - name: Build ROS2 Humble block: @@ -142,7 +166,7 @@ - git - libbullet-dev - libpython3-dev -# - python3-colcon-common-extensions + # - python3-colcon-common-extensions - python3-flake8 - python3-pip - python3-numpy @@ -192,10 +216,10 @@ state: directory recurse: true become: true -# - name: Create .rosinstall file to hold ROS packages -# ansible.builtin.file: -# path: ros2.{{ ros_distro }}.{{ ros_pkg }}.rosinstall -# state: touch + # - name: Create .rosinstall file to hold ROS packages + # ansible.builtin.file: + # path: ros2.{{ ros_distro }}.{{ ros_pkg }}.rosinstall + # state: touch - name: Download ROS packages ansible.builtin.shell: cmd: "rosinstall_generator --deps --rosdistro {{ ros_distro }} {{ ros_pkg }} launch_xml launch_yaml launch_testing launch_testing_ament_cmake demo_nodes_cpp demo_nodes_py example_interfaces camera_calibration_parsers camera_info_manager cv_bridge v4l2_camera vision_opencv vision_msgs image_geometry image_pipeline image_transport compressed_image_transport compressed_depth_image_transport pcl_msgs perception_pcl logging_demo udp_msgs angles diagnostics tf_transformations mrt_cmake_modules gtest_vendor grid_map filters nav2_msgs tf2-eigen ament_cmake_clang_format > {{ ros_root_dir }}/ros2.{{ ros_distro }}.{{ ros_pkg }}.rosinstall" From 8c76af0526c336867f79e6ca38020f5204349e91 Mon Sep 17 00:00:00 2001 From: nvidia Date: Wed, 15 Nov 2023 15:39:23 +0900 Subject: [PATCH 23/29] fix range-v3 directory name --- ansible/roles/ros2/tasks/main.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index c8fc4e6..93f7bf9 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -123,18 +123,18 @@ remote_src: yes - name: Create build directory ansible.builtin.file: - path: "{{ range_v3_directory }}/range-v3/build" + path: "{{ range_v3_directory }}/range-v3-0.11.0/build" state: directory - name: Run cmake ansible.builtin.command: cmd: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc .. - chdir: "{{ range_v3_directory }}/range-v3/build" + chdir: "{{ range_v3_directory }}/range-v3-0.11.0/build" environment: PATH: "/usr/local/cuda/bin:{{ ansible_env.PATH }}" - name: Install range-v3 ansible.builtin.command: cmd: make -j7 install - chdir: "{{ range_v3_directory }}/range-v3/build" + chdir: "{{ range_v3_directory }}/range-v3-0.11.0/build" become: true - name: Build ROS2 Humble From 38aabd178c8e77f6a214cee65e5085b460a97721 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Thu, 16 Nov 2023 15:27:06 +0900 Subject: [PATCH 24/29] add miscellaneous apt packages --- ansible/roles/ros2/tasks/main.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index c8fc4e6..e987b31 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -178,6 +178,10 @@ - libasio-dev - libtinyxml2-dev - libcunit1-dev + - libpugixml-dev + - libgeographic-dev + - libgtest-dev + - libcgal-dev - apt-utils install_recommends: false update_cache: true From 900de54cd2ed535a46d4fd54179462001cf90e29 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Mon, 20 Nov 2023 16:24:49 +0900 Subject: [PATCH 25/29] clean up comments and unused variables --- ansible/roles/ros2/defaults/main.yaml | 1 - ansible/roles/ros2/tasks/main.yaml | 7 +------ ansible/setup.yaml | 10 ---------- setup-dev-env.sh | 6 ------ 4 files changed, 1 insertion(+), 23 deletions(-) diff --git a/ansible/roles/ros2/defaults/main.yaml b/ansible/roles/ros2/defaults/main.yaml index 8a1823a..91289a0 100644 --- a/ansible/roles/ros2/defaults/main.yaml +++ b/ansible/roles/ros2/defaults/main.yaml @@ -1,3 +1,2 @@ ros_root_dir: /opt/ros/humble ros_pkg: ros_base -skip_keys: "libopencv-dev python3-catkin-pkg-modules" diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index 6416b83..0ac3575 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -161,12 +161,12 @@ - name: Install apt packages ansible.builtin.apt: name: + - apt-utils - build-essential - cmake - git - libbullet-dev - libpython3-dev - # - python3-colcon-common-extensions - python3-flake8 - python3-pip - python3-numpy @@ -182,7 +182,6 @@ - libgeographic-dev - libgtest-dev - libcgal-dev - - apt-utils install_recommends: false update_cache: true become: true @@ -220,10 +219,6 @@ state: directory recurse: true become: true - # - name: Create .rosinstall file to hold ROS packages - # ansible.builtin.file: - # path: ros2.{{ ros_distro }}.{{ ros_pkg }}.rosinstall - # state: touch - name: Download ROS packages ansible.builtin.shell: cmd: "rosinstall_generator --deps --rosdistro {{ ros_distro }} {{ ros_pkg }} launch_xml launch_yaml launch_testing launch_testing_ament_cmake demo_nodes_cpp demo_nodes_py example_interfaces camera_calibration_parsers camera_info_manager cv_bridge v4l2_camera vision_opencv vision_msgs image_geometry image_pipeline image_transport compressed_image_transport compressed_depth_image_transport pcl_msgs perception_pcl logging_demo udp_msgs angles diagnostics tf_transformations mrt_cmake_modules gtest_vendor grid_map filters nav2_msgs tf2-eigen ament_cmake_clang_format > {{ ros_root_dir }}/ros2.{{ ros_distro }}.{{ ros_pkg }}.rosinstall" diff --git a/ansible/setup.yaml b/ansible/setup.yaml index 95c8151..4048be6 100644 --- a/ansible/setup.yaml +++ b/ansible/setup.yaml @@ -14,10 +14,6 @@ - ptp4l_client_interface: eqos0 - ptp4l_host_interface: eth0 vars_prompt: -# - name: prompt_install_camera_driver -# prompt: |- -# [Warning] Do you want to install/update the TIER IV camera driver? [y/N] -# private: false - name: prompt_configure_network prompt: |- [Warning] Do you want to configure the network? This configuration may overwrite the IP address of the specific network interface [y/N] @@ -26,14 +22,8 @@ - role: autoware - role: cuda - role: cyclonedds -# - role: docker - role: vcstool -# - role: calibration_tools -# - role: tier4_hdr_camera_driver -# when: prompt_install_camera_driver == 'y' - role: ros2 -# - role: ptp4l_client -# when: prompt_configure_network == 'y' - role: ptp4l_host when: prompt_configure_network == 'y' - role: enlarge_txqueue diff --git a/setup-dev-env.sh b/setup-dev-env.sh index e2ac2a5..b17569c 100755 --- a/setup-dev-env.sh +++ b/setup-dev-env.sh @@ -10,12 +10,6 @@ if ! (command -v sudo >/dev/null 2>&1); then apt-get -y install sudo fi -# Disable inactive apt repository -# DISABLE_TARGET="/etc/apt/sources.list.d/roscube.list" -# if [ -e ${DISABLE_TARGET} ]; then -# sudo sed -i 's/.*neuron\.adlinktech\.com.*/# &/g' ${DISABLE_TARGET} -# fi - # Install git if ! (command -v git >/dev/null 2>&1); then sudo apt-get -y update From b3c6a344e82d47775d5a80bc544d8f871e7cdb66 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Tue, 21 Nov 2023 12:12:41 +0900 Subject: [PATCH 26/29] push for testing --- ansible/roles/cuda/tasks/main.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ansible/roles/cuda/tasks/main.yaml b/ansible/roles/cuda/tasks/main.yaml index e7cf5b0..d1ec2ba 100644 --- a/ansible/roles/cuda/tasks/main.yaml +++ b/ansible/roles/cuda/tasks/main.yaml @@ -1,9 +1,14 @@ +- name: Gather package facts + ansible.builtin.package_facts: + manager: apt + - name: Install apt packages become: true ansible.builtin.apt: name: - nvidia-jetpack update_cache: true + when: "'nvidia-jetpack' not in ansible_facts.package" - name: Add settings to autoware.env ansible.builtin.blockinfile: From 0b285e4837aa595fc23f0676b19cfa528622555b Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Tue, 21 Nov 2023 17:11:31 +0900 Subject: [PATCH 27/29] purge opencv installation before installing jetpack --- ansible/roles/cuda/tasks/main.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ansible/roles/cuda/tasks/main.yaml b/ansible/roles/cuda/tasks/main.yaml index d1ec2ba..ba203fc 100644 --- a/ansible/roles/cuda/tasks/main.yaml +++ b/ansible/roles/cuda/tasks/main.yaml @@ -1,6 +1,10 @@ -- name: Gather package facts - ansible.builtin.package_facts: - manager: apt +- name: Remove OpenCV installation + become: true + ansible.builtin.apt: + name: + - "*opencv" + state: absent + purge: true - name: Install apt packages become: true @@ -8,7 +12,6 @@ name: - nvidia-jetpack update_cache: true - when: "'nvidia-jetpack' not in ansible_facts.package" - name: Add settings to autoware.env ansible.builtin.blockinfile: From aab70e17fa65e6c44c7144700c1248a944bfc427 Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Wed, 22 Nov 2023 11:36:13 +0900 Subject: [PATCH 28/29] remove opencv build dir after removing opencv installation --- ansible/roles/cuda/tasks/main.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ansible/roles/cuda/tasks/main.yaml b/ansible/roles/cuda/tasks/main.yaml index ba203fc..97b3651 100644 --- a/ansible/roles/cuda/tasks/main.yaml +++ b/ansible/roles/cuda/tasks/main.yaml @@ -6,6 +6,11 @@ state: absent purge: true +- name: Remove OpenCV build directory + ansible.builtin.file: + path: "{{ ansible_env.HOME }}/source_builds/jetson-containers" + state: absent + - name: Install apt packages become: true ansible.builtin.apt: From a8b30ce1b0d39c92280a66adc7502c2aa03f2ddf Mon Sep 17 00:00:00 2001 From: Benjamin Gilby Date: Tue, 23 Jan 2024 12:14:46 +0900 Subject: [PATCH 29/29] various fixes --- ansible/roles/cuda/tasks/main.yaml | 5 +++-- ansible/roles/ros2/tasks/main.yaml | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ansible/roles/cuda/tasks/main.yaml b/ansible/roles/cuda/tasks/main.yaml index 97b3651..76fd679 100644 --- a/ansible/roles/cuda/tasks/main.yaml +++ b/ansible/roles/cuda/tasks/main.yaml @@ -1,8 +1,9 @@ -- name: Remove OpenCV installation +- name: Remove NVIDIA Jetpack installation and OpenCV installation become: true ansible.builtin.apt: name: - - "*opencv" + - "*nvidia-jetpack*" + - "*opencv*" state: absent purge: true diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index 0ac3575..0adf1ba 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -137,6 +137,11 @@ chdir: "{{ range_v3_directory }}/range-v3-0.11.0/build" become: true +- name: Check ROS install directory existence + ansible.builtin.stat: + path: "{{ ros_root_dir }}/install" + register: ros_install_dir_exist + - name: Build ROS2 Humble block: - name: Add the ROS deb repo to the apt sources list @@ -205,6 +210,7 @@ - scikit-build - cmake extra_args: "--upgrade --no-cache-dir" + become: true - name: Could NOT find Python3 workaround ansible.builtin.apt: name: @@ -275,6 +281,16 @@ ansible.builtin.apt: clean: true become: true + when: not ros_install_dir_exist.stat.exists + +- name: Add sourcing command in user's bashrc + ansible.builtin.blockinfile: + path: "{{ ansible_env.HOME }}/.bashrc" + state: present + marker: "# {mark} ros2" + block: | + source {{ ros_root_dir }}/install/setup.bash + when: not ros_install_dir_exist.stat.exists - name: Install extra edge-auto-jetson dependency ansible.builtin.apt: