Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(behavior_path_planner): separate drivable area functions #5604

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions planning/behavior_path_planner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ament_auto_add_library(behavior_path_planner_node SHARED
src/utils/start_planner/geometric_pull_out.cpp
src/utils/start_planner/freespace_pull_out.cpp
src/utils/path_shifter/path_shifter.cpp
src/utils/drivable_area_expansion/static_drivable_area.cpp
src/utils/drivable_area_expansion/drivable_area_expansion.cpp
src/utils/drivable_area_expansion/map_utils.cpp
src/utils/drivable_area_expansion/footprints.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// Copyright 2023 TIER IV, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef BEHAVIOR_PATH_PLANNER__UTILS__DRIVABLE_AREA_EXPANSION__STATIC_DRIVABLE_AREA_HPP_
#define BEHAVIOR_PATH_PLANNER__UTILS__DRIVABLE_AREA_EXPANSION__STATIC_DRIVABLE_AREA_HPP_

#include <behavior_path_planner/utils/utils.hpp>

#include <memory>
#include <string>
#include <vector>
namespace behavior_path_planner::utils
{
using drivable_area_expansion::DrivableAreaExpansionParameters;

boost::optional<size_t> getOverlappedLaneletId(const std::vector<DrivableLanes> & lanes);

std::vector<DrivableLanes> cutOverlappedLanes(
PathWithLaneId & path, const std::vector<DrivableLanes> & lanes);

std::vector<DrivableLanes> generateDrivableLanes(const lanelet::ConstLanelets & current_lanes);

std::vector<DrivableLanes> generateDrivableLanesWithShoulderLanes(
const lanelet::ConstLanelets & current_lanes, const lanelet::ConstLanelets & shoulder_lanes);

std::vector<DrivableLanes> getNonOverlappingExpandedLanes(
PathWithLaneId & path, const std::vector<DrivableLanes> & lanes,
const DrivableAreaExpansionParameters & parameters);
void generateDrivableArea(
PathWithLaneId & path, const std::vector<DrivableLanes> & lanes,
const bool enable_expanding_hatched_road_markings, const bool enable_expanding_intersection_areas,
const double vehicle_length, const std::shared_ptr<const PlannerData> planner_data,
const bool is_driving_forward = true);

void generateDrivableArea(
PathWithLaneId & path, const double vehicle_length, const double offset,
const bool is_driving_forward = true);

lanelet::ConstLineStrings3d getMaximumDrivableArea(
const std::shared_ptr<const PlannerData> & planner_data);

/**
* @brief Expand the borders of the given lanelets
* @param [in] drivable_lanes lanelets to expand
* @param [in] left_bound_offset [m] expansion distance of the left bound
* @param [in] right_bound_offset [m] expansion distance of the right bound
* @param [in] types_to_skip linestring types that will not be expanded
* @return expanded lanelets
*/
std::vector<DrivableLanes> expandLanelets(
const std::vector<DrivableLanes> & drivable_lanes, const double left_bound_offset,
const double right_bound_offset, const std::vector<std::string> & types_to_skip = {});

void extractObstaclesFromDrivableArea(
PathWithLaneId & path, const std::vector<DrivableAreaInfo::Obstacle> & obstacles);

std::vector<lanelet::ConstPoint3d> getBoundWithHatchedRoadMarkings(
const std::vector<lanelet::ConstPoint3d> & original_bound,
const std::shared_ptr<RouteHandler> & route_handler);

std::vector<lanelet::ConstPoint3d> getBoundWithIntersectionAreas(
const std::vector<lanelet::ConstPoint3d> & original_bound,
const std::shared_ptr<RouteHandler> & route_handler,
const std::vector<DrivableLanes> & drivable_lanes, const bool is_left);

std::vector<geometry_msgs::msg::Point> calcBound(
const std::shared_ptr<RouteHandler> route_handler,
const std::vector<DrivableLanes> & drivable_lanes,
const bool enable_expanding_hatched_road_markings, const bool enable_expanding_intersection_areas,
const bool is_left);

void makeBoundLongitudinallyMonotonic(
PathWithLaneId & path, const std::shared_ptr<const PlannerData> & planner_data,
const bool is_bound_left);

DrivableAreaInfo combineDrivableAreaInfo(
const DrivableAreaInfo & drivable_area_info1, const DrivableAreaInfo & drivable_area_info2);

lanelet::ConstLanelets combineLanelets(
const lanelet::ConstLanelets & base_lanes, const lanelet::ConstLanelets & added_lanes);

std::vector<DrivableLanes> combineDrivableLanes(
const std::vector<DrivableLanes> & original_drivable_lanes_vec,
const std::vector<DrivableLanes> & new_drivable_lanes_vec);

} // namespace behavior_path_planner::utils

#endif // BEHAVIOR_PATH_PLANNER__UTILS__DRIVABLE_AREA_EXPANSION__STATIC_DRIVABLE_AREA_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#ifndef BEHAVIOR_PATH_PLANNER__UTILS__GOAL_PLANNER__UTIL_HPP_
#define BEHAVIOR_PATH_PLANNER__UTILS__GOAL_PLANNER__UTIL_HPP_

#include "behavior_path_planner/utils/drivable_area_expansion/static_drivable_area.hpp"
#include "behavior_path_planner/utils/goal_planner/goal_searcher_base.hpp"
#include "behavior_path_planner/utils/utils.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ PathWithLaneId calcCenterLinePath(
PathWithLaneId combinePath(const PathWithLaneId & path1, const PathWithLaneId & path2);

boost::optional<Pose> getFirstStopPoseFromPath(const PathWithLaneId & path);

BehaviorModuleOutput getReferencePath(
const lanelet::ConstLanelet & current_lane,
const std::shared_ptr<const PlannerData> & planner_data);

BehaviorModuleOutput createGoalAroundPath(const std::shared_ptr<const PlannerData> & planner_data);

} // namespace behavior_path_planner::utils

