Line Follower Robot
Name | LFRBOT |
---|---|
Description | This project features a robot that follows a line using basic sensors. It detects the line on the ground and adjusts its movement to stay on track. The robot can navigate turns and intersections without needing complex algorithms |
Start | June 2024 |
Repository | LFRBOT🔗 |
Type | Individual |
Level | Beginner |
Skills | Simulation, Programming |
Tools Used | Webots, Python |
Current Status | On Hold |
This project simulates a line-following robot using the Webots robotics simulator. The robot, based on the e-puck model, follows a black track created in Tinkercad using two IR sensors.
Features
- Simulation of a simple line-following robot using two infrared (IR) sensors placed on either side of the robot.
- Black track designed in Tinkercad, exported and used in the Webots simulation.
- Simple control logic based on IR sensor values to adjust the robot’s movement.
- No PID controller is used; instead, the robot makes decisions using basic conditional statements to steer left or right based on sensor readings.
Demo Video
Click the image below to watch a demo of the simulation in action:
How It Works
Robot Design
The robot used in this simulation is the e-puck, a simple differential drive robot with two IR sensors positioned on the left and right sides. These sensors detect the black line against the background, and based on their readings, the robot adjusts its movement.
- Left IR Sensor (
ir0
): Detects the black line on the left side. - Right IR Sensor (
ir1
): Detects the black line on the right side. - Wheels: Two differential drive motors control the movement of the robot (left and right wheels).
Track Design
The black track was created in Tinkercad and exported into the simulation environment. You can find the track mesh file in the meshes folder.
Control Logic
The robot’s movement is controlled by checking the values of the left and right IR sensors and adjusting the wheel velocities accordingly:
- Straight Movement: If both sensors detect similar values, the robot moves forward.
- Turning:
- If the left IR sensor detects the black line (i.e., its value increases), the robot turns left by reducing the left motor’s speed and potentially reversing it.
- If the right IR sensor detects the black line, the robot turns right by reducing the right motor’s speed.
The control logic does not involve a PID controller. Instead, basic threshold-based conditions are used to decide the robot’s steering direction.
Code Explanation
Key Points:
- Timestep: The simulation steps are updated every 32ms.
- Max Speed: The maximum angular velocity for the motors is set to 25% of the full motor speed (6.28 rad/s).
- IR Sensor Values: The values of the IR sensors are used to detect the black line. A value between 6 and 15 indicates the robot is over the line, and the respective motor is slowed or reversed to turn the robot.
- Motor Control: The motors are set to velocity mode, and their speed is adjusted based on the sensor inputs. When one sensor detects a stronger signal, the robot turns in that direction.
Installation and Usage
Requirements
- Webots: Install the Webots robotics simulator from here.
- Python: Ensure that you have Python installed to run the robot controller.
Steps to Run
- Clone this repository to your local machine:
git clone https://github.com/Mummanajagadeesh/line-follower-robot-w.git cd line-follower-robot-w
- Open Webots and load the line_follower_robot.wbt world file in the simulation folder.
- Run the simulation and observe the robot following the line on the black track.
Meshes
The meshes folder contains the black track design exported from Tinkercad. This is used in the Webots simulation for the robot to follow.
Future Enhancements
- PID Control: Although the current implementation uses basic threshold logic, PID control can be added for smoother and more accurate line following.
- Speed Optimization: The robot speed can be adjusted dynamically based on how sharply it needs to turn.
- Additional Sensors: Adding more IR sensors could improve the robot’s accuracy when following complex curves or intersections in the track.