0% found this document useful (0 votes)
5 views41 pages

ROS2 Installation and Linux Basics Guide

Chapter 2 covers the installation of ROS2 and basic Linux commands necessary for its operation. It emphasizes the importance of Linux, particularly Ubuntu, for ROS2 development, detailing the file system structure and essential terminal commands. The chapter also outlines the steps for installing ROS2 on various Ubuntu versions and verifying its installation through basic command-line interface commands.
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)
5 views41 pages

ROS2 Installation and Linux Basics Guide

Chapter 2 covers the installation of ROS2 and basic Linux commands necessary for its operation. It emphasizes the importance of Linux, particularly Ubuntu, for ROS2 development, detailing the file system structure and essential terminal commands. The chapter also outlines the steps for installing ROS2 on various Ubuntu versions and verifying its installation through basic command-line interface commands.
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

Chapter 2.

ROS Installation & Basic Linux


Commands
010243407-68 Robot Operating System Programming
[Link]. Noppadol Pudchuen
Production and Robotics Engineering
King Mongkut’s University of Technology North Bangkok
Topics
• Why learn Linux for ROS2?
• Today’s plan
• Linux basics – Filesystem & Terminal
• Editing files & installing software
• ROS2 installation
• Verifying ROS2 installation
Why learn Linux for ROS2?
• ROS2 is primarily used on Linux(Ubuntu)
• Many tools and scripts assume you can:
• Open a terminal
• Navigate directories
• Install packages
• Edit configuration files

Remote control any computer/robot


Today’s plan
• Linux terminal basics

• Installing software using “apt”

• Installing / understanding ROS2 installation

• Checking that ROS2 works and environment variables are set


Getting Started with GNU/Linux
• The Linux based OS are inspired from the UNIX operating system.
• GNU/Linux is free to use and open source
• Linux is vastly used in servers
• Popular Android operating system runs in a Linux kernel!
Some of the most popular Linux distributions are Ubuntu, Debian
and Fedora
Linux

[1]
Tux the penguin, the mascot of Linux
Developer Community contributors,
Linus Torvalds

Written in C, assembly languages and others


OS family Unix-like
Working state Current
Source model Open source
Initial release September 17, 1991; 32 years ago
Getting Started with GNU/Linux
What is Ubuntu?
• Ubuntu ([Link]) is a popular Linux distribution based
on the Debian architecture
• It is freely available for use, and it is open source, so it can be
modified according to your application.
• Ubuntu can run on desktops and servers.
Getting Started with GNU/Linux
Why Ubuntu for Robotics?
• Advantage of Ubuntu in this context are
• Responsiveness
• Lightweight
• High degree of security
• Ubuntu has great community support (Frequent Releases)
• Long-term support (LTS) releases (Support for up to five years.)

The Ubuntu-ROS combination is an ideal choice for developing robots


Long-term supports (LTS) releases

Expanded Security Maintenance (ESM), The full 10-year Ubuntu LTS lifecycle is available with an Ubuntu
Pro subscription (free for personal use on up to 5 machines).

[Link]
Ubuntu Graphical User Interface (GUI)
• The Ubuntu File System
• Linux has a special drive
for storing system files.
• It is called “root” file
system.
• We assigned / for the file
system.
Ubuntu Graphical User Interface (GUI)
• The Ubuntu File System
• You can explore the file
system by opening “File
manager” as shown in
figure
Ubuntu Graphical User Interface (GUI)
• The Ubuntu File System
The following describes the uses of each folder in the file system.
Folder name Details
/bin and /sbin Contains system application similar to the C:\Windows
folder
/etc Contains system configuration files
/home/username This is equivalent to the C:\Users folder in Windows
/lib Contains library file similar to .dll files in Windows
/media Removable media is mounted in the directory such as
USB Drive, External hard-disk
/root Contains root user files (not the root user file system,
root user is the administrator of the Linux system)
Ubuntu Graphical User Interface (GUI)
• The Ubuntu File System
The following describes the uses of each folder in the file system.
Folder name Details
/usr It contains most of the program files
(equivalent to C:\Program Files in Microsoft Windows)
/var/log Contains log file written by many application
/home/username/Desktop Contains Ubuntu desktop files
/mnt The mounted partitions are show here
/boot Contains the files required to boot
/dev Contains Linux device files
Ubuntu Graphical User Interface (GUI)
• The Ubuntu File System
The following describes the uses of each folder in the file system.
Folder name Details
/opt The location for optionally installed programs
(ROS is installed to /opt)
/sys Holds the file containing information about the system
Ubuntu Graphical User Interface (GUI)
• The Ubuntu File System
• Absolute path vs Relative path
• Absolute path: the file/folder directory respect to the root (/) directory:

• Relative path: the file/folder directory respect to the user current


