]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/blob - README.md
Link SDL2 library
[hubacji1/iamcar.git] / README.md
1 # I am car
2 Autonomous car architecture
3
4 # Build
5 [CMake] is used for project build.
6
7 ##  Prerequisities
8 - cmake
9 - libjsoncpp-dev
10 - libomp-dev
11 - libsdl2-dev
12
13 ## Commands
14 ```bash
15 mkdir build
16 cd build
17 cmake ../
18 make
19 ```
20
21 ## Compile Macros
22 Macros that affects output binary may be used with the cmake commands as
23 follows:
24 ```
25 cmake -DPLANNER=LaValle1998 ../
26 make
27 ```
28
29 The list of available macros with values:
30 - `PLANNER`
31         - `LaValle198` - RRT framework.
32         - `Kuwata2008` - RRT with changing cost and steering to goal.
33         - `Karaman2011` - RRT* framework.
34 - `TMAX` - Specify the upper time bound in seconds.
35 - `NN`
36         - `nn1` - Nearest neighbour basic DFS procedure.
37 - `NV`
38         - `nv1` - Near vertices basic DFS procedure.
39 - `SA`
40         - `sa1` - Basic sample procedure.
41 - `ST`
42         - `st1` - Steer directly to goal.
43         - `st2` - Steer with maximum turning radius and direction in mind.
44         - `st3` - Reeds and Shepp steer procedure.
45         - `st4` - Very basic closed-loop simulator.
46 - `CO`
47         - `co1` - Euclidean distance cost.
48         - `co2` - Reeds and Shepp distance.
49 - `CCO`
50         - `co3` - Cumulative cost based on Euclidean distance.
51         - `co4` - Cumulative cost based on Reeds and Shepp distance.
52
53 To disable *OpenMP*, add `-DCMAKE_DISABLE_FIND_PACKAGE_OpenMP=TRUE` to `cmake`
54 command or to `build.sh` script.
55
56 [CMake]: https://cmake.org/
57
58 # Run
59 The scenarios may be run and plot by the following example command from root:
60 ```
61 SC=lpar && cat $SC.json | ./build/go_car_go > traj.json &&
62 python plot.py $SC.json traj.json
63 ```
64
65 # Scenarios
66 The `go_car_go` program expects json formatted on std input. The output is json
67 formatted to std output.
68
69 - Street width min.: 2.75 (sometimes 2.5m).
70
71 ## Small cars (size 01)
72 - Norm: `ČSN 73 6056 s účinností od 1.8. 1988`.
73 - Perpendicular: 2.25 x 4.5m
74 - Parallel: 2.0 x 5,5m
75
76 ## Large cars (size 02)
77 - Perpendicular: 2.4 x 5.30m
78 - Parallel: 2.2 x 6.5m
79
80 ## Parallel parking example (large cars)
81 ```json
82 {
83         "init": [1.1, 6.5, 1.5707963267948966],
84         "goal": [-1.1, 14.37, 1.5707963267948966],
85         "obst": [
86                 {
87                         "segment": [
88                                 [0, 0],
89                                 [0, 13]
90                         ]
91                 },
92                 {
93                         "segment": [
94                                 [0, 13],
95                                 [-2.2, 13]
96                         ]
97                 },
98                 {
99                         "segment": [
100                                 [-2.2, 13],
101                                 [-2.2, 19.5]
102                         ]
103                 },
104                 {
105                         "segment": [
106                                 [-2.2, 19.5],
107                                 [0, 19.5]
108                         ]
109                 },
110                 {
111                         "segment": [
112                                 [0, 19.5],
113                                 [0, 26]
114                         ]
115                 },
116                 {
117                         "segment": [
118                                 [2.75, 0],
119                                 [2.75, 26]
120                         ]
121                 },
122                 {
123                         "segment": [
124                                 [0, 0],
125                                 [2.75, 0]
126                         ]
127                 },
128                 {
129                         "segment": [
130                                 [0, 26],
131                                 [2.75, 26]
132                         ]
133                 }
134         ]
135 }
136 ```
137
138 ## Perpendicular parking example
139 ```json
140 {
141         "init": [1.1, 6.5, 1.5707963267948966],
142         "goal": [-0.37, 14.2, 3.141592653589793],
143         "obst": [
144                 {
145                         "segment": [
146                                 [0, 0],
147                                 [0, 13]
148                         ]
149                 },
150                 {
151                         "segment": [
152                                 [0, 13],
153                                 [-5.3, 13]
154                         ]
155                 },
156                 {
157                         "segment": [
158                                 [-5.3, 13],
159                                 [-5.3, 15.4]
160                         ]
161                 },
162                 {
163                         "segment": [
164                                 [-5.3, 15.4],
165                                 [0, 15.4]
166                         ]
167                 },
168                 {
169                         "segment": [
170                                 [0, 15.4],
171                                 [0, 26]
172                         ]
173                 },
174                 {
175                         "segment": [
176                                 [5.5, 0],
177                                 [5.5, 26]
178                         ]
179                 },
180                 {
181                         "segment": [
182                                 [0, 0],
183                                 [5.5, 0]
184                         ]
185                 },
186                 {
187                         "segment": [
188                                 [0, 26],
189                                 [5.5, 26]
190                         ]
191                 }
192         ]
193 }
194 ```
195
196 # BATCH TEST
197         for i in {0..19}; do $( bash test.sh )&& mv log log_$i; done
198         L=l; WHAT=par; for i in {0..19}; do mv log_${i}/*${L}${WHAT}* ${WHAT}/${L}${WHAT}_${i}.json; done
199         L=r; WHAT=par; for i in {0..19}; do mv log_${i}/*${L}${WHAT}* ${WHAT}/${L}${WHAT}_${i}.json; done
200         L=l; WHAT=per; for i in {0..19}; do mv log_${i}/*${L}${WHAT}* ${WHAT}/${L}${WHAT}_${i}.json; done
201         L=r; WHAT=per; for i in {0..19}; do mv log_${i}/*${L}${WHAT}* ${WHAT}/${L}${WHAT}_${i}.json; done
202
203 # VISUAL TEST
204 ```
205 while ! timeout 2 ./bin/Kuwata2008st3co1 < lpar.json > traj.json; do
206         kill $!
207         mv traj.json t.json
208         python plot.py lpar.json t.json &
209 done
210 ```