21
21
#include < magic_enum.hpp>
22
22
#include < tier4_autoware_utils/ros/uuid_helper.hpp>
23
23
24
- #include < tier4_planning_msgs/msg/avoidance_debug_factor.hpp>
25
-
26
24
#include < string>
27
25
#include < vector>
28
26
@@ -176,7 +174,8 @@ MarkerArray createObjectInfoMarkerArray(const ObjectDataArray & objects, std::st
176
174
marker.id = uuidToInt32 (object.object .object_id );
177
175
marker.pose .position .z += 2.0 ;
178
176
std::ostringstream string_stream;
179
- string_stream << object.reason << (object.is_parked ? " (PARKED)" : " " );
177
+ string_stream << magic_enum::enum_name (object.info ) << (object.is_parked ? " (PARKED)" : " " );
178
+ string_stream << (object.is_ambiguous ? " (WAIT AND SEE)" : " " );
180
179
marker.text = string_stream.str ();
181
180
marker.color = createMarkerColor (1.0 , 1.0 , 1.0 , 0.999 );
182
181
marker.scale = createMarkerScale (0.6 , 0.6 , 0.6 );
@@ -441,14 +440,12 @@ MarkerArray createTargetObjectsMarkerArray(const ObjectDataArray & objects, cons
441
440
return msg;
442
441
}
443
442
444
- MarkerArray createOtherObjectsMarkerArray (const ObjectDataArray & objects, const std::string & ns )
443
+ MarkerArray createOtherObjectsMarkerArray (const ObjectDataArray & objects, const ObjectInfo & info )
445
444
{
446
- using behavior_path_planner::utils::convertToSnakeCase;
447
-
448
- const auto filtered_objects = [&objects, &ns]() {
445
+ const auto filtered_objects = [&objects, &info]() {
449
446
ObjectDataArray ret{};
450
447
for (const auto & o : objects) {
451
- if (o.reason != ns ) {
448
+ if (o.info != info ) {
452
449
continue ;
453
450
}
454
451
ret.push_back (o);
@@ -460,18 +457,20 @@ MarkerArray createOtherObjectsMarkerArray(const ObjectDataArray & objects, const
460
457
MarkerArray msg;
461
458
msg.markers .reserve (filtered_objects.size () * 2 );
462
459
460
+ std::ostringstream string_stream;
461
+ string_stream << magic_enum::enum_name (info);
462
+
463
+ std::string ns = string_stream.str ();
464
+ transform (ns.begin (), ns.end (), ns.begin (), tolower);
465
+
463
466
appendMarkerArray (
464
467
createObjectsCubeMarkerArray (
465
- filtered_objects, " others_" + convertToSnakeCase (ns) + " _cube" ,
466
- createMarkerScale ( 3.0 , 1.5 , 1.5 ), createMarkerColor (0.0 , 1.0 , 0.0 , 0.8 )),
468
+ filtered_objects, " others_" + ns + " _cube" , createMarkerScale ( 3.0 , 1.5 , 1.5 ) ,
469
+ createMarkerColor (0.0 , 1.0 , 0.0 , 0.8 )),
467
470
&msg);
471
+ appendMarkerArray (createObjectInfoMarkerArray (filtered_objects, " others_" + ns + " _info" ), &msg);
468
472
appendMarkerArray (
469
- createObjectInfoMarkerArray (filtered_objects, " others_" + convertToSnakeCase (ns) + " _info" ),
470
- &msg);
471
- appendMarkerArray (
472
- createOverhangLaneletMarkerArray (
473
- filtered_objects, " others_" + convertToSnakeCase (ns) + " _overhang_lanelet" ),
474
- &msg);
473
+ createOverhangLaneletMarkerArray (filtered_objects, " others_" + ns + " _overhang_lanelet" ), &msg);
475
474
476
475
return msg;
477
476
}
@@ -528,7 +527,6 @@ MarkerArray createDebugMarkerArray(
528
527
using marker_utils::showPolygon;
529
528
using marker_utils::showPredictedPath;
530
529
using marker_utils::showSafetyCheckInfo;
531
- using tier4_planning_msgs::msg::AvoidanceDebugFactor;
532
530
533
531
const auto current_time = rclcpp::Clock{RCL_ROS_TIME}.now ();
534
532
MarkerArray msg;
@@ -564,24 +562,22 @@ MarkerArray createDebugMarkerArray(
564
562
565
563
// ignore objects
566
564
{
567
- addObjects (data.other_objects , AvoidanceDebugFactor::OBJECT_IS_BEHIND_THRESHOLD);
568
- addObjects (data.other_objects , AvoidanceDebugFactor::OBJECT_IS_IN_FRONT_THRESHOLD);
569
- addObjects (data.other_objects , AvoidanceDebugFactor::OBJECT_IS_NOT_TYPE);
570
- addObjects (data.other_objects , AvoidanceDebugFactor::OBJECT_BEHIND_PATH_GOAL);
571
- addObjects (data.other_objects , AvoidanceDebugFactor::TOO_NEAR_TO_CENTERLINE);
572
- addObjects (data.other_objects , AvoidanceDebugFactor::NOT_PARKING_OBJECT);
573
- addObjects (data.other_objects , std::string (" MovingObject" ));
574
- addObjects (data.other_objects , std::string (" CrosswalkUser" ));
575
- addObjects (data.other_objects , std::string (" OutOfTargetArea" ));
576
- addObjects (data.other_objects , std::string (" NotNeedAvoidance" ));
577
- addObjects (data.other_objects , std::string (" LessThanExecutionThreshold" ));
578
- addObjects (data.other_objects , std::string (" TooNearToGoal" ));
579
- addObjects (data.other_objects , std::string (" ParallelToEgoLane" ));
580
- addObjects (data.other_objects , std::string (" MergingToEgoLane" ));
581
- addObjects (data.other_objects , std::string (" DeviatingFromEgoLane" ));
582
- addObjects (data.other_objects , std::string (" UnstableObject" ));
583
- addObjects (data.other_objects , std::string (" AmbiguousStoppedVehicle" ));
584
- addObjects (data.other_objects , std::string (" AmbiguousStoppedVehicle(wait-and-see)" ));
565
+ addObjects (data.other_objects , ObjectInfo::FURTHER_THAN_THRESHOLD);
566
+ addObjects (data.other_objects , ObjectInfo::IS_NOT_TARGET_OBJECT);
567
+ addObjects (data.other_objects , ObjectInfo::FURTHER_THAN_GOAL);
568
+ addObjects (data.other_objects , ObjectInfo::TOO_NEAR_TO_CENTERLINE);
569
+ addObjects (data.other_objects , ObjectInfo::IS_NOT_PARKING_OBJECT);
570
+ addObjects (data.other_objects , ObjectInfo::MOVING_OBJECT);
571
+ addObjects (data.other_objects , ObjectInfo::CROSSWALK_USER);
572
+ addObjects (data.other_objects , ObjectInfo::OUT_OF_TARGET_AREA);
573
+ addObjects (data.other_objects , ObjectInfo::ENOUGH_LATERAL_DISTANCE);
574
+ addObjects (data.other_objects , ObjectInfo::LESS_THAN_EXECUTION_THRESHOLD);
575
+ addObjects (data.other_objects , ObjectInfo::TOO_NEAR_TO_GOAL);
576
+ addObjects (data.other_objects , ObjectInfo::PARALLEL_TO_EGO_LANE);
577
+ addObjects (data.other_objects , ObjectInfo::MERGING_TO_EGO_LANE);
578
+ addObjects (data.other_objects , ObjectInfo::DEVIATING_FROM_EGO_LANE);
579
+ addObjects (data.other_objects , ObjectInfo::UNSTABLE_OBJECT);
580
+ addObjects (data.other_objects , ObjectInfo::AMBIGUOUS_STOPPED_VEHICLE);
585
581
}
586
582
587
583
// shift line pre-process
0 commit comments