Skip to content

Commit 2d2f8ff

Browse files
solve calc bound problem
Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
1 parent f935c34 commit 2d2f8ff

File tree

4 files changed

+13
-20
lines changed

4 files changed

+13
-20
lines changed

planning/behavior_path_planner_common/include/behavior_path_planner_common/utils/drivable_area_expansion/static_drivable_area.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ std::vector<geometry_msgs::msg::Point> calcBound(
8282
const std::vector<DrivableLanes> & drivable_lanes,
8383
const bool enable_expanding_hatched_road_markings, const bool enable_expanding_intersection_areas,
8484
const bool enable_expanding_freespace_areas, const bool is_left,
85-
const bool is_driving_forward = true, const bool expand_to_road_edges = false);
85+
const bool is_driving_forward = true);
8686

8787
std::vector<geometry_msgs::msg::Point> postProcess(
8888
const std::vector<geometry_msgs::msg::Point> & original_bound, const PathWithLaneId & path,

planning/behavior_path_planner_common/src/utils/drivable_area_expansion/static_drivable_area.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -1568,8 +1568,7 @@ std::vector<geometry_msgs::msg::Point> calcBound(
15681568
const PathWithLaneId & path, const std::shared_ptr<const PlannerData> planner_data,
15691569
const std::vector<DrivableLanes> & drivable_lanes,
15701570
const bool enable_expanding_hatched_road_markings, const bool enable_expanding_intersection_areas,
1571-
const bool enable_expanding_freespace_areas, const bool is_left, const bool is_driving_forward,
1572-
const bool expand_to_road_edges)
1571+
const bool enable_expanding_freespace_areas, const bool is_left, const bool is_driving_forward)
15731572
{
15741573
using motion_utils::removeOverlapPoints;
15751574

@@ -1620,11 +1619,6 @@ std::vector<geometry_msgs::msg::Point> calcBound(
16201619
enable_expanding_intersection_areas, is_left, is_driving_forward);
16211620
};
16221621

1623-
// If bounds should contain all drivable lanes
1624-
if (expand_to_road_edges) {
1625-
return post_process(removeOverlapPoints(to_ros_point(bound_points)), true);
1626-
}
1627-
16281622
// Step2. if there is no drivable area defined by polygon, return original drivable bound.
16291623
if (!enable_expanding_hatched_road_markings && !enable_expanding_intersection_areas) {
16301624
return post_process(removeOverlapPoints(to_ros_point(bound_points)), skip_post_process);

planning/behavior_path_sampling_planner_module/include/behavior_path_sampling_planner_module/sampling_planner_module.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,13 @@ class SamplingPlannerModule : public SceneModuleInterface
224224
const double yaw_difference = std::abs(ego_yaw - ref_path_yaw);
225225

226226
// TODO(Daniel) magic numbers
227-
constexpr double threshold_lat_distance_for_merging = 0.25;
228-
constexpr double threshold_yaw_difference_for_merging = M_PI / 36.0; // 5 degrees
227+
constexpr double threshold_lat_distance_for_merging = 0.15;
228+
constexpr double threshold_yaw_difference_for_merging = M_PI / 72.0; // 2.5 degrees
229229
const bool merged_back_to_path =
230230
(std::abs(ego_arc.distance) < threshold_lat_distance_for_merging) &&
231231
(yaw_difference < threshold_yaw_difference_for_merging);
232+
if (isReferencePathSafe() && (merged_back_to_path))
233+
for (int i = 0; i < 10; ++i) std::cerr << "MERGED BACK!!!!!\n";
232234
return isReferencePathSafe() && (merged_back_to_path);
233235
}
234236

planning/behavior_path_sampling_planner_module/src/sampling_planner_module.cpp

+7-10
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,9 @@ bool SamplingPlannerModule::isReferencePathSafe() const
220220
{
221221
const auto path_for_calculating_bounds = getPreviousModuleOutput().reference_path;
222222
const auto left_bound = (utils::calcBound(
223-
path_for_calculating_bounds, planner_data_, drivable_lanes, false, false, false, true, true,
224-
true));
223+
path_for_calculating_bounds, planner_data_, drivable_lanes, false, false, false, true));
225224
const auto right_bound = (utils::calcBound(
226-
path_for_calculating_bounds, planner_data_, drivable_lanes, false, false, false, false, true,
227-
true));
225+
path_for_calculating_bounds, planner_data_, drivable_lanes, false, false, false, false));
228226

229227
const auto sampling_planner_data =
230228
createPlannerData(planner_data_->prev_output_path, left_bound, right_bound);
@@ -445,7 +443,7 @@ BehaviorModuleOutput SamplingPlannerModule::plan()
445443
RCLCPP_ERROR(
446444
rclcpp::get_logger("behavior_path_planner").get_child("utils"),
447445
"failed to find closest lanelet within route!!!");
448-
return {};
446+
return getPreviousModuleOutput();
449447
}
450448

451449
std::vector<DrivableLanes> drivable_lanes{};
@@ -549,11 +547,9 @@ BehaviorModuleOutput SamplingPlannerModule::plan()
549547

550548
const auto path_for_calculating_bounds = getPreviousModuleOutput().reference_path;
551549
const auto left_bound = (utils::calcBound(
552-
path_for_calculating_bounds, planner_data_, drivable_lanes, false, false, false, true, true,
553-
true));
550+
path_for_calculating_bounds, planner_data_, drivable_lanes, false, false, false, true));
554551
const auto right_bound = (utils::calcBound(
555-
path_for_calculating_bounds, planner_data_, drivable_lanes, false, false, false, false, true,
556-
true));
552+
path_for_calculating_bounds, planner_data_, drivable_lanes, false, false, false, false));
557553

558554
const auto sampling_planner_data =
559555
createPlannerData(planner_data_->prev_output_path, left_bound, right_bound);
@@ -630,13 +626,14 @@ BehaviorModuleOutput SamplingPlannerModule::plan()
630626
BehaviorModuleOutput out;
631627
PathWithLaneId out_path = (prev_sampling_path_)
632628
? convertFrenetPathToPathWithLaneID(
633-
prev_sampling_path_.value(), road_lanes,
629+
prev_sampling_path_.value(), current_lanes,
634630
planner_data_->route_handler->getGoalPose().position.z)
635631
: PathWithLaneId{};
636632

637633
out.path = (prev_sampling_path_) ? out_path : getPreviousModuleOutput().path;
638634
out.reference_path = getPreviousModuleOutput().reference_path;
639635
out.drivable_area_info = getPreviousModuleOutput().drivable_area_info;
636+
extendOutputDrivableArea(out, drivable_lanes);
640637
return out;
641638
}
642639

0 commit comments

Comments
 (0)