12
12
#include " TrajectoryPedestrian.hpp"
13
13
#include < ad/physics/Operation.hpp>
14
14
#include " ad/rss/situation/Physics.hpp"
15
+ #include " ad/rss/unstructured/DebugDrawing.hpp"
15
16
16
17
/* !
17
18
* @brief namespace ad
@@ -52,10 +53,8 @@ bool TrajectoryPedestrian::calculateTrajectorySets(situation::VehicleState const
52
53
result = calculateTrajectorySetsMoving (vehicleState, timeToStop, brakePolygon, continueForwardPolygon);
53
54
}
54
55
}
55
- #if DEBUG_DRAWING
56
- DEBUG_DRAWING_POLYGON (brakePolygon, " red" , " brake_pedestrian" );
57
- DEBUG_DRAWING_POLYGON (continueForwardPolygon, " green" , " continueForward_pedestrian" );
58
- #endif
56
+ DEBUG_DRAWING_POLYGON (brakePolygon, " red" , " pedestrian_brake" );
57
+ DEBUG_DRAWING_POLYGON (continueForwardPolygon, " green" , " pedestrian_continueForward" );
59
58
return result;
60
59
}
61
60
@@ -170,11 +169,8 @@ bool TrajectoryPedestrian::calculateTrajectorySetsMoving(situation::VehicleState
170
169
// -------------
171
170
if (result)
172
171
{
173
- result = calculateStepPolygon (vehicleState,
174
- minBrakeDistance,
175
- responseTimeFrontSide,
176
- " " , // "brake_front",
177
- brakePolygon);
172
+ result = calculateStepPolygon (
173
+ vehicleState, minBrakeDistance, responseTimeFrontSide, " pedestrian_brake_front" , brakePolygon);
178
174
if (!result)
179
175
{
180
176
spdlog::debug (" TrajectoryPedestrian::calculateTrajectorySets>> Could not calculate brake max step polygon." );
@@ -216,9 +212,7 @@ bool TrajectoryPedestrian::calculateTrajectorySetsMoving(situation::VehicleState
216
212
boost::geometry::append (
217
213
back, getVehicleCorner (finalLeftMaxBrakeDistance, vehicleState.objectState .dimension , VehicleCorner::frontLeft));
218
214
boost::geometry::convex_hull (back, maxBrakePolygon);
219
- #if DEBUG_DRAWING
220
- DEBUG_DRAWING_POLYGON (maxBrakePolygon, " red" , " brake_back" );
221
- #endif
215
+ DEBUG_DRAWING_POLYGON (maxBrakePolygon, " red" , " pedestrian_brake_back" );
222
216
combinePolygon (maxBrakePolygon, brakePolygon, brakePolygon);
223
217
}
224
218
@@ -230,8 +224,11 @@ bool TrajectoryPedestrian::calculateTrajectorySetsMoving(situation::VehicleState
230
224
// -------------
231
225
if (result)
232
226
{
233
- result = calculateStepPolygon (
234
- vehicleState, accelMaxDistance, responseTimeFrontSide, " continueForward_front" , continueForwardPolygon);
227
+ result = calculateStepPolygon (vehicleState,
228
+ accelMaxDistance,
229
+ responseTimeFrontSide,
230
+ " pedestrian_continueForward_front" ,
231
+ continueForwardPolygon);
235
232
if (!result)
236
233
{
237
234
spdlog::debug (
@@ -399,21 +396,18 @@ bool TrajectoryPedestrian::calculateStepPolygon(situation::VehicleState const &v
399
396
auto finalCenterFrontRight
400
397
= getVehicleCorner (finalStep.center , vehicleState.objectState .dimension , VehicleCorner::frontRight);
401
398
402
- // ----
403
- // left
404
- // ----
405
- #if DEBUG_DRAWING
399
+ // ----
400
+ // left
401
+ // ----
406
402
int idx = 0 ;
407
- #endif
408
403
for (auto it = finalStep.left .begin (); (it != finalStep.left .end ()) && result; ++it)
409
404
{
410
- #if DEBUG_DRAWING
411
- auto vehicleLocation = TrafficParticipantLocation (*it, vehicleState);
412
- DEBUG_DRAWING_POLYGON (vehicleLocation.toPolygon (), " black" , debugNamespace + " _left_" + std::to_string (idx));
405
+ if (DEBUG_DRAWING_IS_ENABLED ())
406
+ {
407
+ auto vehicleLocation = TrafficParticipantLocation (*it, vehicleState);
408
+ DEBUG_DRAWING_POLYGON (vehicleLocation.toPolygon (), " black" , debugNamespace + " _left_" + std::to_string (idx));
409
+ }
413
410
++idx;
414
- #else
415
- (void )debugNamespace;
416
- #endif
417
411
boost::geometry::append (ptsLeft,
418
412
getVehicleCorner (*it, vehicleState.objectState .dimension , VehicleCorner::frontRight));
419
413
boost::geometry::append (ptsLeft,
@@ -422,21 +416,18 @@ bool TrajectoryPedestrian::calculateStepPolygon(situation::VehicleState const &v
422
416
boost::geometry::append (ptsLeft, finalCenterFrontLeft);
423
417
boost::geometry::append (ptsLeft, finalCenterFrontRight);
424
418
425
- // -----
426
- // right
427
- // -----
428
- #if DEBUG_DRAWING
419
+ // -----
420
+ // right
421
+ // -----
429
422
idx = 0 ;
430
- #endif
431
423
for (auto it = finalStep.right .begin (); (it != finalStep.right .end ()) && result; ++it)
432
424
{
433
- #if DEBUG_DRAWING
434
- auto vehicleLocation = TrafficParticipantLocation (*it, vehicleState);
435
- DEBUG_DRAWING_POLYGON (vehicleLocation.toPolygon (), " black" , debugNamespace + " _right_" + std::to_string (idx));
425
+ if (DEBUG_DRAWING_IS_ENABLED ())
426
+ {
427
+ auto vehicleLocation = TrafficParticipantLocation (*it, vehicleState);
428
+ DEBUG_DRAWING_POLYGON (vehicleLocation.toPolygon (), " black" , debugNamespace + " _right_" + std::to_string (idx));
429
+ }
436
430
++idx;
437
- #else
438
- (void )debugNamespace;
439
- #endif
440
431
boost::geometry::append (ptsRight,
441
432
getVehicleCorner (*it, vehicleState.objectState .dimension , VehicleCorner::frontLeft));
442
433
boost::geometry::append (ptsRight,
@@ -529,10 +520,8 @@ bool TrajectoryPedestrian::getResponseTimeTrajectoryPoint(situation::VehicleStat
529
520
speed,
530
521
maxDistance);
531
522
532
- #if DEBUG_DRAWING
533
523
Line linePts;
534
524
boost::geometry::append (linePts, startingPoint);
535
- #endif
536
525
537
526
TrajectoryPoint currentPoint (vehicleState);
538
527
@@ -564,16 +553,12 @@ bool TrajectoryPedestrian::getResponseTimeTrajectoryPoint(situation::VehicleStat
564
553
pointAfterResponseTime
565
554
= startingPoint + toPoint (-std::sin (startingAngle) * maxDistance, std::cos (startingAngle) * maxDistance);
566
555
}
567
- #if DEBUG_DRAWING
568
556
boost::geometry::append (linePts, pointAfterResponseTime);
569
- #endif
570
557
571
558
resultTrajectoryPoint = TrajectoryPoint (
572
559
pointAfterResponseTime, vehicleState.objectState .yaw + angleChange, speed, physics::AngularVelocity (0 .));
573
- #if DEBUG_DRAWING
574
560
DEBUG_DRAWING_LINE (
575
561
linePts, " orange" , std::to_string (aUntilResponseTime) + " _" + std::to_string (angleChangeRatio) + " _trajectory" );
576
- #endif
577
562
return result;
578
563
}
579
564
0 commit comments