|
1 |
| -# Car-Simulator |
| 1 | +# [Car Simulator](https://jasonnor.github.io/Car-Simulator/) |
2 | 2 |
|
3 |
| -Car simulator (based on JavaScript & WebGL) implemented by fuzzy control system, genetic algorithm and particle swarm optimization. |
| 3 | +Car Simulator use the fuzzy control system, genetic algorithm and particle swarm optimization to simulate the movement of the car on the map. |
| 4 | + |
| 5 | +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 steering wheel rotation angle. |
| 6 | + |
| 7 | +The target is to reach the end without encountering the wall and output the movement trajectory (including the position of each point in time, the sensor value and the steering wheel rotation angle) as a text file, then display on the graphical interface. |
| 8 | + |
| 9 | +The motion equation of the simulated car is as follows: |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +## Fuzzy Control System |
| 14 | + |
| 15 | +Fuzzy control system use the custom seven fuzzy rules and discrete center of gravity defuzzifier. See [here](Fuzzy-Control-System/js/fuzzy.js) for the details. |
| 16 | + |
| 17 | +## Genetic Algorithm |
| 18 | + |
| 19 | +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. |
| 20 | + |
| 21 | +The structure of the radial base function network is as follows: |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +## Particle Swarm Optimization |
| 26 | + |
| 27 | +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. |
| 28 | + |
| 29 | +## Getting Started |
| 30 | + |
| 31 | +[https://jasonnor.github.io/Car-Simulator/](https://jasonnor.github.io/Car-Simulator/) |
| 32 | + |
| 33 | +Car Simulator also support the VR device, please open this [page](https://jasonnor.github.io/Car-Simulator/WebVR). |
4 | 34 |
|
5 | 35 | 
|
6 | 36 |
|
7 |
| -## Working... |
| 37 | +1. Status |
| 38 | +2. Control button |
| 39 | +3. Camera first person / third person switch |
| 40 | +4. Steering wheel rotation angle and moving speed |
| 41 | +5. Start the fuzzy control system |
| 42 | +6. RBFN parameters setting |
| 43 | +7. GA parameters setting |
| 44 | +8. PSO parameters setting |
| 45 | +9. Save the trajectory and data |
| 46 | +10. Operating instructions |
| 47 | +11. Graphic interface |
| 48 | + |
| 49 | +## Instructions |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +## 4-Dimensional Output Data Format |
| 54 | + |
| 55 | + InputA1 InputB1 InputC1 Output1 |
| 56 | + InputA2 InputB2 InputC2 Output2 |
| 57 | + ... |
| 58 | + |
| 59 | +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 steering wheel rotation angle. The default [datasets](Genetic-Algorithm/dataset-4D) can be found here. |
| 60 | + |
| 61 | +## 6-Dimensional Output Data Format |
| 62 | + |
| 63 | + InputA1 InputB1 InputC1 InputD1 InputE1 Output1 |
| 64 | + InputA2 InputB2 InputC2 InputD1 InputE1 Output2 |
| 65 | + ... |
| 66 | + |
| 67 | +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 steering wheel rotation angle. The default [datasets](Genetic-Algorithm/dataset-6D) can be found here. |
| 68 | + |
| 69 | +## Preview |
| 70 | + |
| 71 | + |
8 | 72 |
|
9 | 73 | 
|
| 74 | + |
10 | 75 | 
|
| 76 | + |
11 | 77 | 
|
| 78 | + |
12 | 79 | 
|
| 80 | + |
13 | 81 | 
|
| 82 | + |
14 | 83 | 
|
| 84 | + |
| 85 | +## Contributing |
| 86 | + |
| 87 | +Please feel free to use it if you are interested in fixing issues and contributing directly to the code base. |
| 88 | + |
| 89 | +## License |
| 90 | + |
| 91 | +Car Simulator is released under the MIT license. See the [LICENSE](/LICENSE) file for details. |
0 commit comments