This project implements a ROS2 Humble–based autonomous robot navigation system using Python (rclpy). It demonstrates a real-world robotics software architecture where sensing, decision-making, and execution are separated into independent ROS2 nodes that communicate via topics.
The project focuses on ROS2 fundamentals, node-based design, and middleware communication, without using Gazebo or RViz.
Understand ROS2 architecture deeply
Implement publisher–subscriber communication
Separate robot software into logical nodes
Simulate an autonomous navigation pipeline
Build interview-ready, industry-aligned robotics software
sensor_node → /obstacle_distance → controller_node → /cmd_move → robot_node
Simulates an ultrasonic sensor
Publishes distance values periodically
Outputs fake distance data in meters
Subscribes to distance data
Applies safety threshold logic
Decides whether the robot should MOVE or TURN
Publishes movement commands
Subscribes to movement commands
Updates robot position and direction
Logs robot state continuously
This architecture mirrors real robotics middleware design used in autonomous systems.
ROS2 Humble
Python (rclpy)
Publisher–Subscriber communication
Standard ROS2 messages (std_msgs)
Linux / WSL environment
robot_nav/
sensor_node.py — sensor data handling
controller_node.py — control logic
robot_node.py — main robot node
init.py
setup.py
package.xml
README.md
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
ros2 pkg create robot_nav --build-type ament_python
This creates the base ROS2 package structure.
cd robot_nav/robot_nav
touch sensor_node.py
touch controller_node.py
touch robot_node.py
Publishes Float32 messages on /obstacle_distance
Uses a timer to publish data periodically
Simulates ultrasonic distance readings
Subscribes to /obstacle_distance
Applies threshold logic
Publishes String commands (MOVE / TURN) on /cmd_move
Subscribes to /cmd_move
Updates robot position (x, y)
Updates direction (N, E, S, W)
Logs robot state
The nodes are registered as executable scripts:
entry_points={
'console_scripts': [
'sensor_node = robot_nav.sensor_node:main',
'controller_node = robot_nav.controller_node:main',
'robot_node = robot_nav.robot_node:main',
],
},
This allows running nodes using ros2 run.
cd ~/ros2_ws
colcon build
source install/setup.bash
ros2 run robot_nav sensor_node
ros2 run robot_nav controller_node
ros2 run robot_nav robot_node
List active topics:
ros2 topic list
Expected topics:
/obstacle_distance
/cmd_move
View live data:
ros2 topic echo /obstacle_distance
ros2 topic echo /cmd_move
The system runs with:
Sensor node publishing distance values
Controller node deciding MOVE / TURN
Robot node updating position and direction
| Robotics Concept | ROS2 Implementation |
|---|---|
| Ultrasonic sensor | sensor_node |
| Control logic | controller_node |
| Motor execution | robot_node |
| Middleware | ROS2 topics |
| Control loop | ROS2 callbacks |
Sensor data is simulated
Reactive navigation only
No global path planning
No visualization tools (Gazebo / RViz)
These limitations are intentional to focus on core ROS2 architecture.
ROS2 launch files
Integration with real sensors
Path planning algorithms (A*, BFS)
Visualization using RViz
Hardware integration (Arduino / micro-ROS)
Arulesh P P
Robotics Software Engineer
