Skip to content

Commit

Permalink
fix(lane_change): do not use reference values of polygon outer (#5318)
Browse files Browse the repository at this point in the history
* fix(lane_change): do not use refelence values of polygon outer

Signed-off-by: Fumiya Watanabe <[email protected]>

* fix(lane_change): fix in lane change

Signed-off-by: Fumiya Watanabe <[email protected]>

---------

Signed-off-by: Fumiya Watanabe <[email protected]>
  • Loading branch information
rej55 authored Oct 16, 2023
1 parent 78d4d82 commit dad4722
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,8 @@ LaneChangeTargetObjectIndices NormalLaneChange::filterObject(
// calc distance from the current ego position
double max_dist_ego_to_obj = std::numeric_limits<double>::lowest();
double min_dist_ego_to_obj = std::numeric_limits<double>::max();
for (const auto & polygon_p : obj_polygon.outer()) {
const auto obj_polygon_outer = obj_polygon.outer();
for (const auto & polygon_p : obj_polygon_outer) {
const auto obj_p = tier4_autoware_utils::createPoint(polygon_p.x(), polygon_p.y(), 0.0);
const double dist_ego_to_obj = calcSignedArcLength(path.points, current_pose.position, obj_p);
max_dist_ego_to_obj = std::max(dist_ego_to_obj, max_dist_ego_to_obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ bool isTargetObjectFront(
tier4_autoware_utils::calcOffsetPose(ego_pose, base_to_front, 0.0, 0.0);

// check all edges in the polygon
for (const auto & obj_edge : obj_polygon.outer()) {
const auto obj_polygon_outer = obj_polygon.outer();
for (const auto & obj_edge : obj_polygon_outer) {
const auto obj_point = tier4_autoware_utils::createPoint(obj_edge.x(), obj_edge.y(), 0.0);
if (tier4_autoware_utils::calcLongitudinalDeviation(ego_offset_pose, obj_point) > 0.0) {
return true;
Expand All @@ -70,7 +71,8 @@ bool isTargetObjectFront(
tier4_autoware_utils::calcOffsetPose(ego_pose, base_to_front, 0.0, 0.0).position;

// check all edges in the polygon
for (const auto & obj_edge : obj_polygon.outer()) {
const auto obj_polygon_outer = obj_polygon.outer();
for (const auto & obj_edge : obj_polygon_outer) {
const auto obj_point = tier4_autoware_utils::createPoint(obj_edge.x(), obj_edge.y(), 0.0);
if (motion_utils::isTargetPointFront(path.points, ego_point, obj_point)) {
return true;
Expand Down Expand Up @@ -134,7 +136,8 @@ Polygon2d createExtendedPolygon(
double min_x = std::numeric_limits<double>::max();
double max_y = std::numeric_limits<double>::lowest();
double min_y = std::numeric_limits<double>::max();
for (const auto & polygon_p : obj_polygon.outer()) {
const auto obj_polygon_outer = obj_polygon.outer();
for (const auto & polygon_p : obj_polygon_outer) {
const auto obj_p = tier4_autoware_utils::createPoint(polygon_p.x(), polygon_p.y(), 0.0);
const auto transformed_p = tier4_autoware_utils::inverseTransformPoint(obj_p, obj_pose);

Expand Down

0 comments on commit dad4722

Please sign in to comment.