#endif // BEHAVIOR_PATH_PLANNER__UTILS__PATH_UTILS_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define BEHAVIOR_PATH_PLANNER__UTILS__START_PLANNER__UTIL_HPP_

#include "behavior_path_planner/data_manager.hpp"
#include "behavior_path_planner/utils/drivable_area_expansion/static_drivable_area.hpp"
#include "behavior_path_planner/utils/path_safety_checker/path_safety_checker_parameters.hpp"
#include "behavior_path_planner/utils/path_safety_checker/safety_check.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
using autoware_auto_planning_msgs::msg::Path;
using autoware_auto_planning_msgs::msg::PathPointWithLaneId;
using autoware_auto_planning_msgs::msg::PathWithLaneId;
using drivable_area_expansion::DrivableAreaExpansionParameters;
using geometry_msgs::msg::Point;
using geometry_msgs::msg::Pose;
using geometry_msgs::msg::PoseArray;
Expand Down Expand Up @@ -209,56 +208,6 @@
const lanelet::ConstLanelet & current_lane, const lanelet::ConstLanelets & shoulder_lanes);
boost::optional<lanelet::ConstLanelet> getLeftLanelet(
const lanelet::ConstLanelet & current_lane, const lanelet::ConstLanelets & shoulder_lanes);
std::vector<DrivableLanes> generateDrivableLanes(const lanelet::ConstLanelets & current_lanes);
std::vector<DrivableLanes> generateDrivableLanesWithShoulderLanes(
const lanelet::ConstLanelets & current_lanes, const lanelet::ConstLanelets & shoulder_lanes);
std::vector<DrivableLanes> getNonOverlappingExpandedLanes(
PathWithLaneId & path, const std::vector<DrivableLanes> & lanes,
const DrivableAreaExpansionParameters & parameters);
std::vector<geometry_msgs::msg::Point> calcBound(
const std::shared_ptr<RouteHandler> route_handler,
const std::vector<DrivableLanes> & drivable_lanes,
const bool enable_expanding_hatched_road_markings, const bool enable_expanding_intersection_areas,
const bool is_left);

std::vector<lanelet::ConstPoint3d> getBoundWithHatchedRoadMarkings(
const std::vector<lanelet::ConstPoint3d> & original_bound,
const std::shared_ptr<RouteHandler> & route_handler);

std::vector<lanelet::ConstPoint3d> getBoundWithIntersectionAreas(
const std::vector<lanelet::ConstPoint3d> & original_bound,
const std::shared_ptr<RouteHandler> & route_handler,
const std::vector<DrivableLanes> & drivable_lanes, const bool is_left);

boost::optional<size_t> getOverlappedLaneletId(const std::vector<DrivableLanes> & lanes);
std::vector<DrivableLanes> cutOverlappedLanes(
PathWithLaneId & path, const std::vector<DrivableLanes> & lanes);

void generateDrivableArea(
PathWithLaneId & path, const std::vector<DrivableLanes> & lanes,
const bool enable_expanding_hatched_road_markings, const bool enable_expanding_intersection_areas,
const double vehicle_length, const std::shared_ptr<const PlannerData> planner_data,
const bool is_driving_forward = true);

void generateDrivableArea(
PathWithLaneId & path, const double vehicle_length, const double offset,
const bool is_driving_forward = true);

