> For the complete documentation index, see [llms.txt](https://davids-tutorials.gitbook.io/robotics/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://davids-tutorials.gitbook.io/robotics/ignore-extra/ros2-iron.md).

# ROS2 (Iron)

set of software libraries and tools that help you build robot applications

[Installation instructions](https://docs.ros.org/en/iron/Installation/Ubuntu-Install-Debians.html) or continue here (same tutorial)

```
locale  # check for UTF-8

sudo apt update && sudo apt install locales # had to restart
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8

locale  # verify settings
```

```
sudo apt install software-properties-common
sudo add-apt-repository universe
```

```
sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
```

```
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
```

```
sudo apt update && sudo apt install ros-dev-tools -y
```

```
sudo apt update && sudo apt upgrade -y
```

```
sudo apt install ros-iron-desktop -y
```

***

### [Setup environment](https://docs.ros.org/en/iron/Installation/Ubuntu-Install-Debians.html#id8)[](https://docs.ros.org/en/iron/Installation/Ubuntu-Install-Debians.html#setup-environment)

```
source /opt/ros/iron/setup.bash
```

### [Try some examples](https://docs.ros.org/en/iron/Installation/Ubuntu-Install-Debians.html#id9)[](https://docs.ros.org/en/iron/Installation/Ubuntu-Install-Debians.html#try-some-examples)

In one terminal, source the setup file and then run a C++ `talker`:

```
source /opt/ros/iron/setup.bash
ros2 run demo_nodes_cpp talker
```

In another terminal source the setup file and then run a Python `listener`:

```
source /opt/ros/iron/setup.bash
ros2 run demo_nodes_py listener
```

### ROS2 version

```
cd /opt/ros
ls
#displays ROS2 version
```

### Uninstall

```
sudo apt remove ~nros-iron-* && sudo apt autoremove
```