directory:
Terminal, Command-Line Interface(CLI)
• Terminal is a very powerful software that allowed the user control
anything in Linux!. Short cut : CTRL + ALT + T.
• The command-line tools
are faster and used often
in debugging the system.
• The Ubuntu command-
line interface is in a tool
called “Terminal”
Terminal, Command-Line Interface(CLI)
• Terminal is a very powerful software that allowed the user control
anything in Linux!. Short cut : CTRL + ALT + T.
• Prompt structure:
user@hostname:~/folder$
• User can use “TAB”
completion for any
command.
• Command history with ↑ / ↓
Terminal Commands Cheat Sheet
Navigation Commands
• man: Manual Pages for shell Commands
• This command provides the manual page of a given command.

• ls: List Directory Contents


• The ls command lists the content of files and folders in the current directory
Terminal Commands Cheat Sheet
Navigation Commands
• cd: Change Directory
• The cd command switches from one folder to another

• cd .. Go up one level, cd ~ go to home directory


• pwd: Print Working Directory
• the pwd command returns the current directory of the terminal.
Terminal Commands Cheat Sheet
File & directory operations
• mkdir : make directory
• The mkdir command create an empty folder or directory
Terminal Commands Cheat Sheet
File & directory operations
• touch: create empty file
• The touch command create an empty file.
Terminal Commands Cheat Sheet
File & directory operations
• cp: copy files or directories
• The cp command copy file or directory from one location to another.
• Usage:
- cp source file destination_folder/destination_file
- cp -r source_directory destination_directory
Terminal Commands Cheat Sheet
File & directory operations
• mv : move / rename file or folder
• The mv move or rename the target file or directory.
• Usage:
- mv old new
Terminal Commands Cheat Sheet
File & directory operations
• rm: remove files or directories
• The rm command remove file or directory forever.
• Usage:
- rm file
- rm -r directory
Terminal Commands Cheat Sheet
Viewing files
• cat: print whole file
• The cat command print whole file through terminal
Terminal Commands Cheat Sheet
Viewing files
• less: scrollable view file (q to quit)
• The less command display whole file with scrollable view.
Terminal Commands Cheat Sheet
Viewing files
• head, tail: view the beginning/end of file
• The head, tail command display the beginning/end of file.
Terminal Commands Cheat Sheet
Utility CLI
• dmesg: Display a Kernel Message
• For debugging the system. It displays the kernel logs.
Terminal Commands Cheat Sheet
Utility CLI
• lspci: List of PCI devices in the System
• The lspci command list the plugged PCI devices in the PC.
Terminal Commands Cheat Sheet
Utility CLI
• lsusb: List of USB devices in the System
• The lsusb command list the plugged USB devices in the PC.
Terminal Commands Cheat Sheet
Utility CLI
• sudo : execute any command in Administrative mode
• The sudo command is one of the most important. We use it regularly. It runs
a command with administrative privileges. We can also completely switch to
root (administrator) by using this command.
Editing files & installing software
Editing simple text files
• nano: simple text editor through the terminal
• Usage:
- save (Ctrl+o)
- exit (Ctrl+x )
Editing files & installing software
Running programs & getting help
• Running a program: “program_name” (if in PATH)
• which program_name – see where it’s installed
• man program_name – manual page (if available)
• program_name --help or -h , quick help
Editing files & installing software
Installing software using apt
• apt, apt-get: install a package in Ubuntu
• The apt command is very important and very useful. Installing a package
required root permission, so user must use sudo before the command.
• sudo apt update
• sudo apt install software_name
• sudo apt remove software_name
Editing files & installing software
Installing software using apt
• sudo apt update
• This command updates the package download location in the local
system (repository).
Editing files & installing software
Installing software using apt
• sudo apt install software_name
• This command download the target software from the repository and
install into the operating system.
ROS1 vs ROS2

37
[Link]
ROS2 installation
Which ROS2 and Ubuntu?

Ubuntu Version Supported ROS2


Ubuntu 24.04 (Noble Numbat) Jazzy Jalisco (LTS, best)
Kilted Kaiju (Newest)
Rolling Ridley
Ubuntu 22.04 (Jammy Jellyfish) Humble Hawksbill(Most stable)
Iron Irwini (EOL)
Ubuntu 20.04 (Focal Fossa) Foxy Fitzroy (EOL)
Galactic Geochelone(EOL)
Ubuntu 18.04(Bionic Beaver) Crystal Clemmys(EOL)
Dashing Diademata(EOL)
Eloquent Elusor(EOL)
ROS2 installation
• Conceptual installation process:
• 1. Add ROS2 apt repository and keys
• 2. Update repository:
sudo apt update
• 3. Install the proper meta-package (e.g. ros-humble-desktop)
sudo apt install ros-<distro>-desktop
• 4. Source setup script in .bashrc
echo "source /opt/ros/<distro>/[Link]" >> ~/.bashrc
source ~/.bashrc
• [Link]
ROS2 installation
• Checking ROS2 is installed:
- ros2 –help
• Basic ROS2 CLI commands:
- ros2 node list
- ros2 topic list
- ros2 pkg list
May the Knowledge be with you

You might also like