Skip to content

Commit d29cb27

Browse files
refactor(start_planner): separate debug and info marker for rviz visualization (autowarefoundation#6376)
* separate debug and info marker Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp> * replace util function for footprint Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp> --------- Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp>
1 parent 726f0f9 commit d29cb27

File tree

1 file changed

+54
-41
lines changed

1 file changed

+54
-41
lines changed

planning/behavior_path_start_planner_module/src/start_planner_module.cpp

+54-41
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ void StartPlannerModule::initVariables()
139139
resetPathCandidate();
140140
resetPathReference();
141141
debug_marker_.markers.clear();
142+
info_marker_.markers.clear();
142143
initializeSafetyCheckParameters();
143144
initializeCollisionCheckDebugMap(debug_data_.collision_check);
144145
updateDepartureCheckLanes();
@@ -1456,25 +1457,35 @@ void StartPlannerModule::setDebugData()
14561457
const auto white_color = createMarkerColor(1.0, 1.0, 1.0, 0.99);
14571458

14581459
const auto life_time = rclcpp::Duration::from_seconds(1.5);
1459-
auto add = [&](MarkerArray added) {
1460+
auto add = [&](MarkerArray added, MarkerArray & target_marker_array) {
14601461
for (auto & marker : added.markers) {
14611462
marker.lifetime = life_time;
14621463
}
1463-
tier4_autoware_utils::appendMarkerArray(added, &debug_marker_);
1464+
tier4_autoware_utils::appendMarkerArray(added, &target_marker_array);
14641465
};
14651466

14661467
debug_marker_.markers.clear();
1467-
add(createPoseMarkerArray(status_.pull_out_start_pose, "back_end_pose", 0, 0.9, 0.3, 0.3));
1468-
add(createPoseMarkerArray(status_.pull_out_path.start_pose, "start_pose", 0, 0.3, 0.9, 0.3));
1469-
add(createPoseMarkerArray(status_.pull_out_path.end_pose, "end_pose", 0, 0.9, 0.9, 0.3));
1470-
add(createFootprintMarkerArray(
1471-
debug_data_.refined_start_pose, vehicle_info_, "refined_start_pose", 0, 0.9, 0.9, 0.3));
1472-
add(createPathMarkerArray(getFullPath(), "full_path", 0, 0.0, 0.5, 0.9));
1473-
add(createPathMarkerArray(status_.backward_path, "backward_driving_path", 0, 0.0, 0.9, 0.0));
1468+
info_marker_.markers.clear();
1469+
add(
1470+
createPoseMarkerArray(status_.pull_out_start_pose, "back_end_pose", 0, 0.9, 0.3, 0.3),
1471+
info_marker_);
1472+
add(
1473+
createPoseMarkerArray(status_.pull_out_path.start_pose, "start_pose", 0, 0.3, 0.9, 0.3),
1474+
info_marker_);
1475+
add(
1476+
createPoseMarkerArray(status_.pull_out_path.end_pose, "end_pose", 0, 0.9, 0.9, 0.3),
1477+
info_marker_);
1478+
add(
1479+
createFootprintMarkerArray(
1480+
debug_data_.refined_start_pose, vehicle_info_, "refined_start_pose", 0, 0.9, 0.9, 0.3),
1481+
debug_marker_);
1482+
add(createPathMarkerArray(getFullPath(), "full_path", 0, 0.0, 0.5, 0.9), debug_marker_);
1483+
add(
1484+
createPathMarkerArray(status_.backward_path, "backward_driving_path", 0, 0.0, 0.9, 0.0),
1485+
debug_marker_);
14741486

14751487
// visualize collision_check_end_pose and footprint
14761488
{
1477-
const auto local_footprint = vehicle_info_.createFootprint();
14781489
std::map<PlannerType, double> collision_check_distances = {
14791490
{PlannerType::SHIFT, parameters_->shift_collision_check_distance_from_end},
14801491
{PlannerType::GEOMETRIC, parameters_->geometric_collision_check_distance_from_end}};
@@ -1484,24 +1495,16 @@ void StartPlannerModule::setDebugData()
14841495
getFullPath().points, status_.pull_out_path.end_pose.position,
14851496
collision_check_distance_from_end);
14861497
if (collision_check_end_pose) {
1487-
add(createPoseMarkerArray(
1488-
*collision_check_end_pose, "static_collision_check_end_pose", 0, 1.0, 0.0, 0.0));
1498+
add(
1499+
createPoseMarkerArray(
1500+
*collision_check_end_pose, "static_collision_check_end_pose", 0, 1.0, 0.0, 0.0),
1501+
info_marker_);
14891502
auto marker = createDefaultMarker(
14901503
"map", rclcpp::Clock{RCL_ROS_TIME}.now(), "static_collision_check_end_polygon", 0,
1491-
Marker::LINE_LIST, createMarkerScale(0.1, 0.1, 0.1), red_color);
1492-
const auto footprint = transformVector(
1493-
local_footprint, tier4_autoware_utils::pose2transform(*collision_check_end_pose));
1494-
const double ego_z = planner_data_->self_odometry->pose.pose.position.z;
1495-
for (size_t i = 0; i < footprint.size(); i++) {
1496-
const auto & current_point = footprint.at(i);
1497-
const auto & next_point = footprint.at((i + 1) % footprint.size());
1498-
marker.points.push_back(
1499-
tier4_autoware_utils::createPoint(current_point.x(), current_point.y(), ego_z));
1500-
marker.points.push_back(
1501-
tier4_autoware_utils::createPoint(next_point.x(), next_point.y(), ego_z));
1502-
}
1504+
Marker::LINE_STRIP, createMarkerScale(0.1, 0.1, 0.1), red_color);
1505+
addFootprintMarker(marker, *collision_check_end_pose, vehicle_info_);
15031506
marker.lifetime = life_time;
1504-
debug_marker_.markers.push_back(marker);
1507+
info_marker_.markers.push_back(marker);
15051508
}
15061509
}
15071510
// start pose candidates
@@ -1528,8 +1531,8 @@ void StartPlannerModule::setDebugData()
15281531
start_pose_text_marker_array.markers.push_back(text_marker);
15291532
}
15301533

