100% found this document useful (1 vote)
35 views66 pages

Ros Lab 1

ROS is an open-source robot operating system that provides libraries and tools to help build robot applications. It includes components for plumbing like process management and communication, tools for simulation, visualization and logging, and capabilities for robot control, planning, perception, mapping, manipulation and more. The ROS community also provides packaging of code.

Uploaded by

Souad Bouziane
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
100% found this document useful (1 vote)
35 views66 pages

Ros Lab 1

ROS is an open-source robot operating system that provides libraries and tools to help build robot applications. It includes components for plumbing like process management and communication, tools for simulation, visualization and logging, and capabilities for robot control, planning, perception, mapping, manipulation and more. The ROS community also provides packaging of code.

Uploaded by

Souad Bouziane
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/ 66

Robot Operating System 2 (ROS 2)

Lab 1: Introduction to ROS/ROS 2

Haitham El-Hussieny, PhD


October 19, 2023
Department of Mechatronics and Robotics Engineering
Egypt-Japan University of Science and Technology (E-JUST)
Alexandria, Egypt.
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

W HY ROS NOW !

1
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

W HY ROS 2 THEN ?

ROS 2 is the future

Disclaimer
In this course, we will assume no
previous knowledge of ROS.

2
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

T HE CHALLENGE !

Suppose you are working on a KUKA R820 iiwa End-effector moving (Java)

Robot for years. CartesianPTP ptpMove = ptp(destFrame);


ptpMove.setJointJerkRel(0.1).setJointVelocityRel(0.5);
toolAttachedToLBR.move(ptpMove);

3
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

T HE CHALLENGE !

Suppose you are working on a KUKA R820 iiwa End-effector moving (Java)

Robot for years. CartesianPTP ptpMove = ptp(destFrame);


ptpMove.setJointJerkRel(0.1).setJointVelocityRel(0.5);
toolAttachedToLBR.move(ptpMove);

Now, you need to move to use UR10 robot, or


use a ready avaiable code built for UR10.

End-effector moving (CB3)


movel
WaypointStart
Waypoint1
WaypointEnd1

3
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

T HE CHALLENGE !

Suppose you are working on a KUKA R820 iiwa End-effector moving (Java)

Robot for years. CartesianPTP ptpMove = ptp(destFrame);


ptpMove.setJointJerkRel(0.1).setJointVelocityRel(0.5);
toolAttachedToLBR.move(ptpMove);

Now, you need to move to use UR10 robot, or


use a ready avaiable code built for UR10.

End-effector moving (CB3)


movel
WaypointStart
Challenge: No standards. Time consuming for Waypoint1
WaypointEnd1
knowledge transfer!
3
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

R OBOT O PERATING S YSTEM (ROS):

End-effector moving (Java)


Developer
CartesianPTP ptpMove = ptp(destFrame);
ptpMove.setJointJerkRel(0.1).setJointVelocityRel(0.5); target_pose.pose.position.x = 0.5;

ROS
toolAttachedToLBR.move(ptpMove); target_pose.pose.position.y = 0.0;
target_pose.pose.position.z = 0.9;
group.setPoseTarget(target_pose);

End-effector moving (CB3)


movel
WaypointStart
Waypoint1
WaypointEnd1
4
ROS facilitates standardization among different robots.
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

O UTLINE

1. What is and why ROS 2?

2. ROS 2 Design Philosophy

3. Basic Linux Commands

4. ROS 2 Command Line Interface (CLI).

5
What is and why ROS 2?
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

W HAT IS ROS?
R OBOT O PERATING S YSTEM (ROS):
The Robot Operating System (ROS) is a set of open-source software libraries and tools that
help you build robot applications.

6
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

W HAT IS ROS?
R OBOT O PERATING S YSTEM (ROS):
The Robot Operating System (ROS) is a set of open-source software libraries and tools that
help you build robot applications.

Plumbing
Process
management.
Inter-process
communication.
Device drivers. 6
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

W HAT IS ROS?
R OBOT O PERATING S YSTEM (ROS):
The Robot Operating System (ROS) is a set of open-source software libraries and tools that
help you build robot applications.

Plumbing
Tools
Process
management. Simulation

Inter-process Visualization
communication. Data logging
Device drivers. 6
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

