Skip to content

Kush2425/LineFollowingRobot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Line Follower Robot with Obstacle Avoidance and Parking

A reactive programming implementation of an autonomous line-following robot with advanced features including obstacle detection, avoidance, and automated parking capabilities.

Overview

This project implements a sophisticated line-following robot using a state machine architecture. The robot can follow both white and black lines, navigate around obstacles, and perform autonomous parking maneuvers when reaching designated parking areas.

Team Member

  • Kush Mangukiya (24M0769)
  • Jasbir Singh Kalsi (24M0745)
  • Ashutosh Birla (24M0752)

Features

  • Dual Line Following: Supports both white line and black line following
  • Adaptive Calibration: Automatic sensor calibration during startup
  • PID Control: Smooth line following with proportional-integral-derivative control
  • Obstacle Detection: Three-sensor IR obstacle detection system
  • Obstacle Avoidance: Right-hand wall following algorithm for obstacle navigation
  • Autonomous Parking: Automatic parking detection and execution
  • U-turn Recovery: Automatic recovery when line is lost
  • State-based Architecture: Robust finite state machine implementation

Hardware Requirements

Sensors

  • 5 Line Sensors: Array of IR sensors for line detection (sen[0] to sen[4])

    • sen[0]: Leftmost sensor
    • sen[1]: Left-center sensor
    • sen[2]: Center sensor
    • sen[3]: Right-center sensor
    • sen[4]: Rightmost sensor
  • 3 Obstacle Sensors: IR proximity sensors for obstacle detection

    • irsenLeft: Left obstacle sensor
    • irsenFront: Front obstacle sensor
    • irsenRight: Right obstacle sensor

Actuators

  • 2 Motors: Differential drive system
    • Left motor speed: v_l
    • Right motor speed: v_r
  • Direction Control: Movement direction indicator

System States

1. WhitelineFollower

  • Purpose: Initial calibration phase
  • Duration: 3000 cycles for sensor averaging
  • Function: Calculates baseline sensor values for white surface detection

2. Whiteline

  • Purpose: White line following mode
  • Features:
    • PID control with gains (Kp=3, Ki=0.001, Kd=1)
    • Speed adjustment based on error magnitude
    • Transition detection for line intersections

3. LineSwitch

  • Purpose: Handles line color transitions (white to black)
  • Features:
    • Modified PID gains (Kp=2, Ki=0.001, Kd=1)
    • Inverted sensor logic for black line detection
    • Right turn detection capability

4. Blackline

  • Purpose: Black line following mode
  • Features:
    • Enhanced PID control (Kp=3, Ki=0.001, Kd=1)
    • Intersection counting for parking detection
    • U-turn detection and recovery

5. Obstacle Avoidance States

ObstacleRight

  • Turns right when obstacle detected
  • Continues until left sensor clears

ObstacleForward

  • Moves forward along obstacle edge
  • Monitors for line reacquisition

ObstacleLeft

  • Follows left wall of obstacle
  • Handles complex obstacle shapes

ObstacleFinalRight

  • Final turn to rejoin line after obstacle
  • Ensures proper line reacquisition

6. Parking System

ParkingState

  • Navigation Pattern: Follows predefined timing sequence
  • Parking Detection: Uses IR sensors at specific intervals
  • Decision Logic:
    • Both sensors clear → Go straight
    • Left clear, right blocked → Park right
    • Left blocked, right clear → Park left
    • Both blocked → Default left

Parkleft/Parkright

  • Duration: 1800 cycles
  • Phases:
    • Approach (500 cycles): Move forward
    • Turn (1200 cycles): Execute parking maneuver
    • Align (100 cycles): Final positioning

Stopstate

  • Final state - robot stops permanently
  • All outputs set to zero

Calibration Process

  1. White Surface Calibration (3000 cycles):

    • Robot placed on white surface
    • Sensors accumulate baseline readings
    • Average values calculated automatically
  2. Threshold Setting:

    • Black line threshold = white_average - 150
    • Binary conversion: sensor ≤ threshold → line detected

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published