Giter Club home page Giter Club logo

collision-mitigation-warning-system's Introduction

GPS Based Collision Mitigation Warning System


This project is first part of three project series which is related to Self-driving car. Vehicle-to-Vehicle (V2V) communication is very important part of self-driven cars and safety is the most important aspect of self-driven car. This system provides warning if two cars are approaching to each other and are in "Danger" zone.

File Structure :

input_v1.csv - dataset for vehicle 1

input_v2.csv - dataset for vehicle 2

car_collison.py - includes functions for heading, distance, cartesian coordinate conversion, Rectangle formation and Collision detection

kml_generate.py - File to generate the output file which will be in the form of '.kml' file. You can open it in Google Earth for visualization.

Run Command:

python kml_generate.py input_v1.csv input_v2.csv

Working:

When running this application in Google Earth using .kml file(output generated from this system), car color changes to "RED" if there is a chance of collision between two cars. The concept includes heading calculation, harvesine distance, define rectangle area according to velocity and check collision with Separte Axis Theorem.

1. Distance and Heading Calculation

GPS locations for two vehicles (Vehicle 1 and Vehicle 2) are given in csv files for four different datasets.

From difference between two consecutive GPS coordinate data and timestamp, we can find the vehicles heading and distance for both the vehicles. I have used Harvesine formula for distance calculation between two points which is written in harvesinefunction.

Bearing (Heading) calculation is explained in new_bearing function.

2. Define Rectangle to find collision.

ASSUMTION - Lane width is 4m and Time to Collide (TTC) is 8 seconds.

alt text

Here the idea is to define rectangle in the direction of heading. This rectangle indicates "danger" zone for that car. Basically, we have to define rectangle from following steps:

  • Calculate the length of the rectangle which depends on velocity of the car
  • Width, which is fixed(4m)
  • Define points in the direction of heading.

This is defined in rec function. See the code for more explanation regarding implementation.

3. Cartesian Coordinates

After getting the rectangle coordinates, convert those to cartesian coordinates and get (x1,y1) , (x2,y2) , (x3,y3) , (x4,y4).

This is explained in XfromGPS and YfromGPS

4. Collision Detection using SAT

This is the final section which includes collision detection using two rectangles (defined earlier for two cars) using Separate Axis Theorem.

This is defined in collision and separating_axis functions.

The final output looks like this:

alt text

Reference:

The idea (Question definition) is from one of the projects from Wayne State University which I got from Internet.

Credit to https://hackmd.io/s/ryFmIZrsl for explaining Separate axis theorem.

collision-mitigation-warning-system's People

Contributors

kathansheth avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.