0% found this document useful (0 votes)
30 views23 pages

Introduction to ROS2 Programming Guide

This document introduces the Robot Operating System (ROS) and its evolution to ROS2, highlighting its importance in modern robotics as a middleware framework. It covers key concepts, architecture, and tools of ROS2, emphasizing its advantages over ROS1, such as improved communication and support for multi-robot systems. The course aims to teach students how to build and run robot software using ROS2, including simulation and control of real robots.
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)
30 views23 pages

Introduction to ROS2 Programming Guide

This document introduces the Robot Operating System (ROS) and its evolution to ROS2, highlighting its importance in modern robotics as a middleware framework. It covers key concepts, architecture, and tools of ROS2, emphasizing its advantages over ROS1, such as improved communication and support for multi-robot systems. The course aims to teach students how to build and run robot software using ROS2, including simulation and control of real robots.
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 1. Introduction to ROS Programming.

010243407-68 Robot Operating System Programming


[Link]. Noppadol Pudchuen
Production and Robotics Engineering
King Mongkut’s University of Technology North Bangkok
Topics
• Why are we here?
• What will you learn in this course?
• What is ROS?
• Problem without ROS2
• ROS1 vs ROS2
• Robot System Layers/Architecture
• Core ROS2 Concepts: Node, Topic, Message, Service & Action,
Parameters
• ROS2 Tools
• Real-World Applications
Why are we here?
• Robot are becoming software-driven systems.
• Many modern robots use ROS1/ROS2 as their
“operating system for robots”.
What will you learn in this course?
• Build and run robot software using ROS2.
• Simulate robots in Gazebo/Rviz2
• Control real robot like turtlebot3(later).
What is ROS?
• ROS = Robot Operating System(not a real OS, but a
framework/middleware).
• Build, Write, and Run code across multiple computers, and multiple
robots.
• Avoid re-implementing the software infrastructure such as, driver of the
sensor & actuators and communication between different programs
• ROS2 = redesigned ROS for :
• Multiple-robots
• Real-time
• Industry use
• Multi-platform : Linux, Windows, Microcontroller via micro-ROS
ROS2 Architecture – Middleware
• ROS2 is the middleware that help parts bridge to each other,
regardless of language(Python/C++).
• Utilizing the idea of distributed software implementation over
network (Node).
ROS2 Nodes
ROS2 Nodes ROS2 Nodes
(Robot Arm
(Camera Driver) (Algorithm)
Driver)
Problem without ROS
• If every robot project is “from scratch”
• Hard to reuse code.
• Hard to connect components, both on driver software of the hardware
and communication between the remote component.
• Hard to debug data flow.
• Many tasks to rewrite/re-implement:
• Communication
• Logging
• Configuration
• Visualization
• Re-implement everything for every time → wasted effort
Problem without ROS – What ROS2 gives you
• Standard communication (topics, services, actions)
• Standard message types(laser, images, odometry, pose, etc.)
• Tools:
• Visualization (RViz2)
• Recording (ROS2 bag)
• Build (colcon)
• Many ready-to-use packages
• Navigation → Autonomous control
• SLAM → Localization, Map-generation
• Perception → Perceiving environment through camera and algorithm
ROS1 vs ROS2
• ROS1: 0. I am publishing on /chatter 1. Who published on /chatter
• Single master ROS Master
(insecure) 2. Node Talker
• Mostly research, Talker 3. Connect to Talker Listener
less industry focus (Publisher) (Subscriber)

4. Start sending messages

• ROS2:
0. I am publishing on /chatter 1. Who published on /chatter
• Use DDS
(distributed system) Talker 2. Connect to Talker Listener
• Long-term support (Publisher) (Subscriber)
3. Start sending messages
ROS1 vs ROS2
ROS 1 ROS 2
• ROS1: Multi-robot System No standardization The network
• Single master performance of
(insecure) communication between
multi-robot system is
• Mostly research, improved
less industry focus
Platform Support Linux Linux, Windows, Mac,
• ROS2: RTOS

• Use DDS Instantaneity Missing Support


(distributed system) Stability Dependent on ROS Cancel ROS Master
Master
• Long-term support
Confidentiality Weak Good
Networking Weak Good
Robot System Layers/Architecture
Robot
High-Level Software
Running on the Computer or SBC (Jetson/ Raspberry-Pi)

- Teleoperation
- Autonomous Navigation
- Task Planners
- User Interface

Low-Level Software
Running on the Microcontroller (STM32, ESP32)
- Motor controller
- Sensor interface
- Electronics control
- Power management
Robot System Layers/Architecture – Mobile Robot
Lidar Sensor Node

/scan : range information

Odometry/
SLAM Node

/odom : position and speed


/map : obstacle and free space

Navigation Node

/cmd_vel : velocity command

Motor Controller
Core ROS2 Concepts
Core ROS2 Concepts – Node
• Node: A program that does some tasks.
• Read sensors
• Process data
• Control actuator
• ROS2 App = many nodes running together
Core ROS2 Concepts – Topic
• Topic: A channel for streaming messages
• Nodes publish message to a topic, other subscribe.
• Example:
• /scan (LaserScan)
• /image_raw(Image)
• /cmd_vel(Twist)
Core ROS2 Concepts – Message
• Message: Basic data structure sent between nodes.
• Examples:
• std_msgs/msg/String
• geometry_msgs/msg/Twist
• sensor_msgs/msg/LaserScan
• Each topic has only message type.
Core ROS2 Concepts – Service & Action
• Service: ask a question, get an answer (request, response)
• Action: send a goal; get progress updates + results
• Example: “Go to position (X, Y)” → robot navigate toward goal and sending
a current position as a feedback.
ROS2 Tools

• Rviz2 – visualize robot, lasers, frames, image, etc


ROS2 Tools
• Rviz2 – visualize robot, lasers, frames, image, etc
ROS2 Tools
• Gazebo – simulation tool with physics.

• colcon – build system.


• ROS2 CLI – list nodes, topics, services, etc.
• ROS2 Bag – record and replay data
Real-World Applications
• Autonomous Mobile Robot.
• Robot manipulator control
• 3D SLAM and Mapping
• Boiler tube inspection system
• Tank & Pipe Inspection robot
1 Assignment – Ubuntu Installation!
st

• Install the Ubuntu 22.04 (Jammy) directly on your PC/Laptop or


Virtual Maching.
• [Link]
• In your hardware configuration don’t have enough or memory
(RAM), don’t forget to use “SWAP”.
ANY QUESTION ?

DEAR STUDENTS

You might also like