Differential Drive Robot Simulation
Name | Differential Drive Robot |
---|---|
Description | A custom-built robot featuring a differential drive system that calculates its position and movement based on wheel rotations |
Start | June 2024 |
Repository | DDR🔗 |
Type | Individual |
Level | Beginner |
Skills | Simulation, Programming |
Tools Used | Webots, Python |
Current Status | On Hold |
This repository contains the simulation of a Differential Drive Robot, built from scratch, which uses basic odometry to track its position. The robot is equipped with motors and position sensors to calculate its movement and orientation while navigating the environment.
Demo Video
Click the image below to watch a demo of the robot in action:
How It Works
Robot Design
The robot moves using two independent motors and tracks its position using two position sensors.
- Motors: The left and right wheels have separate motors, allowing the robot to move forward, turn, or rotate in place.
- Position Sensors: These track how much each wheel has moved, which is used for odometry (position tracking).
Odometry Calculation
The robot calculates its position based on:
- Wheel Movement: It reads the sensor values to determine how far each wheel has traveled.
- Position Updates: Using this data, the robot calculates its new
(x, y, θ)
coordinates. - Velocity Computation: The robot computes both linear speed (v) and angular speed (w) to track its movement.
The position updates continuously as the robot moves in the simulation.
Code Explanation
1. Odometry Calculation (Tracking the Robot’s Position)
- Reads values from the position sensors to determine how far the wheels have moved.
- Converts sensor readings into distance traveled.
- Updates the robot’s position and orientation using trigonometric calculations.
- Continuously prints the current position (x, y, θ) of the robot.
2. Robot Motion Control (Making the Robot Move)
- Sets both wheels at full speed to move forward.
- Adjusts wheel speeds differently to turn:
- Turns right when needed.
- Moves straight otherwise.
3. Square Path Movement
- The robot moves in a square pattern by following a sequence:
- Moves forward for a fixed distance.
- Rotates 90 degrees.
- Repeats until a full square is completed.
- The timing of movements and turns is pre-calculated to ensure accuracy.
Installation and Usage
Requirements
- Webots: Download and install the Webots robotics simulator from here.
- Python: Ensure Python is installed for running the controller code.
Steps to Run
- Clone this repository to your local machine:
git clone https://github.com/Mummanajagadeesh/differential-drive-robot-w.git cd differential-drive-robot-w
- Open Webots and load the differential_drive_robot.wbt world file in the simulation folder.
- Run the simulation to observe the robot’s movement and odometry in action.
Future Enhancements
- Path Following: Implement algorithms for following predefined paths.
- Advanced Sensors: Add ultrasonic sensors for obstacle detection.
- Improved Control: Implement PID controllers for smoother movement.