1531-
add(start_pose_footprint_marker_array);
1532-
add(start_pose_text_marker_array);
1534+
add(start_pose_footprint_marker_array, debug_marker_);
1535+
add(start_pose_text_marker_array, debug_marker_);
15331536
}
15341537

15351538
// visualize the footprint from pull_out_start pose to pull_out_end pose along the path
@@ -1561,26 +1564,32 @@ void StartPlannerModule::setDebugData()
15611564
pull_out_path_footprint_marker_array.markers.push_back(pull_out_path_footprint_marker);
15621565
}
15631566

1564-
add(pull_out_path_footprint_marker_array);
1567+
add(pull_out_path_footprint_marker_array, debug_marker_);
15651568
}
15661569

15671570
// safety check
15681571
if (parameters_->safety_check_params.enable_safety_check) {
15691572
if (debug_data_.ego_predicted_path.size() > 0) {
15701573
const auto & ego_predicted_path = utils::path_safety_checker::convertToPredictedPath(
15711574
debug_data_.ego_predicted_path, ego_predicted_path_params_->time_resolution);
1572-
add(createPredictedPathMarkerArray(
1573-
ego_predicted_path, vehicle_info_, "ego_predicted_path_start_planner", 0, 0.0, 0.5, 0.9));
1575+
add(
1576+
createPredictedPathMarkerArray(
1577+
ego_predicted_path, vehicle_info_, "ego_predicted_path_start_planner", 0, 0.0, 0.5, 0.9),
1578+
debug_marker_);
15741579
}
15751580

15761581
if (debug_data_.filtered_objects.objects.size() > 0) {
1577-
add(createObjectsMarkerArray(
1578-
debug_data_.filtered_objects, "filtered_objects", 0, 0.0, 0.5, 0.9));
1582+
add(
1583+
createObjectsMarkerArray(
1584+
debug_data_.filtered_objects, "filtered_objects", 0, 0.0, 0.5, 0.9),
1585+
info_marker_);
15791586
}
15801587

1581-
add(showSafetyCheckInfo(debug_data_.collision_check, "object_debug_info"));
1582-
add(showPredictedPath(debug_data_.collision_check, "ego_predicted_path"));
1583-
add(showPolygon(debug_data_.collision_check, "ego_and_target_polygon_relation"));
1588+
add(showSafetyCheckInfo(debug_data_.collision_check, "object_debug_info"), debug_marker_);
1589+
add(
1590+
showPredictedPath(debug_data_.collision_check, "predicted_path_for_safety_check"),
1591+
info_marker_);
1592+
add(showPolygon(debug_data_.collision_check, "ego_and_target_polygon_relation"), info_marker_);
15841593

15851594
// set objects of interest
15861595
for (const auto & [uuid, data] : debug_data_.collision_check) {
@@ -1608,17 +1617,21 @@ void StartPlannerModule::setDebugData()
16081617
std::to_string(status_.pull_out_path.partial_paths.size() - 1);
16091618
marker.lifetime = life_time;
16101619
planner_type_marker_array.markers.push_back(marker);
1611-
add(planner_type_marker_array);
1620+
add(planner_type_marker_array, info_marker_);
16121621
}
16131622

1614-
add(laneletsAsTriangleMarkerArray(
1615-
"departure_check_lanes_for_shift_pull_out_path", debug_data_.departure_check_lanes,
1616-
cyan_color));
1623+
add(
1624+
laneletsAsTriangleMarkerArray(
1625+
"departure_check_lanes_for_shift_pull_out_path", debug_data_.departure_check_lanes,
1626+
cyan_color),
1627+
debug_marker_);
16171628

16181629
const auto pull_out_lanes = start_planner_utils::getPullOutLanes(
16191630
planner_data_, planner_data_->parameters.backward_path_length + parameters_->max_back_distance);
1620-
add(laneletsAsTriangleMarkerArray(
1621-
"pull_out_lanes_for_static_objects_collision_check", pull_out_lanes, pink_color));
1631+
add(
1632+
laneletsAsTriangleMarkerArray(
1633+
"pull_out_lanes_for_static_objects_collision_check", pull_out_lanes, pink_color),
1634+
debug_marker_);
16221635
}
16231636

16241637
void StartPlannerModule::logPullOutStatus(rclcpp::Logger::Level log_level) const

0 commit comments

Comments
 (0)