Coder Social home page Coder Social logo

jasonnor / car-simulator Goto Github PK

View Code? Open in Web Editor NEW
355.0 8.0 61.0 38.75 MB

Autonomous car simulator (based on JavaScript & WebGL) implemented by fuzzy control system, genetic algorithm and particle swarm optimization.

Home Page: https://jasonnor.github.io/Car-Simulator/

License: MIT License

JavaScript 86.04% CSS 1.18% HTML 12.78%
javascript fuzzy-control genetic-algorithm particle-swarm-optimization webgl virtual-reality artificial-intelligence autonomous-car machine-learning

car-simulator's Introduction

Car Simulator use the fuzzy control system, genetic algorithm and particle swarm optimization to simulate the movement of the autonomous car on the map. It also support VR device, see here for details.

Input contains the three distance sensors of the car (front, 45 degrees left and right), which can be obtained from the defined motion equation, the position of car and the angle between the car and the horizontal axis. Output is the rotation angle of steering wheel.

The target is to reach the end line without encountering the wall and output the movement trajectory (including the position of each point in time, the sensor value and the rotation angle of steering wheel) as a text file, then display on the graphical interface.

The motion equation of the simulated car is as follows:

motion-equation

Fuzzy Control System

Fuzzy control system use the custom seven fuzzy rules and discrete center of gravity defuzzifier. See here for the details.

Genetic Algorithm

Car Simulator use the real-valued genetic algorithm (GA) to train the radial base function network (RBFN) and the car will control by RBFN. The gene is defined as the three parameters of RBFN (w, m, ฯƒ) of mixed dimension vector. The fitness function is the mean variance of the expected output of the data set and the RBFN output in the specific input case. The lowest fitness value is the best RBFN parameter.

The structure of the radial base function network is as follows:

rbfn

Particle Swarm Optimization

Car Simulator can also use the particle swarm optimization (PSO) to train RBFN. The PSO coordinate is defined as the three parameters of RBFN (w, m, ฯƒ) of mixed dimension vector. The fitness function is the mean variance of the expected output of the data set and the RBFN output in the specific input case. The lowest fitness value is the best RBFN parameter.

Getting Started

https://jasonnor.github.io/Car-Simulator/

Car Simulator also support the VR device, please open this page.

preview

  1. Status
  2. Control button
  3. Camera first person / third person switch
  4. Rotation angle of steering wheel and moving speed
  5. Start the fuzzy control system
  6. RBFN parameters setting
  7. GA parameters setting
  8. PSO parameters setting
  9. Save the trajectory and data
  10. Operating instructions
  11. Graphic interface

Instructions

instructions

4-Dimensional Output Data Format

InputA1 InputB1 InputC1 Output1
InputA2 InputB2 InputC2 Output2
...

Where InputA is value of center distance sensor, InputB is value of right distance sensor, InputC is value of left distance sensor and output is rotation angle of steering wheel. The default datasets can be found here.

6-Dimensional Output Data Format

InputA1 InputB1 InputC1 InputD1 InputE1 Output1
InputA2 InputB2 InputC2 InputD1 InputE1 Output2
...

Where InputA is X coordinate of the car, InputB is Y coordinate of the car, InputC is value of center distance sensor, InputD is value of right distance sensor, InputE is value of left distance sensor and output is rotation angle of steering wheel. The default datasets can be found here.

Preview

fuzzy

camera

trajectory

first-person

success

failure

poor-driving

Reference

Contributing

Please feel free to use it if you are interested in fixing issues and contributing directly to the code base.

License

Car Simulator is released under the MIT license. See the LICENSE file for details.

car-simulator's People

Contributors

jasonnor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

car-simulator's Issues

create a new map

Hey, the simulator is cool and I want to create some new map for research use.
Can I got the meaning of the coordinate[4] and coordinate[5] in the map definition? something like 0,1 or -1 0

var map1 = [
        [-6, -13, 6, -13, 0, 1],
        [-6, -13, -6, 22, -1, 0],
        [-6, 22, 18, 22, 0, 1],
        [18, 22, 18, 50, -1, 0],
        [18, 50, 30, 50, 0, -1],
        [6, -13, 6, 10, 1, 0],
        [6, 10, 30, 10, 0, -1],
        [30, 10, 30, 50, 1, 0]
    ],

The map I try to create, corner is not so good, I think not setting proper data of last two words

var map4 = [
        [-15, -15, 65, -15, 0, 1],
        [-15, -15,-15, 65, -1, 0],
        [-15, 65, 65, 65,0,1],
        [65, 65, 65, -15, -1, 0],
        [0, 0, 0, 20, 0, 0],
        [0, 0, 50, 0, 1, 0],
        [0, 20, 50, 20, 0, -1],
        [50, 0, 50, 20, 1, 0],
        [0, 20, 30, 20, 0, -1],
        [0, 35, 0, 50, 1, 0],
        [0, 35, 50, 35, 0, -1],
        [0, 50, 50, 50, 1, 0],
        [50,50, 50, 35, 0, -1]
  
    ],

image

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.