Skip to content

Commit

Permalink
feat(route_handler-bpp): consider lane-ego angle diff in lane followi…
Browse files Browse the repository at this point in the history
…ng module

Signed-off-by: Mehmet Dogru <42mehmetdogru42@gmail.com>
  • Loading branch information
mehmetdogru committed Jan 24, 2023
1 parent 403713d commit bdc80e6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
6 changes: 3 additions & 3 deletions map/map_loader/config/lanelet2_map_loader.param.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**:
ros__parameters:
lanelet2_map_projector_type: MGRS # Options: MGRS, UTM
latitude: 40.816617984672746 # Latitude of map_origin, using in UTM
longitude: 29.360491808334285 # Longitude of map_origin, using in UTM
lanelet2_map_projector_type: UTM # Options: MGRS, UTM
latitude: 40.81187906 # Latitude of map_origin, using in UTM
longitude: 29.35810110 # Longitude of map_origin, using in UTM

center_line_resolution: 5.0 # [m]
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,22 @@ PathWithLaneId LaneFollowingModule::getReferencePath() const
reference_path.header = route_handler->getRouteHeader();

lanelet::ConstLanelet current_lane;
if (!planner_data_->route_handler->getClosestLaneletWithinRoute(current_pose, &current_lane)) {
if (!planner_data_->route_handler->getClosestLaneletWithConstrainsWithinRoute(
current_pose, &current_lane, 5.0, 1.57)) {
RCLCPP_ERROR_THROTTLE(
getLogger(), *clock_, 5000, "failed to find closest lanelet within route!!!");
return reference_path; // TODO(Horibe)
}

std::cout << "current_lane.id: " << current_lane.id() << std::endl;

// if (!planner_data_->route_handler->getClosestLaneletWithinRoute(current_pose, &current_lane))
// {
// RCLCPP_ERROR_THROTTLE(
// getLogger(), *clock_, 5000, "failed to find closest lanelet within route!!!");
// return reference_path; // TODO(Horibe)
// }

// For current_lanes with desired length
const auto current_lanes = planner_data_->route_handler->getLaneletSequence(
current_lane, current_pose, p.backward_path_length, p.forward_path_length);
Expand Down
2 changes: 1 addition & 1 deletion planning/behavior_path_planner/src/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2052,7 +2052,7 @@ lanelet::ConstLanelets calcLaneAroundPose(
const double backward_length)
{
lanelet::ConstLanelet current_lane;
if (!route_handler->getClosestLaneletWithinRoute(pose, &current_lane)) {
if (!route_handler->getClosestLaneletWithConstrainsWithinRoute(pose, &current_lane, 5.0, 1.57)) {
RCLCPP_ERROR(
rclcpp::get_logger("behavior_path_planner").get_child("avoidance"),
"failed to find closest lanelet within route!!!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ class RouteHandler
int getNumLaneToPreferredLane(const lanelet::ConstLanelet & lanelet) const;
bool getClosestLaneletWithinRoute(
const Pose & search_pose, lanelet::ConstLanelet * closest_lanelet) const;
bool getClosestLaneletWithConstrainsWithinRoute(
const Pose & search_pose, lanelet::ConstLanelet * closest_lanelet, const double dist_threshold,
const double yaw_threshold) const;
lanelet::ConstLanelet getLaneletsFromId(const lanelet::Id id) const;
lanelet::ConstLanelets getLaneletsFromIds(const lanelet::Ids & ids) const;
lanelet::ConstLanelets getLaneletSequence(
Expand Down
8 changes: 8 additions & 0 deletions planning/route_handler/src/route_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,14 @@ bool RouteHandler::getClosestLaneletWithinRoute(
return lanelet::utils::query::getClosestLanelet(route_lanelets_, search_pose, closest_lanelet);
}

bool RouteHandler::getClosestLaneletWithConstrainsWithinRoute(
const Pose & search_pose, lanelet::ConstLanelet * closest_lanelet, const double dist_threshold,
const double yaw_threshold) const
{
return lanelet::utils::query::getClosestLaneletWithConstrains(
route_lanelets_, search_pose, closest_lanelet, dist_threshold, yaw_threshold);
}

bool RouteHandler::getNextLaneletWithinRoute(
const lanelet::ConstLanelet & lanelet, lanelet::ConstLanelet * next_lanelet) const
{
Expand Down

0 comments on commit bdc80e6

Please sign in to comment.