Algorithms for autonomous vehicle

Embed Size (px)

Citation preview

  • 8/10/2019 Algorithms for autonomous vehicle

    1/12

    A Prototype Vehicle with Full Automatic ControlSubmitted by: Binod Shah (0914011), Neeket Agarwal (0914022),

    Siddharth Jha (0914027), Shahzad Karim (0914093)

    Under the guidance of:Prof. J. Mehedi

    Electronics and Communication Engineering Dept.

    NIT Silchar.

    ABSTRACT In this project, we have designed and implementedan autonomous vehicle(Follower)

    which follows the path directed by a manually controlled vehicle (Leader) using inter-

    vehicle wireless data transfer and infrared sensors. In this model, we investigated the

    operations of IR sensor, astable mode of 555 timer, 434Mhz RF transceiver,

    microcontroller ATMEGA16 and L293D.

    As a 2nd part of the project work we will use these concepts with concepts of image

    processing technology using Matlab for understanding the environment the moving

    according to these informations obtained after image processing.

    INTRODUCTION

    India witnessed one road accident every minute in 2011 which claimed one life every 3.7 minutes, one of the

    highest in the world. 4 out of every 5 such accidents are due to the drivers fault. These 4 out of 5 accidents can

    be eliminated by removing the driver and putting a computer in its place which controls the car. This would

    reduce the number of accidents to a great extent.

    Also, as this vehicle would be controlled by a set of rules defined in the algorithm so the traffic rules would be

    strictly followed and traffic jams could be reduced.

    So as a part of reduction of accidents and improvement of traffic in India, this project is taken up in which we design and

    implement a prototype vehicle with full automatic control.

    THEORY

    The Phases of the project:

    Phase I: An autonomous vehicle(Follower) will follow the path directed by a manually controlled vehicle

    (Leader) using inter-vehicle wireless data transfer and infrared sensors.

    Phase II: The Autonomous vehicle is mounted with specific sensors, cameras and wireless modules and

    pre-programmed to move from one point to another along a presumed path without any human

    intervention or control, avoiding obstacles in its path.

  • 8/10/2019 Algorithms for autonomous vehicle

    2/12

    Phase I:The prototype consists of two vehicles: The follower (autonomous vehicle)

    & The leader (manually controlled)

    The major components used in The Follower are:

    ATMEGA 16L

    L293D (Motor driver)

    434 Mhz RF receiver

    IR transmitter 555 Timer circuit

    DC MotorsThe major components used in the Receiver are:

    ATMEGA 16L

    IR Sensor

    434Mhz RF transmitter

    Remote control

    DC MotorsThe ATMEGA 16L is an 8 bit microcontroller used to take in inputs from sensors compare the input with the predefined

    values in the program, performs arithmetic and logical operations on the data and sends an output to its output ports. It

    consists of 4 I/O ports and 16 KB of flash memory.

    In the follower the Atmega takes in 2 bits of input from close proximity IR sensors installed at the front of the vehicle, 1

    bit of input from the RF receiver and processes it using the following program.

    #include

    #define HALF 550//550

    #define FULL 1800 //1100

    #define RHALF 524//510

    #define RFULL 1628

    #define DL 12 //7

    #define DLS 6 //6#define DLSS 2

    #define RDL 12 //7-2

    #define RDLS 6

    #define RDLSS 2

    void config_timer1()

    {

    //Configure TIMER1

    TCCR1A|=(1

  • 8/10/2019 Algorithms for autonomous vehicle

    3/12

    }

    void delay(int j)

    {

    while(j)

    j--;

    }

    void ready_to_start()

    {

    //intialize sequencePORTC=0b00000001;

    delay(20000);

    PORTC=0b00000000;

    delay(20000);

    PORTC=0b00000001;

    delay(20000);

    PORTC=0b00000000;

    delay(20000);

    PORTC=0b00000001;

    PORTC=0b00000000;

    }

    int too_close()

    {

    if(bit_is_clear(PINB,2))

    return 1;

    else

    return 0;

    }

    int path_clr()

    {

    if(bit_is_clear(PINB,1))

    return 0;

    elsereturn 1;

    }

    int found()

    {

    if(bit_is_clear(PINB,0))

    {

    return 1;

    }

    else

    {

    return 0;}

    }

    void led_on()

    {

    PORTC|=0b00000001;

    }

    void led_off()

    {

    PORTC&=0b11111100;

    }

  • 8/10/2019 Algorithms for autonomous vehicle

    4/12

    void r_left()

    {

    PORTC&=0b11000011;

    PORTC|=0b00100100;

    }

    void r_right()

    {

    PORTC&=0b11000011;

    PORTC|=0b00011000;}

    void str()

    {

    PORTC&=0b11000011;

    PORTC|=0b00010100;

    }

    void stop()

    {

    PORTC|=0b00111100;

    }

    void backwards()

    {

    PORTC&=0b11000011;

    PORTC|=0b00101000;

    }

    void main()

    {

    config_iopins();

    ready_to_start();

    delay(20000);

    int i=0,flag=1,r=0;

    int k=50;

    while(1){

    xy:

    led_off();

    while(too_close())

    backwards();

    while (found() && path_clr() && !too_close())

    {

    led_on();

    while(k && found() && path_clr() && !too_close() )

    {

    str();k--;

    }

    stop();

    delay(50); //350

    k=50;

    }

    led_off();

    if(( !(path_clr())) )

    stop();

    else if ( !(found()) && path_clr() )

  • 8/10/2019 Algorithms for autonomous vehicle

    5/12

    {

    if(r==0)

    {

    if(flag==1)

    {

    for(i=0;i

  • 8/10/2019 Algorithms for autonomous vehicle

    6/12

    if(found())

    {

    stop();

    r=1;

    flag=1;

    goto xy;

    }

    else

    r=1;}

    flag=0;

    } //end of left search

    if(r==1)

    {

    if(flag==1)

    {

    for(i=0;i

  • 8/10/2019 Algorithms for autonomous vehicle

    7/12

    delay(DL);

    stop();

    delay(DLSS);

    if(found())

    {

    stop();

    r=0 ;

    flag=1;

    goto xy;}

    }

    for(i=0;i

  • 8/10/2019 Algorithms for autonomous vehicle

    8/12

    void led_on()

    {

    PORTD=0b00000001;

    }

    void led_off()

    {

    PORTD=0b00000000;

    }

    void tx_on(){

    PORTB=0xff;

    }

    void tx_off()

    {

    PORTB=0x00;

    }

    void initialize()

    {

    DDRD=0b00000011;

    DDRA=0x00;

    DDRB=0xff;

    led_on();

    delay(1000);

    led_off();

    delay(500);

    led_on();

    delay(1000);

    led_off();

    delay(1000);

    }

    void main()

    {initialize();

    while(1)

    {

    if(detect())

    { tx_on(); led_on(); delay(50);}

    else

    {tx_off(); delay(20);led_off();}

    }

    }

  • 8/10/2019 Algorithms for autonomous vehicle

    9/12

    Block diagrams of circuits used in the two vehicles

  • 8/10/2019 Algorithms for autonomous vehicle

    10/12

  • 8/10/2019 Algorithms for autonomous vehicle

    11/12

  • 8/10/2019 Algorithms for autonomous vehicle

    12/12

    Present Areas of workWe have successfully implemented the phase I and hav started our study for the phase II of the project

    Work taken up in PHASE II Sensing the environment using image processing techniques.

    Using that information for processing and understanding the environment.

    Moving from one point to another using this estimate of the environment.

    There are three types of image processing transformations:

    o

    Image to image transformation

    o Image to information transformations

    o Information to image transformation

    Our project work involves study and implementation of Image to information transformations.

    Image to information transformations can be described by the following relation:

    Image InInformation (Data) Out

    Our Image processing interest involves the following for the project:

    Image Statistics

    Image Analysis (Image Segmentation, Feature extraction, pattern recognition)

    Computer Aided Detection and Diagnosis

    Future areas of work to be taken up Using the images from camera we would process the data using Image processing toolbox in Matlab.

    This image will be processed for present location detection, obstacle detection and accordingly the signals for

    the movement of the vehicle are generated depending on these data.

    These movement signals will then be transmitted to the vehicle through RF transciever as used in the 1stphase.