W HAT IS ROS?
R OBOT O PERATING S YSTEM (ROS):
The Robot Operating System (ROS) is a set of open-source software libraries and tools that
help you build robot applications.

Capabilites
Plumbing
Tools Control
Process
management. Simulation Planning

Inter-process Visualization Perception


communication. Data logging Mapping
Device drivers. Manipulation 6
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

W HAT IS ROS?
R OBOT O PERATING S YSTEM (ROS):
The Robot Operating System (ROS) is a set of open-source software libraries and tools that
help you build robot applications.

Community
Capabilites
Plumbing Packaging
Tools Control
Process Software
management. Simulation Planning
distribution
Inter-process Visualization Perception
Documentation
communication. Data logging Mapping
Tutorials
Device drivers. Manipulation 6
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

H ISTORY OF ROS

Originally developed in 2007 at the Stanford


Artificial Intelligence Laboratory.
Since 2013 managed by OSRF (open robotics).
Today used by many robots, universities and
companies.

7
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

ROS 1 A RCHITECTURE

ROS Node:
It is the basic unit of processing. ROS ROS
Node 1 Node 2

ROS
Master

Client libraries
(roscpp, rospy)

TCPROS/ UDPROS

Linux

8
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

ROS 1 A RCHITECTURE

ROS Node:
It is the basic unit of processing. ROS ROS
Node 1 Node 2
ROS Master:
The core of ROS program. Nodes need to
register theselves and communicate through it. ROS
(Problematic!) Master

Client libraries
(roscpp, rospy)

TCPROS/ UDPROS

Linux

8
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

ROS 1 A RCHITECTURE

ROS Node:
It is the basic unit of processing. ROS ROS
Node 1 Node 2
ROS Master:
The core of ROS program. Nodes need to
register theselves and communicate through it. ROS
(Problematic!) Master

Client libraries:
C++ and Python programming language are Client libraries
(roscpp, rospy)
supported.
TCPROS/ UDPROS

Linux

8
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

ROS 1 A RCHITECTURE

ROS Node:
It is the basic unit of processing. ROS ROS
Node 1 Node 2
ROS Master:
The core of ROS program. Nodes need to
register theselves and communicate through it. ROS
(Problematic!) Master

Client libraries:
C++ and Python programming language are Client libraries
(roscpp, rospy)
supported.
TCP/ UDP: TCPROS/ UDPROS

For peer-to-peer communications.


Linux

8
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

ROS 1 A RCHITECTURE

ROS Node:
It is the basic unit of processing. ROS ROS
Node 1 Node 2
ROS Master:
The core of ROS program. Nodes need to
register theselves and communicate through it. ROS
(Problematic!) Master

Client libraries:
C++ and Python programming language are Client libraries
(roscpp, rospy)
supported.
TCP/ UDP: TCPROS/ UDPROS

For peer-to-peer communications.


Linux OS: Linux
ROS 1 is supported by Linux OS.
8
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

S TARTING OF ROS 2.

Limitations of ROS 1:
Built for a single robot.
Not real-time.
Needs reliable network.
Single point of failure.
Next-generation ROS: Building on DDS (2014).
First official release of ROS 2: Ardent Apalone,
December 2017.

ROS 2 Ardent Apalone

9
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

ROS 2 VS . ROS 1

ROS 1 ROS 2
ROS ROS ROS ROS ROS
Node 1 Node 2 Node 1 Node 2 Node 3

ROS
Client libraries
Master
(rclpy, rclcpp)

Abstract DDS
Client libraries
(roscpp, rospy) Intra-process
DDS
API
TCPROS/ UDPROS

Linux, Windows, Mac OS


Linux

10
ROS 2 Design Philosophy
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

ROS 1 BASIC C ONCEPTS

Reference Book: ROS Robot Programming (in English).Authors: Yoonseok Pyo, Hancheol Cho, Leon Jung, 11
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

ROS 2 OVER DDS

What is DDS?
DDS stands for Data
Distribution Service.
DDS is an open standard for
data-centric communication
middleware.
It enables efficient, real-time
data exchange between
components in a distributed
system.
mDDS offers a
publish-subscribe model. ROS 2 layered design

12
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

ROS 2 BASIC C ONCEPT

