Skip to content

Commit 0a630d5

Browse files
committed
chore: remove conflicts
Signed-off-by: Barış Zeren <bzeren1819@gmail.com>
1 parent 55bdf58 commit 0a630d5

File tree

4 files changed

+32
-8
lines changed

4 files changed

+32
-8
lines changed

planning/autoware_behavior_path_planner_common/src/utils/utils.cpp

+30-2
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,36 @@ bool isEgoOutOfRoute(
500500
lanelet::ConstLanelet goal_lane;
501501
const auto shoulder_goal_lanes = route_handler->getShoulderLaneletsAtPose(goal_pose);
502502
if (!shoulder_goal_lanes.empty()) goal_lane = shoulder_goal_lanes.front();
503-
const auto is_failed_getting_lanelet =
504-
shoulder_goal_lanes.empty() && !route_handler->getGoalLanelet(&goal_lane);
503+
504+
const bool is_failed_getting_lanelet = std::invoke([&]() {
505+
if (utils::isInLanelets(goal_pose, shoulder_goal_lanes)) {
506+
return !lanelet::utils::query::getClosestLanelet(shoulder_goal_lanes, goal_pose, &goal_lane);
507+
}
508+
if (common_param.enable_differential_map_loading) {
509+
// If dynamic map is enabled, get the goal lanelet from the current lanelet map
510+
//
511+
// Check the route lanelets and last route element in the current lanelet map
512+
// will be the goal lanelet
513+
514+
lanelet::LaneletMapPtr map = route_handler->getLaneletMapPtr();
515+
lanelet::ConstLanelets all_lanelets = lanelet::utils::query::laneletLayer(map);
516+
lanelet::ConstLanelets route_lanelets = route_handler->getRouteLanelets();
517+
518+
auto goalLaneletIt =
519+
std::find_if(all_lanelets.rbegin(), all_lanelets.rend(), [&](const auto & currentLanelet) {
520+
return currentLanelet.id() == route_lanelets.back().id();
521+
});
522+
523+
if (goalLaneletIt != all_lanelets.rend()) {
524+
RCLCPP_DEBUG(
525+
rclcpp::get_logger("behavior_path_planner").get_child("util"),
526+
"Found goal lanelet in current lanelet map");
527+
goal_lane = *goalLaneletIt;
528+
return false;
529+
}
530+
}
531+
return !route_handler->getGoalLanelet(&goal_lane);
532+
});
505533
if (is_failed_getting_lanelet) {
506534
RCLCPP_WARN_STREAM(
507535
rclcpp::get_logger("behavior_path_planner").get_child("util"), "cannot find goal lanelet");

planning/behavior_path_planner/src/behavior_path_planner_node.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,6 @@ void BehaviorPathPlannerNode::run()
368368
if (map_ptr) {
369369
planner_data_->route_handler->setMap(
370370
*map_ptr, planner_data_->parameters.enable_differential_map_loading);
371-
if (planner_data_->parameters.enable_differential_map_loading) {
372-
planner_manager_->resetRootLanelet(planner_data_);
373-
}
374371
}
375372

376373
std::unique_lock<std::mutex> lk_manager(mutex_manager_); // for planner_manager_
@@ -380,7 +377,6 @@ void BehaviorPathPlannerNode::run()
380377
if (route_ptr) {
381378
planner_data_->route_handler->setRoute(
382379
*route_ptr, planner_data_->parameters.enable_differential_map_loading);
383-
planner_manager_->resetRootLanelet(planner_data_);
384380
// uuid is not changed when rerouting with modified goal,
385381
// in this case do not need to reset modules.
386382
const bool has_same_route_id =

planning/route_handler/include/route_handler/route_handler.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class RouteHandler
5858
explicit RouteHandler(const LaneletMapBin & map_msg);
5959

6060
// non-const methods
61-
void setMap(const HADMapBin & map_msg, const bool & is_enable_differential_lanelet = false);
61+
void setMap(const LaneletMapBin & map_msg, const bool & is_enable_differential_lanelet = false);
6262
void setRoute(
6363
const LaneletRoute & route_msg, const bool & is_enable_differential_lanelet = false);
6464
void setRouteLanelets(const lanelet::ConstLanelets & path_lanelets);

planning/route_handler/src/route_handler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ RouteHandler::RouteHandler(const LaneletMapBin & map_msg)
139139
route_ptr_ = nullptr;
140140
}
141141

142-
void RouteHandler::setMap(const HADMapBin & map_msg, const bool & is_enable_differential_lanelet)
142+
void RouteHandler::setMap(const LaneletMapBin & map_msg, const bool & is_enable_differential_lanelet)
143143
{
144144
lanelet_map_ptr_ = std::make_shared<lanelet::LaneletMap>();
145145
lanelet::utils::conversion::fromBinMsg(

0 commit comments

Comments
 (0)