This repository contains the necessary files and configurations to simulate a two-wheeled differential robot in Gazebo that is capable of centering itself between two walls using laser scan data, IMU (Inertial Measurement Unit) readings, and odometry. The robot control is implemented in Python using ROS (Robot Operating System).
m2wr_description/
: Folder containing URDF files and launch configurations for the robot simulation.motion_plan1/
: Folder containing Python scripts for robot motion control and wall-centering behavior.
The m2wr_description
folder contains the following files:
urdf/gazebo.xacro
: Defines Gazebo properties and plugins for the robot, including materials, differential drive controller, laser sensor, and IMU.urdf/m2wr.xacro
: Main robot description file defining the robot's chassis, wheels, laser sensor, and IMU using URDF.urdf/macro.xacro
: Contains macros for defining common elements such as wheels and joints.urdf/materials.xacro
: Defines material properties used in the visual representation of the robot.launch/spawn.launch
: Launch file for spawning the robot in Gazebo. It sets parameters and launches nodes for joint state publishing, robot state publishing, and model spawning.
The motion_plan1
folder contains the following files:
pid_final.py
: Python script for controlling the robot's motion and wall-centering behavior. It subscribes to laser scan data, IMU data, and publishes velocity commands to control the robot's motion. A PID (Proportional-Integral-Derivative) controller is used to maintain a desired distance from the walls while navigating.
Ensure you have the following dependencies installed:
- ROS (Robot Operating System)
- Python 3
nav_msgs
,geometry_msgs
,sensor_msgs
, andtf
ROS packageslaser_geometry
Python package
-
Clone this repository into your ROS workspace:
git clone https://github.com/geeksahil53/Wall-Centering-Bot.git
-
Build your workspace:
catkin_make
-
Source your workspace:
source devel/setup.bash
-
Launch Gazebo simulation (if not already running).
-
Run the PID control script:
rosrun <your_workspace_name> pid_final.py
This will start the wall-centering behavior of the robot in the Gazebo simulation environment.
- Modify the PID controller parameters (
kp
,ki
,kd
) in thePID
class initialization to achieve desired performance characteristics. - Adjust the behavior of the robot based on laser scan data by modifying the
take_action
function in thepid_final.py
script.
If you encounter any issues or have suggestions for improvements, please create an issue on the repository. Contributions are welcome through pull requests.
Happy robot controlling!