ROS vs ROS2
1. Objective — What You Are Learning and Why
In this lesson you will understand the difference between ROS and ROS2.
The goal is not to go into deep technical details yet.
Instead, you should leave this lesson with three simple ideas:
- ROS and ROS2 share the same core concepts
- ROS2 was created to fix some architectural limitations of ROS
- If you start learning robotics today, you should generally start with ROS2
First, an important point.
The concepts you learned in the previous lesson do not change.
Both ROS and ROS2 use:
- nodes
- topics
- services
- actions
Both follow the same idea:
split a robotic system into small programs that communicate with each other.
ROS2 keeps this philosophy.
So the architecture you learned in the previous lesson still applies.
What changed is how the system works under the hood.
2. Concept Explanation — What, How, and Why
A Short History of ROS
ROS was first developed around 2007–2010 by the Willow Garage research lab.
The goal was to create a standard software framework for robotics research.
Before ROS, every robotics lab built their own software stack.
This meant:
- code was not reusable
- systems were incompatible
- development was slow
ROS solved this problem.
It gave robotics developers:
- a common architecture
- standard communication tools
- reusable packages
ROS became extremely popular.
It was used in:
- research labs
- universities
- robotics startups
But ROS had some limitations.
And as robotics moved from research to industrial systems, these limitations became more important.
Why ROS2 Was Created
ROS was designed mainly for research environments.
But when engineers started using ROS in real products, some problems appeared.
For example:
- limited real-time support
- limited reliability in networks
- not ideal for distributed systems
- Linux-only focus
- security limitations
For industrial robotics, these issues matter a lot.
So the community started developing ROS2.
ROS2 keeps the same concepts, but it rebuilds the internal architecture to be:
- more reliable
- more scalable
- compatible with real-time systems
- better suited for industrial environments
Communication Middleware
One of the biggest differences between ROS and ROS2 is how nodes communicate internally.
This is called the communication middleware.
Middleware is simply the software layer that allows different programs to send messages to each other.
You can think of it as the postal service of the system.
Nodes create messages.
The middleware delivers them.
Communication in ROS
In ROS, communication uses two protocols:
- TCPROS
- UDPROS
These are built on top of standard internet protocols like TCP and UDP.
To use ROS communication in code, developers typically use two main libraries:
rospy
This is the ROS Python library.
It allows you to write ROS nodes using Python.
For example:
- subscribing to topics
- publishing messages
- creating services
roscpp
This is the ROS C++ library.
It provides the same functionality but using C++.
So in ROS you typically build nodes using either:
- rospy (Python)
- roscpp (C++)
These libraries communicate through the ROS middleware using TCPROS or UDPROS.
Another important element in ROS is the ROS Master.
The master acts like a central directory.
It helps nodes find each other in the network.
This worked well for research systems, but it introduced limitations for large distributed systems.
Communication in ROS2
ROS2 redesigned this entire layer.
Instead of building its own communication protocol, ROS2 uses a standard system called:
DDS — Data Distribution Service
DDS is an industrial communication middleware used in many critical systems such as:
- aerospace
- autonomous vehicles
- defense systems
- distributed control systems
DDS provides several advantages:
- better reliability
- built-in discovery between nodes
- better real-time support
- improved scalability
- no need for a central master
In ROS2, your code typically uses two main libraries:
rclpy
This is the ROS2 Python client library.
It is the equivalent of rospy in ROS.
rclcpp
This is the ROS2 C++ client library.
It is the equivalent of roscpp.
Underneath these libraries there is another layer called rcl, which connects ROS2 code to DDS.
So the simplified stack looks like this:
Your code → rclpy / rclcpp → rcl → DDS → operating system.
Because DDS was designed for distributed and real-time systems, ROS2 works much better in environments where:
- timing matters
- reliability matters
- industrial integration matters
For example, this is why ROS2 can integrate much more easily with:
- industrial robots
- PLC-controlled machines
- real-time industrial systems
This is extremely important in manufacturing and industrial automation.
Build System Differences
Another difference between ROS and ROS2 is the build system.
The build system is the tool used to compile and organize ROS packages.
ROS Build System
ROS uses a build system called:
catkin
Catkin manages:
- packages
- dependencies
- compilation
- workspace builds
ROS packages are usually built inside a catkin workspace.
ROS2 Build System
ROS2 replaced catkin with a new system called:
colcon
Colcon improves several things:
- building multiple packages
- dependency handling
- build speed
- workspace flexibility
So in ROS2, your workspace is typically built with:
colcon build
This is the command you will use all the time in ROS2.
Launch Files
Launch files also changed slightly.
In ROS:
- launch files are usually written in XML
In ROS2:
- launch files are typically written in Python
Using Python makes launch files more flexible.
You can add:
- conditions
- loops
- logic
- dynamic configurations
This makes complex robotic systems easier to launch and configure.
ROS Distributions
Another important concept is the idea of a ROS distribution, often called a ROS distro.
A ROS distribution is basically a version of ROS that is released and maintained for a certain period of time.
Examples include:
- ROS Noetic
- ROS2 Foxy
- ROS2 Humble
- ROS2 Iron
Each ROS distribution is usually associated with a specific operating system distribution.
For example:
ROS Noetic
Typically used with:
- Ubuntu 20.04
ROS2 Humble
Typically used with:
- Ubuntu 22.04
Why is this important?
Because ROS distributions are tested and supported only for specific operating systems.
So when you install ROS, you must match:
ROS distro ↔ operating system distro
For example:
- ROS Noetic → Ubuntu 20.04
- ROS2 Humble → Ubuntu 22.04
Trying to mix incompatible versions can cause many problems.
Which One Should You Learn?
If you are starting from scratch today, the general recommendation is:
learn ROS2.
ROS2 is the future of the ecosystem.
However, ROS is still widely used in:
- universities
- older robotics platforms
- legacy projects
So if you join an existing project, you might still encounter ROS.
In those cases, knowing the basics of ROS is still useful.
But for new development, ROS2 is now the main direction.
3. Key Takeaways
The most important things you should remember are:
ROS and ROS2 share the same core ideas:
- nodes
- topics
- services
- actions
- modular robotics architecture
ROS2 was created to improve the original ROS architecture, especially for:
- reliability
- scalability
- real-time systems
- industrial robotics
ROS communication used:
- TCPROS / UDPROS
- rospy and roscpp libraries
- a central ROS Master
ROS2 uses:
- DDS middleware
- rclpy and rclcpp libraries
- no central master
- better support for distributed and real-time systems
ROS and ROS2 also use different build systems:
- ROS → catkin
- ROS2 → colcon
And finally, ROS and ROS2 are released in distributions, which are tied to specific operating system versions.
For example:
- ROS Noetic → Ubuntu 20.04
- ROS2 Humble → Ubuntu 22.04
If you start learning robotics today, it is usually best to start directly with ROS2, while still understanding that ROS is used in some legacy systems.
That understanding will help you navigate the robotics ecosystem much more easily.
0 comments