ROS 2 breaks complex systems down into many modular nodes. Topics are a vital
element of the ROS graph that act as a bus for nodes to exchange messages.

13
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

ROS 2 BASIC C ONCEPT

Example: Kobuki robot

The Kobuki robot driver is a ROS node that communicates with the robot’s hardware,
publishing the bumper state, and recieving the robot’s velocity.

14
Basic Linux Commands
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

Ubuntu is a popular open-source Linux-based


operating system that is widely used for personal
computers, servers, and cloud computing.
Ubuntu is preferred for ROS/ ROS 2:
1. ROS is natively supported on Ubuntu.
2. Large user and developer community.

In this course we will use Ubuntu 20.04.5 LTS


with ROS 2 Foxy (EoL in April of 2023)

You can use Ubuntu 22.04 LTS with ROS 2


Humble LTS (EoL in May 2027)

15
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

ROS 2 I NSTALLATION .

Steps to follow (ROS 2 Foxy on Ubuntu 20.04):


Install Ubuntu 20.04 in Dual Boot.
Installation of ROS 2 Foxy on Ubuntu 20.04
Download VSCode for Ubuntu.
Install terminator for Ubuntu.

ROS 2 Foxy Fitzroy

16
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

ROS 2 I NSTALLATION .

Steps to follow (ROS 2 Humble on Ubuntu 22.04):


Install Ubuntu 22.04 in Dual Boot.
Installation of ROS 2 Humble on Ubuntu 22.04
Download VSCode for Ubuntu.
Install terminator for Ubuntu.

ROS 2 Humble Hawksbill

17
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

pwd
It shows us the file path of the working
directory.

18
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

pwd
It shows us the file path of the working
directory.
mkdir
“mkdir” command creates a folder on the
working directory.
$ mkdir folder1

18
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

pwd
It shows us the file path of the working
directory.
mkdir
“mkdir” command creates a folder on the
working directory.
$ mkdir folder1
mkdir -p
“mkdir -p” command creates nested folders
on the working directory.
$ mkdir -p folder2/folder3

18
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

pwd touch
It shows us the file path of the working This command creates any file that has a
directory. specific extension.
mkdir $ touch file2.py
“mkdir” command creates a folder on the $ touch file2.cpp
working directory.
$ mkdir folder1
mkdir -p
“mkdir -p” command creates nested folders
on the working directory.
$ mkdir -p folder2/folder3

18
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

pwd touch
It shows us the file path of the working This command creates any file that has a
directory. specific extension.
mkdir $ touch file2.py
“mkdir” command creates a folder on the $ touch file2.cpp
working directory.
cat
$ mkdir folder1 The cat command opens any file on the
mkdir -p terminal.
“mkdir -p” command creates nested folders $ cat file.py
on the working directory.
$ mkdir -p folder2/folder3

18
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

pwd touch
It shows us the file path of the working This command creates any file that has a
directory. specific extension.
mkdir $ touch file2.py
“mkdir” command creates a folder on the $ touch file2.cpp
working directory.
cat
$ mkdir folder1 The cat command opens any file on the
mkdir -p terminal.
“mkdir -p” command creates nested folders $ cat file.py
on the working directory. ls
$ mkdir -p folder2/folder3 lists all files and folders in the directory.

18
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

history
The “History” command lists all previously
used commands.

19
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

history
The “History” command lists all previously
used commands.
sudo
The “sudo” command makes the user a
superuser for only one operation.
$ sudo apt-get install python3

19
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

history
The “History” command lists all previously
used commands.
sudo
The “sudo” command makes the user a
superuser for only one operation.
$ sudo apt-get install python3
clear
The “clear” command clears the terminal
screen.

19
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

history
The “History” command lists all previously man ls
The “man ls” command gives pieces of
used commands.
information about the commands.
sudo
The “sudo” command makes the user a
superuser for only one operation.
$ sudo apt-get install python3
clear
The “clear” command clears the terminal
screen.

19
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

history
The “History” command lists all previously man ls
The “man ls” command gives pieces of
used commands.
information about the commands.
sudo
The “sudo” command makes the user a sudo apt-get install
Install the specified package.
superuser for only one operation. $ sudo apt-get install nano
$ sudo apt-get install python3
clear
The “clear” command clears the terminal
screen.

