Skip to content

Commit

Permalink
Initialize path planning project
Browse files Browse the repository at this point in the history
  • Loading branch information
ndrplz committed Aug 16, 2017
1 parent 5893cdd commit 1ac301d
Show file tree
Hide file tree
Showing 1,608 changed files with 327,750 additions and 0 deletions.
26 changes: 26 additions & 0 deletions project_11_path_planning/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
project(Path_Planning)

cmake_minimum_required (VERSION 3.5)

add_definitions(-std=c++11)

set(CXX_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}")

set(sources src/main.cpp)


if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

include_directories(/usr/local/include)
include_directories(/usr/local/opt/openssl/include)
link_directories(/usr/local/lib)
link_directories(/usr/local/opt/openssl/lib)
link_directories(/usr/local/Cellar/libuv/1.11.0/lib)

endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")


add_executable(path_planning ${sources})

target_link_libraries(path_planning z ssl uv uWS)
136 changes: 136 additions & 0 deletions project_11_path_planning/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# CarND-Path-Planning-Project
Self-Driving Car Engineer Nanodegree Program

### Simulator.
You can download the Term3 Simulator which contains the Path Planning Project from the [releases tab (https://github.com/udacity/self-driving-car-sim/releases).

### Goals
In this project your goal is to safely navigate around a virtual highway with other traffic that is driving +-10 MPH of the 50 MPH speed limit. You will be provided the car's localization and sensor fusion data, there is also a sparse map list of waypoints around the highway. The car should try to go as close as possible to the 50 MPH speed limit, which means passing slower traffic when possible, note that other cars will try to change lanes too. The car should avoid hitting other cars at all cost as well as driving inside of the marked road lanes at all times, unless going from one lane to another. The car should be able to make one complete loop around the 6946m highway. Since the car is trying to go 50 MPH, it should take a little over 5 minutes to complete 1 loop. Also the car should not experience total acceleration over 10 m/s^2 and jerk that is greater than 50 m/s^3.

#### The map of the highway is in data/highway_map.txt
Each waypoint in the list contains [x,y,s,dx,dy] values. x and y are the waypoint's map coordinate position, the s value is the distance along the road to get to that waypoint in meters, the dx and dy values define the unit normal vector pointing outward of the highway loop.

The highway's waypoints loop around so the frenet s value, distance along the road, goes from 0 to 6945.554.

## Basic Build Instructions

1. Clone this repo.
2. Make a build directory: `mkdir build && cd build`
3. Compile: `cmake .. && make`
4. Run it: `./path_planning`.

Here is the data provided from the Simulator to the C++ Program

#### Main car's localization Data (No Noise)

["x"] The car's x position in map coordinates

["y"] The car's y position in map coordinates

["s"] The car's s position in frenet coordinates

["d"] The car's d position in frenet coordinates

["yaw"] The car's yaw angle in the map

["speed"] The car's speed in MPH

#### Previous path data given to the Planner

//Note: Return the previous list but with processed points removed, can be a nice tool to show how far along
the path has processed since last time.

["previous_path_x"] The previous list of x points previously given to the simulator

["previous_path_y"] The previous list of y points previously given to the simulator

#### Previous path's end s and d values

["end_path_s"] The previous list's last point's frenet s value

["end_path_d"] The previous list's last point's frenet d value

#### Sensor Fusion Data, a list of all other car's attributes on the same side of the road. (No Noise)

["sensor_fusion"] A 2d vector of cars and then that car's [car's unique ID, car's x position in map coordinates, car's y position in map coordinates, car's x velocity in m/s, car's y velocity in m/s, car's s position in frenet coordinates, car's d position in frenet coordinates.

## Details

1. The car uses a perfect controller and will visit every (x,y) point it recieves in the list every .02 seconds. The units for the (x,y) points are in meters and the spacing of the points determines the speed of the car. The vector going from a point to the next point in the list dictates the angle of the car. Acceleration both in the tangential and normal directions is measured along with the jerk, the rate of change of total Acceleration. The (x,y) point paths that the planner recieves should not have a total acceleration that goes over 10 m/s^2, also the jerk should not go over 50 m/s^3. (NOTE: As this is BETA, these requirements might change. Also currently jerk is over a .02 second interval, it would probably be better to average total acceleration over 1 second and measure jerk from that.

2. There will be some latency between the simulator running and the path planner returning a path, with optimized code usually its not very long maybe just 1-3 time steps. During this delay the simulator will continue using points that it was last given, because of this its a good idea to store the last points you have used so you can have a smooth transition. previous_path_x, and previous_path_y can be helpful for this transition since they show the last points given to the simulator controller with the processed points already removed. You would either return a path that extends this previous path or make sure to create a new path that has a smooth transition with this last path.

## Tips

A really helpful resource for doing this project and creating smooth trajectories was using http://kluge.in-chemnitz.de/opensource/spline/, the spline function is in a single hearder file is really easy to use.

---

## Dependencies

* cmake >= 3.5
* All OSes: [click here for installation instructions](https://cmake.org/install/)
* make >= 4.1
* Linux: make is installed by default on most Linux distros
* Mac: [install Xcode command line tools to get make](https://developer.apple.com/xcode/features/)
* Windows: [Click here for installation instructions](http://gnuwin32.sourceforge.net/packages/make.htm)
* gcc/g++ >= 5.4
* Linux: gcc / g++ is installed by default on most Linux distros
* Mac: same deal as make - [install Xcode command line tools]((https://developer.apple.com/xcode/features/)
* Windows: recommend using [MinGW](http://www.mingw.org/)
* [uWebSockets](https://github.com/uWebSockets/uWebSockets)
* Run either `install-mac.sh` or `install-ubuntu.sh`.
* If you install from source, checkout to commit `e94b6e1`, i.e.
```
git clone https://github.com/uWebSockets/uWebSockets
cd uWebSockets
git checkout e94b6e1
```
## Editor Settings
We've purposefully kept editor configuration files out of this repo in order to
keep it as simple and environment agnostic as possible. However, we recommend
using the following settings:
* indent using spaces
* set tab width to 2 spaces (keeps the matrices in source code aligned)
## Code Style
Please (do your best to) stick to [Google's C++ style guide](https://google.github.io/styleguide/cppguide.html).
## Project Instructions and Rubric
Note: regardless of the changes you make, your project must be buildable using
cmake and make!
## Call for IDE Profiles Pull Requests
Help your fellow students!
We decided to create Makefiles with cmake to keep this project as platform
agnostic as possible. Similarly, we omitted IDE profiles in order to ensure
that students don't feel pressured to use one IDE or another.
However! I'd love to help people get up and running with their IDEs of choice.
If you've created a profile for an IDE that you think other students would
appreciate, we'd love to have you add the requisite profile files and
instructions to ide_profiles/. For example if you wanted to add a VS Code
profile, you'd add:
* /ide_profiles/vscode/.vscode
* /ide_profiles/vscode/README.md
The README should explain what the profile does, how to take advantage of it,
and how to install it.
Frankly, I've never been involved in a project with multiple IDE profiles
before. I believe the best way to handle this would be to keep them out of the
repo root to avoid clutter. My expectation is that most profiles will include
instructions to copy files to a new location to get picked up by the IDE, but
that's just a guess.
One last note here: regardless of the IDE used, every submitted project must
still be compilable with cmake and make./
21 changes: 21 additions & 0 deletions project_11_path_planning/cmakepatch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--- CMakeLists.txt 2017-03-23 20:58:47.000000000 +0900
+++ CMakeListsnew.txt 2017-03-23 20:57:33.000000000 +0900
@@ -32,10 +32,16 @@
target_link_libraries (uWS LINK_PUBLIC ${OPENSSL_CRYPTO_LIBRARY})
target_link_libraries (uWS LINK_PUBLIC ${ZLIB_LIBRARY})

-if (UNIX)
+if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries (uWS LINK_PUBLIC pthread)
install (TARGETS uWS DESTINATION /usr/lib64)
install (FILES src/Extensions.h src/WebSocketProtocol.h src/Networking.h src/WebSocket.h src/Hub.h src/Group.h src/Node.h src/Socket.h src/HTTPSocket.h src/uWS.h src/uUV.h DESTINATION /usr/include/uWS)
-endif (UNIX)
+endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+
+if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+target_link_libraries (uWS LINK_PUBLIC pthread)
+install (TARGETS uWS DESTINATION /usr/local/lib)
+install (FILES src/Extensions.h src/WebSocketProtocol.h src/Networking.h src/WebSocket.h src/Hub.h src/Group.h src/Node.h src/Socket.h src/HTTPSocket.h src/uWS.h src/uUV.h DESTINATION /usr/local/include/uWS)
+endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

add_subdirectory(examples)
181 changes: 181 additions & 0 deletions project_11_path_planning/data/highway_map.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
784.6001 1135.571 0 -0.02359831 -0.9997216
815.2679 1134.93 30.6744785308838 -0.01099479 -0.9999396
844.6398 1134.911 60.0463714599609 -0.002048373 -0.9999979
875.0436 1134.808 90.4504146575928 -0.001847863 -0.9999983
905.283 1134.799 120.689735412598 0.004131136 -0.9999915
934.9677 1135.055 150.375551223755 0.05904382 -0.9982554
964.7734 1138.318 180.359313964844 0.1677761 -0.9858252
995.2703 1145.318 211.649354934692 0.3077888 -0.9514547
1025.028 1157.81 243.922914505005 0.3825578 -0.9239317
1054.498 1169.842 275.754606246948 0.3815603 -0.9243439
1079.219 1180.179 302.548864364624 0.3191902 -0.9476907
1102.047 1185.857 326.072883605957 0.1833147 -0.9830543
1127.149 1189.116 351.385223388672 0.09871602 -0.9951157
1160.17 1191.623 384.50191116333 0.06429368 -0.9979311
1182.123 1192.658 406.479455947876 0.0466392 -0.9989119
1208.36 1193.873 432.744598388672 0.03987533 -0.9992047
1235.623 1194.793 460.022594451904 -0.003609776 -0.9999935
1271.598 1193.644 496.015548706055 -0.03843856 -0.999261
1306.97 1192.049 531.42370223999 -0.07725787 -0.9970111
1340.477 1188.307 565.138957977295 -0.1019143 -0.9947932
1369.225 1185.671 594.008089065552 -0.09411526 -0.9955613
1398.31 1182.84 623.230533599854 -0.114346 -0.993441
1430.229 1178.649 655.423355102539 -0.1272429 -0.9918715
1467.004 1174.027 692.487098693848 -0.125325 -0.9921157
1492.771 1170.749 718.46262550354 -0.1135327 -0.9935344
1519.772 1167.997 745.602956771851 -0.08889008 -0.9960414
1546.772 1165.93 772.682252883911 -0.08344746 -0.9965122
1572.312 1163.598 798.328052520752 -0.0766077 -0.9970613
1598.067 1161.989 824.133642196655 -0.0760113 -0.9971071
1625.75 1159.524 851.926485061646 -0.1055453 -0.9944146
1650.008 1156.476 876.375202178955 -0.09285724 -0.9956795
1678.284 1154.625 904.711477279663 -0.07567847 -0.9971323
1705.723 1152.247 932.25301361084 -0.08113801 -0.9967029
1732.784 1150.188 959.392517089844 -0.06582308 -0.9978314
1764.228 1148.388 990.888347625732 -0.06089294 -0.9981443
1792.092 1146.57 1018.81147575378 -0.04263735 -0.9990907
1820.696 1145.978 1047.42087173462 0.03766942 -0.9992902
1848.6 1148.7 1075.45774269104 0.1151181 -0.9933518
1878.7 1152.7 1105.8223361969 0.1732973 -0.9848697
1906 1158.8 1133.79560661316 0.2394996 -0.9708965
1931.4 1165.7 1160.11612892151 0.3074293 -0.9515709
1958 1175.6 1188.49868011475 0.4260512 -0.904699
1983 1190 1217.34934234619 0.5633372 -0.826227
2004.2 1207.1 1244.5862121582 0.6943331 -0.7196538
2022.489 1228.1 1272.43389701843 0.8111242 -0.5848739
2038.835 1255.133 1304.02465629578 0.8790351 -0.476757
2053.169 1284.666 1336.85226249695 0.9165804 -0.3998505
2064.145 1313.15 1367.37812805176 0.9349459 -0.3547901
2076.104 1345.106 1401.49840164185 0.9458216 -0.3246866
2084.781 1373.266 1430.96549606323 0.9578987 -0.2871063
2093.3 1402.477 1461.39277076721 0.9620903 -0.272731
2101.777 1433.22 1493.2835483551 0.9782934 -0.2072245
2106.933 1466.839 1527.29516410828 0.9898572 -0.1420661
2111.222 1499.026 1559.76698493958 0.9881419 -0.1535434
2118.132 1538.908 1600.24263954163 0.9837797 -0.1793809
2126.803 1584.478 1646.63011360168 0.9830657 -0.1832536
2136.1 1635.3 1698.29592323303 0.9769246 -0.2135843
2157.7 1725.8 1791.33786964417 0.9773436 -0.2116588
2164.6 1766.9 1833.0130443573 0.9878795 -0.1552228
2170.6 1807.9 1874.44974327087 0.9896013 -0.1438374
2177.1 1852.9 1919.91676521301 0.9929643 -0.1184138
2180.2 1888.4 1955.55184745789 0.9943331 -0.1063093
2183.9 1916.5 1983.89436531067 0.9879052 -0.155059
2189.9 1950.2 2018.12427711487 0.9813541 -0.1922085
2196.2 1979.3 2047.89853286743 0.9807571 -0.195232
2202.6 2014 2083.18377685547 0.9832116 -0.1824688
2208.3 2044.5 2114.21182060242 0.978106 -0.2081075
2216.6 2079.8 2150.47453117371 0.9662605 -0.2575668
2225.2 2107.9 2179.86091041565 0.9567135 -0.2910315
2234.7 2139.3 2212.66669273376 0.963896 -0.2662791
2242.3 2169.8 2244.09934234619 0.9739887 -0.2265965
2247.1 2192.6 2267.39918518066 0.9787823 -0.2049031
2253.5 2223.3 2298.75912284851 0.9832389 -0.1823219
2258.3 2253 2328.84446144104 0.9839467 -0.1784626
2264.6 2284.5 2360.96829414368 0.9796195 -0.2008624
2270.5 2312.5 2389.58312988281 0.9615891 -0.2744929
2282.09 2345.77 2424.81414413452 0.947088 -0.3209741
2292.8 2378.3 2459.06186294556 0.9500042 -0.3122372
2303.71 2411.55 2494.05598449707 0.9634976 -0.2677169
2311.5 2445.6 2528.98577880859 0.9778725 -0.2092019
2316.3 2470.4 2554.24584197998 0.9832523 -0.1822498
2322.41 2504.46 2588.84957122803 0.9842378 -0.1768498
2329 2541.08 2626.05793380737 0.9902409 -0.1393661
2331.8 2571.18 2656.28774452209 0.9977358 -0.06725549
2332.1 2587.07 2672.18071365356 1 0
2331.8 2611.5 2696.61248779297 1 0
2332.1 2639.7 2724.81403541565 0.9999801 -0.006312702
2332.1 2659.03 2744.14411354065 0.9998295 -0.0184638
2332.9 2683.01 2768.13742828369 0.9998022 -0.01988864
2333.1 2709.3 2794.42823028564 0.999961 -0.008834856
2333.3 2728.3 2813.42928314209 0.9999968 -0.002508871
2333.2 2749.1 2834.22957229614 0.9999975 -0.002233857
2333.4 2773 2858.13031005859 0.9984792 0.05512987
2330.5 2798 2883.29793739319 0.9844533 0.1756466
2324.8 2821.2 2907.18783378601 0.9590173 0.2833476
2316.2 2846.4 2933.8148727417 0.9277467 0.3732107
2303.6 2873.9 2964.06394386292 0.8834426 0.4685393
2286.5 2902.4 2997.30042076111 0.8373147 0.5467212
2266.786 2930.281 3031.44725227356 0.7709385 0.6369097
2246.81 2950.443 3059.82936286926 0.6763027 0.7366239
2222 2971.4 3092.30584907532 0.5497622 0.8353212
2190.2 2987.7 3128.04007148743 0.3435533 0.9391332
2155.3 2995.8 3163.86763954163 0.1557412 0.9877979
2121.7 2998.5 3197.57604026794 0.04806948 0.998844
2094.053 2998.748 3225.22387695313 0.01201504 0.9999279
2063.083 2999.204 3256.19746017456 0.0192073 0.9998155
2032.366 2999.933 3286.92301177979 -0.0151453 0.9998853
1997.563 2998.212 3321.76837921143 -0.06530881 0.9978652
1963.766 2995.443 3355.67862319946 -0.06276703 0.9980282
1929 2993.9 3390.4790802002 -0.06750417 0.9977191
1898.1 2991 3421.51488113403 -0.1194509 0.9928401
1864.891 2986.187 3455.07110214233 -0.1654203 0.9862232
1830.363 2979.638 3490.21416854858 -0.1499853 0.9886882
1792.705 2975.236 3528.12882232666 -0.09902501 0.995085
1752.6 2971.9 3568.37232589722 -0.1009978 0.9948867
1716.5 2967.5 3604.73944473267 -0.1416101 0.9899225
1679.2 2961.4 3642.5350112915 -0.1572973 0.9875513
1644.3 2956 3677.85019302368 -0.1282835 0.9917377
1598.8 2951 3723.62409210205 -0.1229882 0.9924082
1538.467 2942.884 3784.5001335144 -0.08315027 0.996537
1481.088 2941.178 3841.90451812744 -0.02094829 0.9997806
1428.893 2940.588 3894.10328674316 0.0007269979 0.9999998
1385.381 2941.248 3937.62049102783 0.03085208 0.999524
1323.206 2943.851 3999.84999465942 0.08081907 0.9967288
1273.241 2950.341 4050.23456954956 0.1000831 0.9949791
1224.223 2953.807 4099.37530517578 0.03130078 0.99951
1163.645 2953.773 4159.95307540894 -0.02042937 0.9997913
1127.181 2951.824 4196.46884536743 -0.09344053 0.9956249
1076.317 2945.577 4247.71508026123 -0.1865232 0.9824507
1010.781 2929.725 4315.14101409912 -0.258821 0.9659254
957.2896 2913.683 4370.98598098755 -0.2463995 0.9691684
920.5009 2906.772 4408.41822814941 -0.1343836 0.9909295
872.5331 2902.189 4456.60440444946 -0.06716657 0.9977418
809.5 2899.3 4519.70372390747 -0.00617373 0.9999809
760.9 2901.5 4568.35346603394 0.03776932 0.9992865
709.4828 2903.08 4619.794921875 -0.006520033 0.9999787
651.4912 2900.787 4677.83190536499 -0.05208302 0.9986428
614.2916 2898.116 4715.12731170654 -0.1316625 0.9912946
562.6884 2888.992 4767.53088760376 -0.2052449 0.9787107
512.8154 2876.835 4818.8641242981 -0.274142 0.9616892
471.6826 2863.05 4862.24559783936 -0.3464711 0.9380608
418.5 2842 4919.44234848022 -0.4432236 0.8964111
383.2 2819.3 4961.41110992432 -0.6158115 0.7878937
345.7 2785.1 5012.16431045532 -0.7330205 0.6802067
308.5 2738.8 5071.55736923218 -0.8330534 0.5531927
277.9 2683 5135.19702529907 -0.8918767 0.4522787
255 2633.3 5189.91900253296 -0.9280702 0.3724052
237.3182 2581.866 5244.30728530884 -0.9449031 0.32735
220.1718 2532.768 5296.31378555298 -0.9477751 0.3189399
203.0656 2480.08 5351.70889663696 -0.9582791 0.2858341
188.2281 2425.674 5408.10162734985 -0.9688905 0.2474897
178.6 2384.3 5450.58114624023 -0.9826933 0.1852403
171.2963 2335.852 5499.57681655884 -0.9924971 0.122268
167.1821 2291.617 5544.00283813477 -0.9977285 0.06736647
165 2242.6 5593.06798934937 -0.9988278 0.04840581
162.4873 2194.741 5640.99279403687 -0.9994211 0.03402611
161.6546 2144.339 5691.40152740479 -0.9999855 -0.005401879
163.0776 2085.463 5750.29518508911 -0.9969574 -0.07795043
169.5 2044 5792.25253677368 -0.9848059 -0.1736591
179.4 1992.9 5844.30268859863 -0.973924 -0.2268747
192.8806 1943.632 5895.38137054443 -0.9388913 -0.3442138
215.982 1893.118 5950.92790985107 -0.9058797 -0.4235349
234.9113 1853.735 5994.62371444702 -0.9034821 -0.4286261
259.606 1801.164 6052.70541000366 -0.9147444 -0.4040332
281.9393 1747.262 6111.0514755249 -0.9286604 -0.3709309
302.4697 1693.851 6168.27206039429 -0.9303303 -0.3667228
318.9947 1653.257 6212.10101699829 -0.9131069 -0.4077201
338.3099 1613.585 6256.22454452515 -0.8910607 -0.4538842
362.7583 1567.341 6308.53430175781 -0.8816413 -0.4719203
385.6957 1525.059 6356.63659286499 -0.8683876 -0.4958861
415.7805 1474.489 6415.47916793823 -0.8622235 -0.506528
440.6 1431.6 6465.03196716309 -0.8733301 -0.4871292
466.7 1383.2 6520.02080917358 -0.8700985 -0.4928782
496 1333.8 6577.4563331604 -0.8478998 -0.5301567
527.1 1286.6 6633.98115539551 -0.8159528 -0.5781186
559.2 1244.6 6686.84335708618 -0.7464278 -0.6654665
594.5 1211 6735.57781600952 -0.6618285 -0.7496552
630.9 1181.3 6782.5570526123 -0.5641783 -0.8256531
670.6 1159 6828.09141921997 -0.4259061 -0.9047673
711.2 1143.5 6871.54959487915 -0.2637061 -0.9646032
753.2067 1136.417 6914.14925765991 -0.107399 -0.9942161
15 changes: 15 additions & 0 deletions project_11_path_planning/install-mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /bin/bash
brew install openssl libuv cmake zlib
git clone https://github.com/uWebSockets/uWebSockets
cd uWebSockets
git checkout e94b6e1
patch CMakeLists.txt < ../cmakepatch.txt
mkdir build
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
cd build
cmake ..
make
sudo make install
cd ..
cd ..
sudo rm -r uWebSockets
Loading

0 comments on commit 1ac301d

Please sign in to comment.