0% found this document useful (0 votes)
10 views8 pages

Lesson 7 Installation ROS in Docker

The document provides detailed instructions for installing ROS1 (Melodic) and ROS2 (Humble) in Docker on a Raspberry Pi. It includes steps for downloading the Docker images, creating a user, updating the system, and installing the complete desktop environments for both ROS versions. Additionally, it outlines how to test the installations by running the turtlesim GUI interface.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views8 pages

Lesson 7 Installation ROS in Docker

The document provides detailed instructions for installing ROS1 (Melodic) and ROS2 (Humble) in Docker on a Raspberry Pi. It includes steps for downloading the Docker images, creating a user, updating the system, and installing the complete desktop environments for both ROS versions. Additionally, it outlines how to test the installations by running the turtlesim GUI interface.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Lesson 7 Installation ROS in Docker

Note: Our Raspberry Pi image is already installed with ROS1 or ROS2 environment

when you receive the package. This section is provided for learning and reference only.

1. ROS1 Installation

1.1 “melodic” Version (Need Networking)


1) Press “Ctrl+Alt+T” to open the command line terminal, and enter
“docker pull ros:melodic” to download the ROS1 image. The downloading
takes time, please wait for a while with the patient.

2) After the image downloading is complete, enter “docker run -it


--network=host -d -v=/dev:/dev -v /tmp/.X11-unix:/tmp/.X11-unix --name
melodic -e DISPLAY=${DISPLAY} --restart=always ros:melodic /bin/bash” in
the terminal to run the container and name it “melodic”.

3) Enter “xhost +” in the terminal to start the accessing control of “X


Server”.

4) Enter “docker ps -a” in the terminal to check the ID of the newly created
container.

1
5) Enter “docker exec -it 75b6634e6227 /bin/bash” in the terminal to
access the container.

6) Enter “useradd -m -s /bin/bash ubuntu” in the terminal to create a new


user.

7) Enter “passwd ubuntu” in the terminal to set a password for “ubuntu”.


After successfully set, the new password needs to be input twice.

8) Enter “usermod -aG sudo ubuntu” in the terminal. Add “sudo” to the
new user “ubuntu” to give it superuser privileges.

9) Enter “sudo apt-get update -y && sudo apt-get upgrade -y” in the
terminal to update the available software package list and upgrade the
installed package on the system.

10) Enter “sudo apt-get install vim -y” in the terminal to install the “Vim”
text editor.

2
11) Enter “sudo apt-get install ros-melodic-desktop-full -y” in the terminal
to install the complete desktop environment of the “ROS Melodic” version. The
downloading takes time, please wait for a while with the patient.

1.2 ROS1 Environment Test


1) Enter the “docker exec -it -u ubuntu -w /home/ubuntu 75b6 /bin/bash”
command to access the container. (Note: “75b6” is the ID of the container with
ROS1 environment.)

2) Enter the “source /opt/ros/melodic/setup.bash” command to manually


configure the ROS1 environment.

3) Every time you open the terminal, execute step 2 to load the working
space. Enter the “echo “source /opt/ros/melodic/setup.bash” >> ~/.bashrc”
command and write it into the “.bashrc” file.

4) Then enter the “source ~/.bashrc” command to take the “.bashrc” file
into effect. This action frees you from loading the working space environment
3
every time opening the terminal.

5) Enter “rosrun turtlesim turtlesim_node” to start the turtle GUI interface.


Its successful starting indicates the successful installation of ROS1.

2. ROS2 Installation

2.1 “humble” Version (Need Networking)


1) Press “Ctrl+Alt+T” to open the command line terminal, and enter
“docker pull ros:humble” to download the ROS2 image. The downloading
takes time, please wait for a while with patient.

2) After the image downloading is complete, enter “docker run -it


--network=host -d -v=/dev:/dev -v /tmp/.X11-unix:/tmp/.X11-unix --name
humble -e DISPLAY=${DISPLAY} --restart=always ros:humble /bin/bash” in
the terminal to run the container and name it “humble”.
4
3) Enter “xhost +” in the terminal to start the accessing control of “X
Server”.

4) Enter “docker ps -a” in the terminal to check the ID of the newly created
container.

5) Enter “docker exec -it 76a092503f2e /bin/bash” in the terminal to


access the container.

6) Enter “useradd -m -s /bin/bash ubuntu” in the terminal to create a new


user.

7) Enter “passwd ubuntu” in the terminal to set a password for “ubuntu”.


After successfully set, the new password needs to be input twice.

8) Enter “usermod -aG sudo ubuntu” in the terminal. Add “sudo” to the
new user “ubuntu” to give it superuser privileges.

5
9) Enter “sudo apt-get update -y && sudo apt-get upgrade -y” in the
terminal to update the available software package list and upgrade the
installed package on the system.

10) Enter “sudo apt-get install vim -y” in the terminal to install the “Vim”
text editor.

11) Enter “sudo apt-get install ros-humble-desktop-full -y” in the terminal


to install the complete desktop environment of the the “ROS Humble” version.

2.2 ROS2 Environment Test


1) Enter the “docker exec -it -u ubuntu -w /home/ubuntu 55ce /bin/bash”
command to access the container. (Note: “55ce” is the ID of the container with
the ROS2 environment.)

6
2) Enter the “source /opt/ros/humble/setup.bash” command to manually
configure the ROS2 environment.

3) Every time you open the terminal, execute step 2 above to load the
working space. Enter the “echo “source /opt/ros/humble/setup.bash” >>
~/.bashrc” command and write it into the “.bashrc” file.

4) Then enter the “source ~/.bashrc” command to take the “.bashrc” file
into effect. This action frees you from loading the working space environment
every time opening the terminal.

5) Enter “rosrun turtlesim turtlesim_node” to start the turtle GUI interface.


Its successful starting indicates the successful installation of ROS2.

7
8

You might also like