|
| 1 | +--- |
| 2 | +additional_search_terms: |
| 3 | +- linux |
| 4 | +- cloud |
| 5 | + |
| 6 | + |
| 7 | +layout: installtoolsall |
| 8 | +minutes_to_complete: 30 |
| 9 | +author: Odin Shen |
| 10 | +multi_install: false |
| 11 | +multitool_install_part: false |
| 12 | +official_docs: https://www.ros.org/blog/getting-started/ |
| 13 | +test_images: |
| 14 | +- ubuntu:latest |
| 15 | +test_maintenance: true |
| 16 | +title: ROS2 |
| 17 | +tool_install: true |
| 18 | +weight: 1 |
| 19 | +--- |
| 20 | + |
| 21 | +The Robot Operating System [ROS](https://www.ros.org/) is a set of software libraries and tools for building robot applications. |
| 22 | +ROS 2 is the latest version, designed to enhance security, improve distributed system communication, and support real-time performance, addressing some of the limitations of ROS 1. |
| 23 | + |
| 24 | +## Before you begin |
| 25 | + |
| 26 | +ROS2 is available for Ubuntu Linux 22.04, 24.04 and Windows 11. |
| 27 | + |
| 28 | +This article provides a quick solution to install ROS2 for Ubuntu on Arm. |
| 29 | + |
| 30 | +Confirm you are using an Arm machine by running: |
| 31 | + |
| 32 | +```bash |
| 33 | +uname -m |
| 34 | +``` |
| 35 | + |
| 36 | +The output should be: |
| 37 | + |
| 38 | +```output |
| 39 | +aarch64 |
| 40 | +``` |
| 41 | + |
| 42 | +If you see a different result, you are not using an Arm computer running 64-bit Linux. |
| 43 | + |
| 44 | +## How do I Install ROS2 for Ubuntu on Arm? |
| 45 | + |
| 46 | +We will install ROS 2 using APT. |
| 47 | +By default, the Ubuntu package lists do not include ROS 2, so you need to manually execute the setup first. |
| 48 | + |
| 49 | +```bash |
| 50 | +sudo apt update |
| 51 | +sudo apt install curl -y |
| 52 | +sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg |
| 53 | +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" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null |
| 54 | +``` |
| 55 | + |
| 56 | +There are two of distros (Jazzy Jalisco and Humble Hawksbill) can be installed depended on your Ubuntu version. |
| 57 | +For Ubuntu Linux 24.04, you should use Jazzy Jalisco. |
| 58 | +For Ubuntu Linux 22.04, you should use Humble Hawksbill. |
| 59 | + |
| 60 | +{{< tabpane code=true >}} |
| 61 | + {{< tab header="Ubuntu 24.04" language="bash">}} |
| 62 | + sudo apt update |
| 63 | + sudo apt install ros-jazzy-desktop |
| 64 | + sudo apt install ros-jazzy-ros-base |
| 65 | + source /opt/ros/jazzy/setup.bash |
| 66 | + {{< /tab >}} |
| 67 | + {{< tab header="Ubuntu 22.04" language="bash">}} |
| 68 | + sudo apt update |
| 69 | + sudo apt install ros-humble-desktop |
| 70 | + sudo apt install ros-humble-ros-base |
| 71 | + sudo apt install ros-dev-tools |
| 72 | + source /opt/ros/humble/setup.bash |
| 73 | + {{< /tab >}} |
| 74 | +{{< /tabpane >}} |
| 75 | + |
| 76 | +Confirm the version `ros2` is installed by using printenv: |
| 77 | + |
| 78 | +```bash |
| 79 | +printenv ROS_DISTRO |
| 80 | +``` |
| 81 | +The output should print either `jazzy` or `humble`, depending on your Ubuntu version. |
| 82 | + |
| 83 | + |
| 84 | +## Quick test on ROS2 |
| 85 | + |
| 86 | +In one terminal run a `talker`: |
| 87 | + |
| 88 | +```bash |
| 89 | +ros2 run demo_nodes_cpp talker |
| 90 | +``` |
| 91 | + |
| 92 | +The output will continue to be similar to the one shown below, indicating that ROS 2 is publishing the “hello world” string along with a sequence number. |
| 93 | + |
| 94 | +```output |
| 95 | +[INFO] [1741389626.338343545] [talker]: Publishing: 'Hello World: 1' |
| 96 | +[INFO] [1741389627.338329328] [talker]: Publishing: 'Hello World: 2' |
| 97 | +[INFO] [1741389628.338317118] [talker]: Publishing: 'Hello World: 3' |
| 98 | +[INFO] [1741389629.338322551] [talker]: Publishing: 'Hello World: 4' |
| 99 | +[INFO] [1741389630.338318200] [talker]: Publishing: 'Hello World: 5' |
| 100 | +[INFO] [1741389631.338334884] [talker]: Publishing: 'Hello World: 6' |
| 101 | +[INFO] [1741389629.338322551] [talker]: Publishing: 'Hello World: 7' |
| 102 | +[INFO] [1741389630.338318200] [talker]: Publishing: 'Hello World: 8' |
| 103 | +[INFO] [1741389631.338334884] [talker]: Publishing: 'Hello World: 9' |
| 104 | +... |
| 105 | +``` |
| 106 | + |
| 107 | +Then, open another terminal source the setup file and then run `listener`: |
| 108 | +{{< tabpane code=true >}} |
| 109 | + {{< tab header="Ubuntu 24.04" language="bash">}} |
| 110 | + source /opt/ros/jazzy/setup.bash |
| 111 | + ros2 run demo_nodes_cpp listener |
| 112 | + {{< /tab >}} |
| 113 | + {{< tab header="Ubuntu 22.04" language="bash">}} |
| 114 | + source /opt/ros/humble/setup.bash |
| 115 | + ros2 run demo_nodes_cpp listener |
| 116 | + {{< /tab >}} |
| 117 | +{{< /tabpane >}} |
| 118 | + |
| 119 | +If you see "I heard [Hello World: ]" in second terminal shown below, it's mean your ROS2 has been successfully installed. |
| 120 | +You are now ready to use ROS2. |
| 121 | + |
| 122 | +```output |
| 123 | +[INFO] [1741389927.137762134] [listener]: I heard: [Hello World: 1] |
| 124 | +[INFO] [1741389928.125120177] [listener]: I heard: [Hello World: 2] |
| 125 | +[INFO] [1741389929.125042010] [listener]: I heard: [Hello World: 3] |
| 126 | +[INFO] [1741389930.125046472] [listener]: I heard: [Hello World: 4] |
| 127 | +[INFO] [1741389931.125055785] [listener]: I heard: [Hello World: 5] |
| 128 | +[INFO] [1741389932.125434760] [listener]: I heard: [Hello World: 6] |
| 129 | +[INFO] [1741389933.125044887] [listener]: I heard: [Hello World: 7] |
| 130 | +[INFO] [1741389934.125124370] [listener]: I heard: [Hello World: 8] |
| 131 | +[INFO] [1741389935.125036222] [listener]: I heard: [Hello World: 9] |
| 132 | +... |
| 133 | +``` |
0 commit comments