|
| 1 | +# Getting started to use the REP-2017's infrastructure. |
| 2 | +This memo explains how to use the REP-2017's infrastructure proposed in the pull-request below. |
| 3 | +https://github.com/ros-infrastructure/rep/pull/385 |
| 4 | + |
| 5 | +Throughout the procedures below, you can prepare the environment where the ROS 2 and benchmark application use the thread attribute configuration feature. |
| 6 | + |
| 7 | +## [Host PC] Create an SD card for Raspberry Pi 4 |
| 8 | +````bash |
| 9 | +$ wget https://github.com/ros-realtime/ros-realtime-rpi4-image/releases/download/22.04.1_v5.15.39-rt42-raspi_ros2_humble/ubuntu-22.04.1-rt-ros2-arm64+raspi.img.xz |
| 10 | +# |
| 11 | +$ sudo rpi-imager --cli ubuntu-22.04.1-rt-ros2-arm64+raspi.img.xz [SD card's device node, e.g. /dev/sdc] |
| 12 | +```` |
| 13 | +After booting with the SD card above, you have to configure the Raspberry Pi 4 to connect to the internet. |
| 14 | +
|
| 15 | +## Prepare the build/execution environment for ROS 2 and sample benchmark. |
| 16 | +````bash |
| 17 | +$ sudo apt purge -y needrestart |
| 18 | +$ sudo apt update && sudo apt install -y locales |
| 19 | +$ sudo locale-gen en_US en_US.UTF-8 |
| 20 | +$ sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 |
| 21 | +$ export LANG=en_US.UTF-8 |
| 22 | +$ sudo apt update && sudo apt install -y software-properties-common |
| 23 | +$ sudo add-apt-repository universe |
| 24 | +$ sudo apt update && sudo apt install -y curl |
| 25 | +$ sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg |
| 26 | +$ 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 |
| 27 | +$ sudo apt update && sudo apt install -y \ |
| 28 | + python3-flake8-docstrings \ |
| 29 | + python3-pip \ |
| 30 | + python3-pytest-cov \ |
| 31 | + ros-dev-tools |
| 32 | +$ sudo apt update && sudo apt install -y \ |
| 33 | + python3-flake8-blind-except \ |
| 34 | + python3-flake8-builtins \ |
| 35 | + python3-flake8-class-newline \ |
| 36 | + python3-flake8-comprehensions \ |
| 37 | + python3-flake8-deprecated \ |
| 38 | + python3-flake8-import-order \ |
| 39 | + python3-flake8-quotes \ |
| 40 | + python3-pytest-repeat \ |
| 41 | + python3-pytest-rerunfailures |
| 42 | +$ sudo apt update && sudo apt install -y libacl1-dev |
| 43 | +## needed to execute reference system's benchmark below |
| 44 | +## https://github.com/ros-realtime/reference-system |
| 45 | +$ sudo pip install bokeh==2.4.3 |
| 46 | +$ sudo pip install pandas |
| 47 | +$ sudo pip install psrecord |
| 48 | +## Disable preinstalled ROS 2 humble. |
| 49 | +$ sudo rm /etc/profile.d/99-source-ros.sh |
| 50 | +$ sudo reboot |
| 51 | +```` |
| 52 | +## Build ROS 2 Rolling, adopting the patches related to the REP-2017. |
| 53 | +````bash |
| 54 | +$ mkdir -p ros2_rolling/src |
| 55 | +$ cd ros2_rolling |
| 56 | +$ vcs import -w 1 src < ~/rolling-with-thread-attribute-configuration-extention-rep2017.repos |
| 57 | +# Copy the repos file above from the repository below. |
| 58 | +# https://github.com/esol-community/reference-system/tree/rep2017_demo/misc |
| 59 | +$ touch src/gazebo-release/COLCON_IGNORE |
| 60 | +$ touch src/ros2/rviz/COLCON_IGNORE |
| 61 | +$ sudo rosdep init |
| 62 | +$ rosdep install --from-paths src --ignore-src -y --skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers" |
| 63 | +$ colcon build --symlink-install --executor sequential |
| 64 | +# It takes at least 10 hours to self-build on the Raspberry Pi 4. |
| 65 | +```` |
| 66 | + |
| 67 | +## Build reference-system benchmark modified to use the REP-2017 infrastructure. |
| 68 | +````bash |
| 69 | +$ mkdir -p ~/ros2_ws/src |
| 70 | +$ cd ~/ros2_ws/src |
| 71 | +$ git clone -b rep2017_demo https://github.com/esol-community/reference-system.git |
| 72 | +$ cd ~/ros2_ws |
| 73 | +$ source ~/ros2_rolling/install/setup.bash |
| 74 | +$ colcon build --symlink-install --executor sequential |
| 75 | +```` |
| 76 | + |
| 77 | +## Execute the benchmark(prioritized). |
| 78 | +To get the result without thread attribute settings, execute the benchmark |
| 79 | +without the dedicated environment variable (ROS_THREAD_ATTRS_FILE). |
| 80 | +````bash |
| 81 | +$ export ROS_THREAD_ATTRS_FILE= |
| 82 | +$ python3 $(ros2 pkg prefix --share autoware_reference_system)/scripts/benchmark.py 120 autoware_default_prioritized_using_rep2017 |
| 83 | +```` |
| 84 | +To get the result with the thread attribute settings, execute the benchmark after setting the environment variable to point to the YAML configuration file. |
| 85 | +````bash |
| 86 | +$ export ROS_THREAD_ATTRS_FILE=~/ros2_ws/install/autoware_reference_system/share/autoware_reference_system/cfg/thread_attr_for_prioritized.yaml |
| 87 | +$ python3 $(ros2 pkg prefix --share autoware_reference_system)/scripts/benchmark.py 120 autoware_default_prioritized_using_rep2017 |
| 88 | +```` |
| 89 | + |
| 90 | +## Execute the benchmark(singlethreaded/multithreaded). |
| 91 | +To get the result without thread attribute settings, execute the benchmark |
| 92 | +without the dedicated environment variable (ROS_THREAD_ATTRS_FILE). |
| 93 | +````bash |
| 94 | +$ export ROS_THREAD_ATTRS_FILE= |
| 95 | +$ python3 $(ros2 pkg prefix --share autoware_reference_system)/scripts/benchmark.py 120 autoware_default_singlethreaded |
| 96 | +or |
| 97 | +$ python3 $(ros2 pkg prefix --share autoware_reference_system)/scripts/benchmark.py 120 autoware_default_multithreaded |
| 98 | + |
| 99 | +```` |
| 100 | +To get the result with the thread attribute settings, execute the benchmark after setting the environment variable to point to the YAML configuration file. |
| 101 | +````bash |
| 102 | +$ export ROS_THREAD_ATTRS_FILE=~/ros2_ws/install/autoware_reference_system/share/autoware_reference_system/cfg/thread_attr_for_existing_executors.yaml |
| 103 | +$ python3 $(ros2 pkg prefix --share autoware_reference_system)/scripts/benchmark.py 120 autoware_default_singlethreaded |
| 104 | +or |
| 105 | +$ python3 $(ros2 pkg prefix --share autoware_reference_system)/scripts/benchmark.py 120 autoware_default_multithreaded |
| 106 | +```` |
| 107 | + |
0 commit comments