lanelet::ConstLineStrings3d getMaximumDrivableArea(
const std::shared_ptr<const PlannerData> & planner_data);

/**
* @brief Expand the borders of the given lanelets
* @param [in] drivable_lanes lanelets to expand
* @param [in] left_bound_offset [m] expansion distance of the left bound
* @param [in] right_bound_offset [m] expansion distance of the right bound
* @param [in] types_to_skip linestring types that will not be expanded
* @return expanded lanelets
*/
std::vector<DrivableLanes> expandLanelets(
const std::vector<DrivableLanes> & drivable_lanes, const double left_bound_offset,
const double right_bound_offset, const std::vector<std::string> & types_to_skip = {});

// goal management

/**
Expand Down Expand Up @@ -294,8 +243,6 @@

bool containsGoal(const lanelet::ConstLanelets & lanes, const lanelet::Id & goal_id);

BehaviorModuleOutput createGoalAroundPath(const std::shared_ptr<const PlannerData> & planner_data);

bool isInLanelets(const Pose & pose, const lanelet::ConstLanelets & lanes);

bool isInLaneletWithYawThreshold(
Expand Down Expand Up @@ -349,10 +296,6 @@
const lanelet::ConstLanelets & lanelet_sequence, const double lane_change_prepare_duration,
const double lane_change_buffer);

BehaviorModuleOutput getReferencePath(
const lanelet::ConstLanelet & current_lane,
const std::shared_ptr<const PlannerData> & planner_data);

// object label
std::uint8_t getHighestProbLabel(const std::vector<ObjectClassification> & classification);

Expand Down Expand Up @@ -399,26 +342,23 @@

std::string convertToSnakeCase(const std::string & input_str);

std::vector<DrivableLanes> combineDrivableLanes(
const std::vector<DrivableLanes> & original_drivable_lanes_vec,
const std::vector<DrivableLanes> & new_drivable_lanes_vec);

DrivableAreaInfo combineDrivableAreaInfo(
const DrivableAreaInfo & drivable_area_info1, const DrivableAreaInfo & drivable_area_info2);

void extractObstaclesFromDrivableArea(
PathWithLaneId & path, const std::vector<DrivableAreaInfo::Obstacle> & obstacles);

void makeBoundLongitudinallyMonotonic(
PathWithLaneId & path, const std::shared_ptr<const PlannerData> & planner_data,
const bool is_bound_left);

std::optional<lanelet::Polygon3d> getPolygonByPoint(
const std::shared_ptr<RouteHandler> & route_handler, const lanelet::ConstPoint3d & point,
const std::string & polygon_name);

lanelet::ConstLanelets combineLanelets(
const lanelet::ConstLanelets & base_lanes, const lanelet::ConstLanelets & added_lanes);
template <class T>
size_t findNearestSegmentIndex(
const std::vector<T> & points, const geometry_msgs::msg::Pose & pose, const double dist_threshold,
const double yaw_threshold)
{
const auto nearest_idx =
motion_utils::findNearestSegmentIndex(points, pose, dist_threshold, yaw_threshold);
if (nearest_idx) {
return nearest_idx.get();
}

return motion_utils::findNearestSegmentIndex(points, pose.position);

Check warning on line 360 in planning/behavior_path_planner/include/behavior_path_planner/utils/utils.hpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/include/behavior_path_planner/utils/utils.hpp#L360

Added line #L360 was not covered by tests
}
} // namespace behavior_path_planner::utils

#endif // BEHAVIOR_PATH_PLANNER__UTILS__UTILS_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "behavior_path_planner/scene_module/lane_change/manager.hpp"
#include "behavior_path_planner/scene_module/side_shift/manager.hpp"
#include "behavior_path_planner/scene_module/start_planner/manager.hpp"
#include "behavior_path_planner/utils/drivable_area_expansion/static_drivable_area.hpp"
#include "behavior_path_planner/utils/path_utils.hpp"

#include <tier4_autoware_utils/ros/update_param.hpp>
Expand Down
2 changes: 2 additions & 0 deletions planning/behavior_path_planner/src/planner_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "behavior_path_planner/planner_manager.hpp"

#include "behavior_path_planner/utils/drivable_area_expansion/static_drivable_area.hpp"
#include "behavior_path_planner/utils/path_utils.hpp"
#include "behavior_path_planner/utils/utils.hpp"
#include "tier4_autoware_utils/ros/debug_publisher.hpp"
#include "tier4_autoware_utils/system/stop_watch.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "behavior_path_planner/scene_module/scene_module_visitor.hpp"
#include "behavior_path_planner/utils/avoidance/utils.hpp"
#include "behavior_path_planner/utils/create_vehicle_footprint.hpp"
#include "behavior_path_planner/utils/drivable_area_expansion/static_drivable_area.hpp"
#include "behavior_path_planner/utils/path_safety_checker/objects_filtering.hpp"
#include "behavior_path_planner/utils/path_utils.hpp"
#include "behavior_path_planner/utils/utils.hpp"
Expand Down Expand Up @@ -224,7 +225,7 @@

// If the vehicle is on the shift line, keep RUNNING.
{
const size_t idx = planner_data_->findEgoIndex(path_shifter_.getReferencePath().points);

Check warning on line 228 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L228

Added line #L228 was not covered by tests
const auto within = [](const auto & line, const size_t idx) {
return line.start_idx < idx && idx < line.end_idx;
};
Expand Down Expand Up @@ -452,7 +453,7 @@
getLogger(),
"Distance to shift start point is less than minimum prepare distance. The distance is not "
"enough.");
return false;

Check warning on line 456 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L456

Added line #L456 was not covered by tests
}
}

Expand Down Expand Up @@ -938,7 +939,7 @@

// Calculate feasible shift length
const auto get_shift_profile =
[&](

Check warning on line 942 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L942

Added line #L942 was not covered by tests
auto & object, const auto & desire_shift_length) -> std::optional<std::pair<double, double>> {
// use each object param
const auto object_type = utils::getHighestProbLabel(object.object.classification);
Expand All @@ -952,13 +953,13 @@
// calculate remaining distance.
const auto prepare_distance = helper_.getNominalPrepareDistance();
const auto & additional_buffer_longitudinal =
object_parameter.use_conservative_buffer_longitudinal

Check warning on line 956 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L956

Added line #L956 was not covered by tests
? planner_data_->parameters.base_link2front
: 0.0;
const auto constant = object_parameter.safety_buffer_longitudinal +

Check warning on line 959 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L959

Added line #L959 was not covered by tests
additional_buffer_longitudinal + prepare_distance;
const auto has_enough_distance = object.longitudinal > constant + nominal_avoid_distance;
const auto remaining_distance = object.longitudinal - constant;

Check warning on line 962 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L961-L962

Added lines #L961 - L962 were not covered by tests
const auto avoidance_distance =
has_enough_distance ? nominal_avoid_distance : remaining_distance;

Expand Down Expand Up @@ -999,7 +1000,7 @@
// prepare distance is not enough. unavoidable.
if (remaining_distance < 1e-3) {
object.reason = AvoidanceDebugFactor::REMAINING_DISTANCE_LESS_THAN_ZERO;
return std::nullopt;

Check warning on line 1003 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L1003

Added line #L1003 was not covered by tests
}

// calculate lateral jerk.
Expand All @@ -1014,7 +1015,7 @@
// avoidance distance is not enough. unavoidable.
if (!isBestEffort(parameters_->policy_deceleration)) {
object.reason = AvoidanceDebugFactor::TOO_LARGE_JERK;
return std::nullopt;

Check warning on line 1018 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L1018

Added line #L1018 was not covered by tests
}

// output avoidance path under lateral jerk constraints.
Expand All @@ -1023,7 +1024,7 @@

if (std::abs(feasible_relative_shift_length) < parameters_->lateral_execution_threshold) {
object.reason = "LessThanExecutionThreshold";
return std::nullopt;

Check warning on line 1027 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L1027

Added line #L1027 was not covered by tests
}

const auto feasible_shift_length =
Expand All @@ -1036,8 +1037,8 @@
if (infeasible) {
RCLCPP_WARN_THROTTLE(
getLogger(), *clock_, 1000, "feasible shift length is not enough to avoid. ");
object.reason = AvoidanceDebugFactor::TOO_LARGE_JERK;
return std::nullopt;

Check warning on line 1041 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L1040-L1041

Added lines #L1040 - L1041 were not covered by tests
}

{
Expand Down Expand Up @@ -1117,7 +1118,7 @@
}

const auto minimum_avoid_distance =
helper_.getMinAvoidanceDistance(feasible_shift_profile.value().first - current_ego_shift);

Check warning on line 1121 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L1121

Added line #L1121 was not covered by tests
const auto furthest_avoid_distance = std::max(to_shift_end - minimum_avoid_distance, 1e-3);

return std::clamp(data.to_start_point, nearest_avoid_distance, furthest_avoid_distance);
Expand All @@ -1129,7 +1130,7 @@
al_avoid.start_shift_length = helper_.getLinearShift(al_avoid.start.position);

// end point
al_avoid.end_shift_length = feasible_shift_profile.value().first;

Check warning on line 1133 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L1133

Added line #L1133 was not covered by tests
al_avoid.end_longitudinal = to_shift_end;

// misc
Expand All @@ -1144,7 +1145,7 @@
const auto to_shift_start = o.longitudinal + offset;

// start point
al_return.start_shift_length = feasible_shift_profile.value().first;

Check warning on line 1148 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L1148

Added line #L1148 was not covered by tests
al_return.start_longitudinal = to_shift_start;

// end point
Expand Down Expand Up @@ -1672,7 +1673,7 @@
}

if (s.start_longitudinal < helper_.getMinimumPrepareDistance()) {
continue;

Check warning on line 1676 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L1676

Added line #L1676 was not covered by tests
}

shift_lines.push_back(s);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "behavior_path_planner/scene_module/dynamic_avoidance/dynamic_avoidance_module.hpp"

#include "behavior_path_planner/utils/drivable_area_expansion/static_drivable_area.hpp"
#include "behavior_path_planner/utils/utils.hpp"
#include "object_recognition_utils/predicted_path_utils.hpp"
#include "signal_processing/lowpass_filter_1d.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "behavior_path_planner/scene_module/lane_change/normal.hpp"

#include "behavior_path_planner/marker_utils/utils.hpp"
#include "behavior_path_planner/utils/drivable_area_expansion/static_drivable_area.hpp"
#include "behavior_path_planner/utils/lane_change/utils.hpp"
#include "behavior_path_planner/utils/path_safety_checker/objects_filtering.hpp"
#include "behavior_path_planner/utils/path_safety_checker/safety_check.hpp"
Expand Down Expand Up @@ -1088,14 +1089,14 @@
return true;
}

bool NormalLaneChange::hasEnoughLengthToTrafficLight(

Check warning on line 1092 in planning/behavior_path_planner/src/scene_module/lane_change/normal.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/lane_change/normal.cpp#L1092

Added line #L1092 was not covered by tests
const LaneChangePath & path, const lanelet::ConstLanelets & current_lanes) const
{
const auto current_pose = getEgoPose();

Check warning on line 1095 in planning/behavior_path_planner/src/scene_module/lane_change/normal.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/lane_change/normal.cpp#L1095

Added line #L1095 was not covered by tests
const auto dist_to_next_traffic_light =
getDistanceToNextTrafficLight(current_pose, current_lanes);
const auto dist_to_next_traffic_light_from_lc_start_pose =
dist_to_next_traffic_light - path.info.length.prepare;

Check warning on line 1099 in planning/behavior_path_planner/src/scene_module/lane_change/normal.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/lane_change/normal.cpp#L1097-L1099

Added lines #L1097 - L1099 were not covered by tests

return dist_to_next_traffic_light_from_lc_start_pose <= 0.0 ||
dist_to_next_traffic_light_from_lc_start_pose >= path.info.length.lane_changing;
Expand Down Expand Up @@ -1360,10 +1361,10 @@
logger_, "Stop time is over threshold. Allow lane change in intersection.");
}

if (

Check warning on line 1364 in planning/behavior_path_planner/src/scene_module/lane_change/normal.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/lane_change/normal.cpp#L1364

Added line #L1364 was not covered by tests
lane_change_parameters_->regulate_on_traffic_light &&
!hasEnoughLengthToTrafficLight(*candidate_path, current_lanes)) {
continue;

Check warning on line 1367 in planning/behavior_path_planner/src/scene_module/lane_change/normal.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/lane_change/normal.cpp#L1367

Added line #L1367 was not covered by tests
}

candidate_paths->push_back(*candidate_path);
Expand Down Expand Up @@ -1638,7 +1639,7 @@

if (
!reference_lanelets.empty() &&
route_handler->isInGoalRouteSection(reference_lanelets.back())) {

Check warning on line 1642 in planning/behavior_path_planner/src/scene_module/lane_change/normal.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/lane_change/normal.cpp#L1642

Added line #L1642 was not covered by tests
const auto goal_arc_coordinates =
lanelet::utils::getArcCoordinates(reference_lanelets, route_handler->getGoalPose());
const double forward_length = std::max(goal_arc_coordinates.length, s_start);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "behavior_path_planner/scene_module/side_shift/side_shift_module.hpp"

#include "behavior_path_planner/marker_utils/utils.hpp"
#include "behavior_path_planner/utils/drivable_area_expansion/static_drivable_area.hpp"
#include "behavior_path_planner/utils/path_utils.hpp"
#include "behavior_path_planner/utils/side_shift/util.hpp"
#include "behavior_path_planner/utils/utils.hpp"
Expand Down
Loading
Loading