Skip to content

Commit

Permalink
fix(behavior_path_planner): add transformation to polygon, obj frame …
Browse files Browse the repository at this point in the history
…to map frame (#251)

* fix(behavior_path_planner): add transformation to polygon, obj frame to map frame

* fix(behavior_path_planner): use universe message type
  • Loading branch information
h-ohta authored and TomohitoAndo committed Jan 29, 2022
1 parent c8a4e5c commit 0a3df0c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion planning/behavior_path_planner/src/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,13 @@ bool calcObjectPolygon(const PredictedObject & object, Polygon2d * object_polygo
obj_x + r * std::cos(2.0 * M_PI / N * i), obj_y + r * std::sin(2.0 * M_PI / N * i));
}
} else if (object.shape.type == Shape::POLYGON) {
tf2::Transform tf_map2obj;
tf2::fromMsg(object.kinematics.initial_pose_with_covariance.pose, tf_map2obj);
const auto obj_points = object.shape.footprint.points;
for (const auto & obj_point : obj_points) {
object_polygon->outer().emplace_back(obj_point.x, obj_point.y);
tf2::Vector3 obj(obj_point.x, obj_point.y, obj_point.z);
tf2::Vector3 tf_obj = tf_map2obj * obj;
object_polygon->outer().emplace_back(tf_obj.x(), tf_obj.y());
}
} else {
RCLCPP_WARN(
Expand Down

0 comments on commit 0a3df0c

Please sign in to comment.