19
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

history
The “History” command lists all previously man ls
The “man ls” command gives pieces of
used commands.
information about the commands.
sudo
The “sudo” command makes the user a sudo apt-get install
Install the specified package.
superuser for only one operation. $ sudo apt-get install nano
$ sudo apt-get install python3
sudo apt-get remove
clear Uninstall the specified package.
The “clear” command clears the terminal $ sudo apt-get remove nano
screen.

19
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

nano
he nano command is a text editor that works
on the terminal.
$ nano hello world.py

20
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

nano
he nano command is a text editor that works
on the terminal.
$ nano hello world.py
cp
The “cp” command copies that we specified
file into a specific folder.
$ cp file1.py folder1

20
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

nano
he nano command is a text editor that works
on the terminal.
$ nano hello world.py
cp
The “cp” command copies that we specified
file into a specific folder.
$ cp file1.py folder1
cp -r
The “cp -r” command copies a specified
folder into another folder.

20
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

nano mv
he nano command is a text editor that works Moves/renames any file or folder into another
on the terminal. folder.
$ nano hello world.py $ move file.py folder2
$ move file.py file2.py
cp
The “cp” command copies that we specified
file into a specific folder.
$ cp file1.py folder1
cp -r
The “cp -r” command copies a specified
folder into another folder.

20
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

nano mv
he nano command is a text editor that works Moves/renames any file or folder into another
on the terminal. folder.
$ nano hello world.py $ move file.py folder2
$ move file.py file2.py
cp
The “cp” command copies that we specified chmod +x
file into a specific folder. give the execute right to the file
$ cp file1.py folder1 $ chmod +x file.py

cp -r
The “cp -r” command copies a specified
folder into another folder.

20
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

BASIC L INUX C OMMANDS

nano mv
he nano command is a text editor that works Moves/renames any file or folder into another
on the terminal. folder.
$ nano hello world.py $ move file.py folder2
$ move file.py file2.py
cp
The “cp” command copies that we specified chmod +x
file into a specific folder. give the execute right to the file
$ cp file1.py folder1 $ chmod +x file.py

cp -r cd
The “cp -r” command copies a specified change the directory
folder into another folder. $ cd myfolder

20
ROS 2 Command Line Interface
(CLI).
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

C ONFIGURING ENVIRONMENT

After ROS 2 installation, two workspace are used:


Underlay: The core ROS 2 workspace.
located in /opt/ros/foxy/. (for Humble: /opt/ros/humble/)
Overlay: The user local workspaces.
e.g. /home/ros2 ws/

21
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

C ONFIGURING ENVIRONMENT

After ROS 2 installation, two workspace are used:


Underlay: The core ROS 2 workspace.
located in /opt/ros/foxy/. (for Humble: /opt/ros/humble/)
Overlay: The user local workspaces.
e.g. /home/ros2 ws/

Source the underlay setup files


We need to run this command on every new shell to have access to the ROS 2
commands:
$ source /opt/ros/foxy/setup.bash
$ source /opt/ros/humble/setup.bash For Humble

21
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

C ONFIGURING ENVIRONMENT

After ROS 2 installation, two workspace are used:


Underlay: The core ROS 2 workspace.
located in /opt/ros/foxy/. (for Humble: /opt/ros/humble/)
Overlay: The user local workspaces.
e.g. /home/ros2 ws/

Source the underlay setup files


We need to run this command on every new shell to have access to the ROS 2
commands:
$ source /opt/ros/foxy/setup.bash
$ source /opt/ros/humble/setup.bash For Humble

Otherwise, we can put the sourcing line in the .bashrc file


$ gedit .bashrc
# Add the sourcing line, save, and close.
21
$ source .bashrc
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

U SING TURTLESIM , ROS 2, AND RQT

Turtlesim
Turtlesim is a lightweight simulator for learning ROS 2.

22
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

U SING TURTLESIM , ROS 2, AND RQT

Turtlesim
Turtlesim is a lightweight simulator for learning ROS 2.

1. Install Turtlesim
$ sudo apt-get install ros-foxy-turtlesim

22
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

U SING TURTLESIM , ROS 2, AND RQT

