Robotics is a branch of engineering that integrates mechanical, electrical, and software systems to create intelligent machines capable of perceiving, reasoning, and acting in the physical world. From self-driving cars to robotic arms in manufacturing, robotics has transformed industries by automating tasks that are repetitive, dangerous, or beyond human capability.
Before ROS, every robotics project required developers to:
✅ Build custom software for each robot.
✅ Write low-level code for sensor communication, motion control, and path planning.
✅ Reinvent the wheel every time for common functionalities like SLAM (Simultaneous Localization and Mapping) and navigation.
🚧 No common framework to integrate different hardware and software.
🚧 Difficult collaboration—robotics labs were isolated, and there was no standard platform.
🚧 Expensive development cycles—teams built everything from scratch.
In 2007, Willow Garage developed ROS (Robot Operating System) to solve these problems.
🌍 Goal: Create a modular, reusable, and standardized software framework for all robots.
🚀 Impact: By 2012, ROS became the de facto standard in robotics research.
ROS 1 was revolutionary but had limitations:
❌ No real-time support—critical for robots like autonomous cars.
❌ Weak security—no built-in encryption or authentication.
❌ Centralized communication—relies on a ROS Master, creating a single point of failure.
❌ Limited multi-robot support—not designed for distributed systems.
ROS 2 (released in 2017) addressed these issues with:
✅ Real-time capability—critical for industrial robotics.
✅ Decentralized architecture—eliminates the ROS Master.
✅ Secure communication—encryption and authentication supported.
✅ Native multi-robot support—ideal for swarm robotics and industrial applications.
| Feature | ROS 1 | ROS 2 | micro-ROS |
|---|---|---|---|
| Real-time support | ❌ No | ✅ Yes | ✅ Yes |
| Communication Middleware | Custom TCP | DDS (Real-time) | DDS (Embedded) |
| Multi-Robot Support | ❌ Limited | ✅ Built-in | ✅ Built-in |
| Security | ❌ None | ✅ Encryption | ✅ Lightweight |
| Embedded Device Support | ❌ No | ✅ Partial | ✅ Full |
🚀 What is micro-ROS?
micro-ROS is a lightweight version of ROS 2 for microcontrollers (MCUs) used in small embedded robots.
📌 Why is it needed?
Most robots have low-power devices (e.g., sensors, actuators, microcontrollers). ROS 2 is too heavy for these devices. micro-ROS extends ROS 2 features to embedded systems, allowing:
✅ Real-time execution
✅ Low-power consumption
✅ Seamless integration with ROS 2 systems
Example Use Cases:
🏎️ Self-driving cars (real-time processing of sensors)
🤖 Industrial automation (small embedded controllers)
📡 Drones and UAVs (flight control & navigation)
- A node is an independent process performing a task.
- Example: A camera node captures images, while a processing node detects objects.
- Nodes communicate using topics.
- A Publisher sends messages.
- A Subscriber receives messages.
- Used for one-time interactions.
- Example: A robot requests sensor calibration.
- Used for tasks that take time (e.g., robot navigation).
- Handles robot positioning and frame transformations.
ros2 pkg create <package_name> --build-type ament_python # Create a new package (Python)
ros2 pkg create <package_name> --build-type ament_cmake # Create a new package (C++)
ros2 pkg list # List all installed packagescolcon build --packages-select <package_name> # Build a specific package
colcon build # Build all packages
source install/setup.bash # Source the workspace
ros2 topic list # List all active topics
ros2 topic echo /<topic_name> # Print messages from a topic
ros2 topic pub /<topic_name> std_msgs/msg/String "data: 'Hello ROS2'" # Publish a message
ros2 interface show std_msgs/msg/String # Show message structureros2 service list # List all active services
ros2 service call /<service_name> std_srvs/srv/Empty # Call a service
ros2 interface show std_srvs/srv/Empty # Show service structureros2 action list # List all available actions
ros2 action send_goal /<action_name> <action_type> # Send an action goal
ros2 interface show <action_type> # Show action structureros2 launch <package_name> <launch_file.py> # Launch a filecolcon_ws/ # Root workspace
├── src/ # Source directory (contains packages)
│ ├── my_package/ # Example ROS2 package
│ │ ├── my_package/ # Python module directory
│ │ │ ├── __init__.py
│ │ │ ├── my_node.py # ROS2 node
│ │ ├── launch/ # Launch files
│ │ │ ├── my_launch.py
│ │ ├── setup.py # Python package setup
│ │ ├── package.xml # Package metadata
│ │ ├── resource/ # Marker files
│ │ ├── test/ # Test scripts
├── build/ # Build files (auto-generated)
├── install/ # Installed packages (auto-generated)
├── log/ # Logs directory
import rclpy
from std_msgs.msg import String
def main(args=None):
rclpy.init(args=args)
node = rclpy.create_node('publisher')
publisher = node.create_publisher(String, 'topic', 10)
msg = String()
i = 0
def timer_callback():
nonlocal i
msg.data = 'Hello World: {0}'.format(i)
i += 1
node.get_logger().info('Publishing: "{0}"'.format(msg.data))
publisher.publish(msg)
timer = node.create_timer(1.0, timer_callback)
rclpy.spin(node)
node.destroy_timer(timer)
node.destroy_node()
rclpy.shutdown()import rclpy
from std_msgs.msg import String
node = None
def chatter_callback(msg):
global node
node.get_logger().info('I heard: "{0}"'.format(msg.data))
def main(args=None):
global node
rclpy.init(args=args)
node = rclpy.create_node('subscriber')
node.create_subscription(String, 'topic', chatter_callback, 10)
while rclpy.ok():
rclpy.spin_once(node)
node.destroy_node()
rclpy.shutdown()📡 Run the Publisher:
ros2 run my_package talker🎯 Run the Subscriber:
ros2 run my_package listener- 3D simulation of robots in realistic environments.
- Physics engine for gravity, collisions, and dynamics.
- Visualizes sensor data (laser scans, cameras, maps).
- Shows robot state, transformations (TF), and navigation goals.
- Provides plugins for plotting data, viewing node graphs, monitoring topics, and managing parameters.
- Useful for real-time debugging without writing additional code.