Branch data Line data Source code
1 : : // ----------------- BEGIN LICENSE BLOCK ---------------------------------
2 : : //
3 : : // Copyright (C) 2019-2021 Intel Corporation
4 : : //
5 : : // SPDX-License-Identifier: LGPL-2.1-only
6 : : //
7 : : // ----------------- END LICENSE BLOCK -----------------------------------
8 : :
9 : : #include <ad/rss/map/test_support/RssWorldModelCreationTest.hpp>
10 : :
11 : : struct RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North
12 : : : public ad::rss::map::test_support::RssWorldModelCreationTestWithRoute
13 : : {
14 : : /*
15 : : * | O4 |
16 : : * | |
17 : : * | |
18 : : * | O3 |___________
19 : : * |
20 : : * | O2 O1 O0
21 : : * |
22 : : * | E2 E3 E4
23 : : * | ____________
24 : : * | E1 |
25 : : * | |
26 : : * | |
27 : : * | E0 |
28 : : */
29 : : };
30 : :
31 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e0_o0)
32 : : {
33 [ + - + - ]: 4 : performConstellationTest(
34 [ + - ]: 1 : locationSouthIncoming(),
35 [ + - ]: 2 : locationEastIncoming(),
36 : : std::initializer_list<ExpectedResultTuple>{
37 : : // here we get 2 object predictions, all leading to the opposite direction case
38 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 3u, 0u, ::ad::physics::Speed(15.2778)),
39 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 3u, 0u, ::ad::physics::Speed(15.2778))});
40 : 1 : }
41 : :
42 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e0_o1)
43 : : {
44 [ + - + - ]: 4 : performConstellationTest(
45 [ + - ]: 1 : locationSouthIncoming(),
46 [ + - ]: 2 : locationEastEntering(),
47 : : std::initializer_list<ExpectedResultTuple>{
48 : : // here we get 2 object predictions, all leading to the opposite direction case
49 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778)),
50 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778))});
51 : 1 : }
52 : :
53 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e0_o2)
54 : : {
55 [ + - + - ]: 4 : performConstellationTest(
56 [ + - ]: 1 : locationSouthIncoming(),
57 [ + - ]: 2 : locationEast2North(),
58 : : std::initializer_list<ExpectedResultTuple>{
59 : : // here we still get 2 object predictions, leading to the opposite direction case
60 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778)),
61 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778))});
62 : 1 : }
63 : :
64 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e0_o3)
65 : : {
66 [ + - + - ]: 3 : performConstellationTest(
67 [ + - ]: 1 : locationSouthIncoming(),
68 [ + - ]: 2 : locationNorthExiting(),
69 : : std::initializer_list<ExpectedResultTuple>{
70 : : // here we identify that the other drives in front not on our route
71 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::NotRelevant, 3u, 0u, ::ad::physics::Speed(100.))});
72 : 1 : }
73 : :
74 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e0_o4)
75 : : {
76 [ + - + - ]: 3 : performConstellationTest(
77 [ + - ]: 1 : locationSouthIncoming(),
78 [ + - ]: 2 : locationNorthOutgoing(),
79 : : std::initializer_list<ExpectedResultTuple>{
80 : : // here we identify that the other drives in front not on our route
81 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::NotRelevant, 3u, 0u, ::ad::physics::Speed(100.))});
82 : 1 : }
83 : :
84 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e1_o0)
85 : : {
86 [ + - + - ]: 4 : performConstellationTest(
87 [ + - ]: 1 : locationSouthEntering(),
88 [ + - ]: 2 : locationEastIncoming(),
89 : : std::initializer_list<ExpectedResultTuple>{
90 : : // because of the shorter connecting route, we get only 2 object predictions
91 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778)),
92 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778))});
93 : 1 : }
94 : :
95 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e1_o1)
96 : : {
97 [ + - + - ]: 5 : performConstellationTest(
98 [ + - ]: 1 : locationSouthEntering(),
99 [ + - ]: 2 : locationEastEntering(),
100 : : std::initializer_list<ExpectedResultTuple>{
101 : : // because of progressed object, now getting 3 object predictions
102 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778)),
103 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778)),
104 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778))});
105 : 1 : }
106 : :
107 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e1_o2)
108 : : {
109 [ + - + - ]: 4 : performConstellationTest(
110 [ + - ]: 1 : locationSouthEntering(),
111 [ + - ]: 2 : locationEast2North(),
112 : : std::initializer_list<ExpectedResultTuple>{
113 : : // here we still get 2 object predictions, leading to the opposite direction case
114 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778)),
115 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778))});
116 : 1 : }
117 : :
118 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e1_o3)
119 : : {
120 [ + - + - ]: 3 : performConstellationTest(
121 [ + - ]: 1 : locationSouthEntering(),
122 [ + - ]: 2 : locationNorthExiting(),
123 : : std::initializer_list<ExpectedResultTuple>{
124 : : // here we identify that the other drives in front not on our route
125 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::NotRelevant, 3u, 0u, ::ad::physics::Speed(100.))});
126 : 1 : }
127 : :
128 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e1_o4)
129 : : {
130 [ + - + - ]: 3 : performConstellationTest(
131 [ + - ]: 1 : locationSouthEntering(),
132 [ + - ]: 2 : locationNorthOutgoing(),
133 : : std::initializer_list<ExpectedResultTuple>{
134 : : // here we identify that the other drives in front not on our route
135 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::NotRelevant, 3u, 0u, ::ad::physics::Speed(100.))});
136 : 1 : }
137 : :
138 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e2_o0)
139 : : {
140 [ + - + - ]: 4 : performConstellationTest(
141 [ + - ]: 1 : locationSouth2East(),
142 [ + - ]: 2 : locationEastIncoming(),
143 : : std::initializer_list<ExpectedResultTuple>{
144 : : // because of the shorter connecting route, we get only 2 object predictions
145 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778)),
146 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778))});
147 : 1 : }
148 : :
149 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e2_o1)
150 : : {
151 [ + - + - ]: 5 : performConstellationTest(
152 [ + - ]: 1 : locationSouth2East(),
153 [ + - ]: 2 : locationEastEntering(),
154 : : std::initializer_list<ExpectedResultTuple>{
155 : : // because of progressed object, now getting 3 object predictions
156 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778)),
157 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778)),
158 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778))});
159 : 1 : }
160 : :
161 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e2_o2)
162 : : {
163 [ + - + - ]: 4 : performConstellationTest(
164 [ + - ]: 1 : locationSouth2East(),
165 [ + - ]: 2 : locationEast2North(),
166 : : std::initializer_list<ExpectedResultTuple>{
167 : : // here we still get 2 object predictions, leading to the opposite direction case
168 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778)),
169 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778))});
170 : 1 : }
171 : :
172 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e2_o3)
173 : : {
174 [ + - + - ]: 3 : performConstellationTest(
175 [ + - ]: 1 : locationSouth2East(),
176 [ + - ]: 2 : locationNorthExiting(),
177 : : std::initializer_list<ExpectedResultTuple>{
178 : : // here we identify that the other drives in front not on our route
179 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::NotRelevant, 3u, 0u, ::ad::physics::Speed(100.))});
180 : 1 : }
181 : :
182 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e2_o4)
183 : : {
184 [ + - + - ]: 3 : performConstellationTest(
185 [ + - ]: 1 : locationSouth2East(),
186 [ + - ]: 2 : locationNorthOutgoing(),
187 : : std::initializer_list<ExpectedResultTuple>{
188 : : // here we identify that the other drives in front not on our route
189 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::NotRelevant, 3u, 0u, ::ad::physics::Speed(100.))});
190 : 1 : }
191 : :
192 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e3_o0)
193 : : {
194 [ + - + - ]: 3 : performConstellationTest(
195 [ + - ]: 1 : locationEastExiting(),
196 [ + - ]: 2 : locationEastIncoming(),
197 : : std::initializer_list<ExpectedResultTuple>{
198 : : // only one constellation left
199 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(12.2936))});
200 : 1 : }
201 : :
202 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e3_o1)
203 : : {
204 [ + - + - ]: 11 : performConstellationTest(
205 [ + - ]: 1 : locationEastExiting(),
206 [ + - ]: 2 : locationEastEntering(),
207 : : std::initializer_list<ExpectedResultTuple>{
208 : : // since the other is besides us, we still find the route from within the intersection
209 : : // we get 5 connecting route candidates: 4 with each 2 object predictions inside intersection and 1 outside
210 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(12.2936)),
211 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778)),
212 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778)),
213 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778)),
214 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(15.2778)),
215 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778)),
216 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778)),
217 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778)),
218 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(15.2778))});
219 : 1 : }
220 : :
221 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e3_o2)
222 : : {
223 [ + - + - ]: 3 : performConstellationTest(
224 [ + - ]: 1 : locationEastExiting(),
225 [ + - ]: 2 : locationEast2North(),
226 : : std::initializer_list<ExpectedResultTuple>{
227 : : // here the other is behind us
228 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::NotRelevant, 3u, 0u, ::ad::physics::Speed(100.))});
229 : 1 : }
230 : :
231 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e3_o3)
232 : : {
233 [ + - + - ]: 3 : performConstellationTest(
234 [ + - ]: 1 : locationEastExiting(),
235 [ + - ]: 2 : locationNorthExiting(),
236 : : std::initializer_list<ExpectedResultTuple>{
237 : : // here the other is behind us
238 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::NotRelevant, 3u, 0u, ::ad::physics::Speed(100.))});
239 : 1 : }
240 : :
241 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e3_o4)
242 : : {
243 [ + - + - ]: 3 : performConstellationTest(
244 [ + - ]: 1 : locationEastExiting(),
245 [ + - ]: 2 : locationNorthOutgoing(),
246 : : std::initializer_list<ExpectedResultTuple>{
247 : : // here the other is behind us
248 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::NotRelevant, 3u, 0u, ::ad::physics::Speed(100.))});
249 : 1 : }
250 : :
251 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e4_o0)
252 : : {
253 [ + - + - ]: 3 : performConstellationTest(
254 [ + - ]: 1 : locationEastOutgoing(),
255 [ + - ]: 2 : locationEastIncoming(),
256 : : std::initializer_list<ExpectedResultTuple>{
257 : : // only one constellation left
258 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 1u, 0u, ::ad::physics::Speed(12.2936))});
259 : 1 : }
260 : :
261 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e4_o1)
262 : : {
263 [ + - + - ]: 3 : performConstellationTest(
264 [ + - ]: 1 : locationEastOutgoing(),
265 [ + - ]: 2 : locationEastEntering(),
266 : : std::initializer_list<ExpectedResultTuple>{
267 : : // here the other is behind us
268 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::NotRelevant, 1u, 0u, ::ad::physics::Speed(100.))});
269 : 1 : }
270 : :
271 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e4_o2)
272 : : {
273 [ + - + - ]: 3 : performConstellationTest(
274 [ + - ]: 1 : locationEastOutgoing(),
275 [ + - ]: 2 : locationEast2North(),
276 : : std::initializer_list<ExpectedResultTuple>{
277 : : // here the other is behind us
278 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::NotRelevant, 1u, 0u, ::ad::physics::Speed(100.))});
279 : 1 : }
280 : :
281 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e4_o3)
282 : : {
283 [ + - + - ]: 3 : performConstellationTest(
284 [ + - ]: 1 : locationEastOutgoing(),
285 [ + - ]: 2 : locationNorthExiting(),
286 : : std::initializer_list<ExpectedResultTuple>{
287 : : // here the other is behind us
288 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::NotRelevant, 1u, 0u, ::ad::physics::Speed(100.))});
289 : 1 : }
290 : :
291 : 4 : TEST_F(RssWorldModelCreationTestWithRouteEgoSouth2EastOtherEast2North, e4_o4)
292 : : {
293 [ + - + - ]: 3 : performConstellationTest(
294 [ + - ]: 1 : locationEastOutgoing(),
295 [ + - ]: 2 : locationNorthOutgoing(),
296 : : std::initializer_list<ExpectedResultTuple>{
297 : : // here the other is behind us
298 [ + - ]: 2 : std::make_tuple(::ad::rss::world::ConstellationType::NotRelevant, 1u, 0u, ::ad::physics::Speed(100.))});
299 : 1 : }
300 : :
301 : : struct RssWorldModelCreationTestWithoutRouteEgoSouth2EastOtherEast2North
302 : : : public ad::rss::map::test_support::RssWorldModelCreationTestWithoutRoute
303 : : {
304 : : /*
305 : : * | O4 |
306 : : * | |
307 : : * | |
308 : : * | O3 |___________
309 : : * |
310 : : * | O2 O1 O0
311 : : * |
312 : : * | E2 E3 E4
313 : : * | ____________
314 : : * | E1 |
315 : : * | |
316 : : * | |
317 : : * | E0 |
318 : : */
319 : : };
320 : :
321 : 4 : TEST_F(RssWorldModelCreationTestWithoutRouteEgoSouth2EastOtherEast2North, e0_o0)
322 : : {
323 [ + - + - ]: 6 : performConstellationTest(
324 [ + - ]: 1 : locationSouthIncoming(),
325 [ + - ]: 2 : locationEastIncoming(),
326 : : // here we get 2 object predictions and 3 ego predictions:
327 : : std::initializer_list<ExpectedResultTuple>{
328 : : // ego-turn-right: all 2 object predictions lead to the opposite direction case
329 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 3u, 0u, ::ad::physics::Speed(100.)),
330 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 3u, 0u, ::ad::physics::Speed(100.)),
331 : : // ego-straight: object prediction 1
332 : : // object coming from right has prio
333 : 0 : std::make_tuple(
334 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionObjectHasPriority, 3u, 2u, ::ad::physics::Speed(100.)),
335 : : // ego-straight: object prediction 2
336 : : // object coming from right has prio
337 : 0 : std::make_tuple(
338 [ + - ]: 2 : ::ad::rss::world::ConstellationType::IntersectionObjectHasPriority, 3u, 2u, ::ad::physics::Speed(100.))});
339 : 1 : }
340 : :
341 : 4 : TEST_F(RssWorldModelCreationTestWithoutRouteEgoSouth2EastOtherEast2North, e2_o0)
342 : : {
343 [ + - + - ]: 6 : performConstellationTest(
344 [ + - ]: 1 : locationSouth2East(),
345 [ + - ]: 2 : locationEastIncoming(),
346 : : // here we get 2 object predictions and 2 ego predictions:
347 : : std::initializer_list<ExpectedResultTuple>{
348 : : // ego-turn-right: all 2 object predictions lead to the opposite direction case
349 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(100.)),
350 [ + - ]: 1 : std::make_tuple(::ad::rss::world::ConstellationType::OppositeDirection, 2u, 0u, ::ad::physics::Speed(100.)),
351 : : // ego-straight: object prediction 1
352 : : // first intersection not present; works because no other intersection in prediction and objects intersection is
353 : : // taken (@todo: to be fixed)
354 : : // object coming from right has prio
355 : 0 : std::make_tuple(
356 [ + - ]: 1 : ::ad::rss::world::ConstellationType::IntersectionObjectHasPriority, 2u, 2u, ::ad::physics::Speed(100.)),
357 : : // ego-straight: object prediction 2
358 : : // object coming from right has prio
359 : 0 : std::make_tuple(
360 [ + - ]: 2 : ::ad::rss::world::ConstellationType::IntersectionObjectHasPriority, 2u, 2u, ::ad::physics::Speed(100.))});
361 : 1 : }
362 : :
363 : 4 : TEST_F(RssWorldModelCreationTestWithoutRouteEgoSouth2EastOtherEast2North, e0_o4)
364 : : {
365 [ + - + - : 3 : performConstellationTest(locationSouthIncoming(),
+ - ]
366 [ + - ]: 2 : locationNorthOutgoing(),
367 : 0 : std::initializer_list<ExpectedResultTuple>{std::make_tuple(
368 [ + - ]: 2 : ::ad::rss::world::ConstellationType::SameDirection, 4u, 0u, ::ad::physics::Speed(100.))});
369 : 1 : }
370 : :
371 : : //@TODO fill in between steps of RssWorldModelCreationTestWithoutRouteEgoSouth2EastOtherEast2North
|