Turtlesim
Turtlesim is a lightweight simulator for learning ROS 2.

1. Install Turtlesim
$ sudo apt-get install ros-foxy-turtlesim

2. Run turtlesim node in turtlesim package:


ros2 run [package name] [node name]
$ ros2 run turtlesim turtlesim node

22
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

U SING TURTLESIM , ROS 2, AND RQT

Turtlesim
Turtlesim is a lightweight simulator for learning ROS 2.

1. Install Turtlesim
$ sudo apt-get install ros-foxy-turtlesim

2. Run turtlesim node in turtlesim package:


ros2 run [package name] [node name]
$ ros2 run turtlesim turtlesim node

3. Run turtle teleop key node:


$ ros2 run turtlesim turtle teleop key

22
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

U SING TURTLESIM , ROS 2, AND RQT

1. List all the running ROS 2 nodes


$ ros2 node list
/teleop turtle
/turtlesim

2. Get info about a certain node:


$ ros2 node info turtlesim

3. Visualize nodes communication:


$ rqt graph

23
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

U SING TURTLESIM , ROS 2, AND RQT

ROS 2 topics are unidirectional and allow communication of 1:N, N:1 or N:N.

24
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

U SING TURTLESIM , ROS 2, AND RQT

1. List all running ROS 2 topics:


$ ros2 topic list
/parameter events
/rosout
/turtle1/cmd vel
/turtle1/color sensor
/turtle1/pose

25
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

U SING TURTLESIM , ROS 2, AND RQT

1. List all running ROS 2 topics:


$ ros2 topic list
/parameter events
/rosout
/turtle1/cmd vel
/turtle1/color sensor
/turtle1/pose
2. Get information about a certain topic:
$ ros2 topic info
/turtle1/cmd vel

25
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

U SING TURTLESIM , ROS 2, AND RQT

1. List all running ROS 2 topics:


$ ros2 topic list
/parameter events
/rosout
/turtle1/cmd vel
/turtle1/color sensor
/turtle1/pose
2. Get information about a certain topic:
$ ros2 topic info
/turtle1/cmd vel
3. Get information about a certain message:
$ ros2 interface show
geometry msgs/Twist

25
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

U SING TURTLESIM , ROS 2, AND RQT

Publishing and subscribing to topics:


1. Publish data on a ROS 2 topic:
ros2 topic pub <topic name> <msg type> ’<args>’
$ ros2 topic pub --once /turtle1/cmd vel geometry msgs/msg/Twist
"linear: x: 2.0, y: 0.0, z: 0.0, angular: x: 0.0, y: 0.0,
z: 1.8"

26
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

U SING TURTLESIM , ROS 2, AND RQT

Publishing and subscribing to topics:


1. Publish data on a ROS 2 topic:
ros2 topic pub <topic name> <msg type> ’<args>’
$ ros2 topic pub --once /turtle1/cmd vel geometry msgs/msg/Twist
"linear: x: 2.0, y: 0.0, z: 0.0, angular: x: 0.0, y: 0.0,
z: 1.8"

To send the command continously:


$ ros2 topic pub --rate 1 /turtle1/cmd vel geometry msgs/msg/Twist
"linear: x: 2.0, y: 0.0, z: 0.0, angular: x: 0.0, y: 0.0,
z: 1.8"

26
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

U SING TURTLESIM , ROS 2, AND RQT

Publishing and subscribing to topics:


1. Publish data on a ROS 2 topic:
ros2 topic pub <topic name> <msg type> ’<args>’
$ ros2 topic pub --once /turtle1/cmd vel geometry msgs/msg/Twist
"linear: x: 2.0, y: 0.0, z: 0.0, angular: x: 0.0, y: 0.0,
z: 1.8"

To send the command continously:


$ ros2 topic pub --rate 1 /turtle1/cmd vel geometry msgs/msg/Twist
"linear: x: 2.0, y: 0.0, z: 0.0, angular: x: 0.0, y: 0.0,
z: 1.8"

2. Recieve data from a certain topic:


$ ros2 topic echo /turtle1/cmd vel
26
What is and why ROS 2? ROS 2 Design Philosophy Basic Linux Commands ROS 2 Command Line Interface (CLI).

End of Lecture

[email protected]

27

You might also like