🤖 ROS-Based Obstacle Avoidance with a Two-Wheeled Robot

Robotics • ROS • SLAM • GMapping • Navigation Algorithms

This project explored the design and development of an autonomous two-wheeled robot capable of avoiding obstacles in a simulated environment using the Robot Operating System (ROS). The primary objective was to build a complete pipeline—from robot design to motion planning and real-time decision-making using sensor input.

🛠️ Building the Robot

The journey began by modeling a basic robot using URDF and XACRO files within ROS. The chassis, wheels, and joints were defined, and the design was visualized using Rviz. Once complete, the robot was deployed in the Gazebo simulation environment. Differential drive plugins were integrated to enable movement, allowing the robot to navigate using keyboard inputs initially.

🔍 Sensor Integration

We added a laser scanner to provide environmental feedback. Using ROS plugins and real-time data topics, the robot began detecting obstacles through its front-facing sensors. We divided the 180° scan range into five distinct zones—left, center-left, center, center-right, and right—for fine-grained obstacle detection.

🧠 Motion Planning with the Bug 2 Algorithm

A major highlight was implementing the Bug 2 algorithm for obstacle avoidance. Unlike simpler navigation techniques, Bug 2 maintains a direct path to the goal and only deviates when obstacles are encountered. The robot would "hug" the obstacle boundary until it could safely rejoin the original path. This was managed via a finite state machine that toggled between 'Go to Point' and 'Wall Follow' states.

🗺️ Mapping the Environment with SLAM

To enable map creation, we incorporated GMapping, a ROS package for Simultaneous Localization and Mapping (SLAM). Using real-time data from the laser scanner and odometry sensors, the robot built a 2D map of its surroundings while navigating. This gave us a visual representation of obstacle placement and traversal paths.

✅ Key Takeaways

View Gallery ← Back to Projects