Skip to content

Commit 475254c

Browse files
authored
Merge pull request #1357 from tier4/beta/v0.11.1-remove-lane_id-from-arc_lane_util
fix(autoware_behavior_velocity_planner_common): remove lane_id check from arc_lane_util
2 parents f74b33d + e44d13e commit 475254c

File tree

6 files changed

+11
-25
lines changed

6 files changed

+11
-25
lines changed

planning/behavior_velocity_detection_area_module/src/scene.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ bool DetectionAreaModule::modifyPathVelocity(PathWithLaneId * path, StopReason *
8282

8383
// Get stop point
8484
const auto stop_point = arc_lane_utils::createTargetPoint(
85-
original_path, stop_line, lane_id_, planner_param_.stop_margin,
85+
original_path, stop_line, planner_param_.stop_margin,
8686
planner_data_->vehicle_info_.max_longitudinal_offset_m);
8787
if (!stop_point) {
8888
return true;
@@ -127,7 +127,7 @@ bool DetectionAreaModule::modifyPathVelocity(PathWithLaneId * path, StopReason *
127127
if (planner_param_.use_dead_line) {
128128
// Use '-' for margin because it's the backward distance from stop line
129129
const auto dead_line_point = arc_lane_utils::createTargetPoint(
130-
original_path, stop_line, lane_id_, -planner_param_.dead_line_margin,
130+
original_path, stop_line, -planner_param_.dead_line_margin,
131131
planner_data_->vehicle_info_.max_longitudinal_offset_m);
132132

133133
if (dead_line_point) {

planning/behavior_velocity_no_stopping_area_module/src/scene_no_stopping_area.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ bool NoStoppingAreaModule::modifyPathVelocity(PathWithLaneId * path, StopReason
128128
return true;
129129
}
130130
const auto stop_point = arc_lane_utils::createTargetPoint(
131-
original_path, stop_line.value(), lane_id_, planner_param_.stop_margin,
131+
original_path, stop_line.value(), planner_param_.stop_margin,
132132
planner_data_->vehicle_info_.max_longitudinal_offset_m);
133133
if (!stop_point) {
134134
setSafe(true);

planning/behavior_velocity_planner_common/include/behavior_velocity_planner_common/utilization/arc_lane_util.hpp

+5-16
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,9 @@ inline boost::optional<geometry_msgs::msg::Point> checkCollision(
126126
template <class T>
127127
boost::optional<PathIndexWithPoint> findCollisionSegment(
128128
const T & path, const geometry_msgs::msg::Point & stop_line_p1,
129-
const geometry_msgs::msg::Point & stop_line_p2, const size_t target_lane_id)
129+
const geometry_msgs::msg::Point & stop_line_p2)
130130
{
131131
for (size_t i = 0; i < path.points.size() - 1; ++i) {
132-
const auto & prev_lane_ids = path.points.at(i).lane_ids;
133-
const auto & next_lane_ids = path.points.at(i + 1).lane_ids;
134-
135-
const bool is_target_lane_in_prev_lane =
136-
std::find(prev_lane_ids.begin(), prev_lane_ids.end(), target_lane_id) != prev_lane_ids.end();
137-
const bool is_target_lane_in_next_lane =
138-
std::find(next_lane_ids.begin(), next_lane_ids.end(), target_lane_id) != next_lane_ids.end();
139-
if (!is_target_lane_in_prev_lane && !is_target_lane_in_next_lane) {
140-
continue;
141-
}
142-
143132
const auto & p1 =
144133
tier4_autoware_utils::getPoint(path.points.at(i)); // Point before collision point
145134
const auto & p2 =
@@ -157,12 +146,12 @@ boost::optional<PathIndexWithPoint> findCollisionSegment(
157146

158147
template <class T>
159148
boost::optional<PathIndexWithPoint> findCollisionSegment(
160-
const T & path, const LineString2d & stop_line, const size_t target_lane_id)
149+
const T & path, const LineString2d & stop_line)
161150
{
162151
const auto stop_line_p1 = convertToGeomPoint(stop_line.at(0));
163152
const auto stop_line_p2 = convertToGeomPoint(stop_line.at(1));
164153

165-
return findCollisionSegment(path, stop_line_p1, stop_line_p2, target_lane_id);
154+
return findCollisionSegment(path, stop_line_p1, stop_line_p2);
166155
}
167156

168157
template <class T>
@@ -265,10 +254,10 @@ geometry_msgs::msg::Pose calcTargetPose(const T & path, const PathIndexWithOffse
265254

266255
inline boost::optional<PathIndexWithPose> createTargetPoint(
267256
const autoware_auto_planning_msgs::msg::PathWithLaneId & path, const LineString2d & stop_line,
268-
const size_t lane_id, const double margin, const double vehicle_offset)
257+
const double margin, const double vehicle_offset)
269258
{
270259
// Find collision segment
271-
const auto collision_segment = findCollisionSegment(path, stop_line, lane_id);
260+
const auto collision_segment = findCollisionSegment(path, stop_line);
272261
if (!collision_segment) {
273262
// No collision
274263
return {};

planning/behavior_velocity_planner_common/test/src/test_arc_lane_util.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,11 @@ TEST(findCollisionSegment, nominal)
4848
*
4949
**/
5050
auto path = test::generatePath(0.0, 0.0, 5.0, 0.0, 6);
51-
for (auto & point : path.points) {
52-
point.lane_ids.push_back(100);
53-
}
5451

5552
LineString2d stop_line;
5653
stop_line.emplace_back(Point2d(3.5, 3.0));
5754
stop_line.emplace_back(Point2d(3.5, -3.0));
58-
auto segment = arc_lane_utils::findCollisionSegment(path, stop_line, 100);
55+
auto segment = arc_lane_utils::findCollisionSegment(path, stop_line);
5956
EXPECT_EQ(segment->first, static_cast<size_t>(3));
6057
EXPECT_DOUBLE_EQ(segment->second.x, 3.5);
6158
EXPECT_DOUBLE_EQ(segment->second.y, 0.0);

planning/behavior_velocity_stop_line_module/src/scene.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ bool StopLineModule::modifyPathVelocity(PathWithLaneId * path, StopReason * stop
5252

5353
// Calculate stop pose and insert index
5454
const auto stop_point = arc_lane_utils::createTargetPoint(
55-
*path, stop_line, lane_id_, planner_param_.stop_margin,
55+
*path, stop_line, planner_param_.stop_margin,
5656
planner_data_->vehicle_info_.max_longitudinal_offset_m);
5757

5858
// If no collision found, do nothing

planning/behavior_velocity_virtual_traffic_light_module/src/scene.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ boost::optional<size_t> VirtualTrafficLightModule::getPathIndexOfFirstEndLine()
379379
end_line_p2.y = end_line.back().y();
380380

381381
const auto collision =
382-
arc_lane_utils::findCollisionSegment(module_data_.path, end_line_p1, end_line_p2, lane_id_);
382+
arc_lane_utils::findCollisionSegment(module_data_.path, end_line_p1, end_line_p2);
383383
if (!collision) {
384384
continue;
385385
}

0 commit comments

Comments
 (0)