@@ -101,8 +101,36 @@ std::optional<std::pair<size_t, std::vector<PointWithStamp>>> get_collision_inde
101101 return std::nullopt ;
102102}
103103
104- // estimate the future ego pose with assuming that the pose error against the reference path will
105- // decrease to zero by the time_to_convergence.
104+ Polygon2d create_pose_footprint (
105+ const geometry_msgs::msg::Pose & pose, const VehicleInfo & vehicle_info, const double left_margin,
106+ const double right_margin)
107+ {
108+ using autoware_utils_geometry::calc_offset_pose;
109+ const double half_width = vehicle_info.vehicle_width_m / 2.0 ;
110+ const auto point0 =
111+ calc_offset_pose (pose, vehicle_info.max_longitudinal_offset_m , half_width + left_margin, 0.0 )
112+ .position ;
113+ const auto point1 =
114+ calc_offset_pose (pose, vehicle_info.max_longitudinal_offset_m , -half_width - right_margin, 0.0 )
115+ .position ;
116+ const auto point2 =
117+ calc_offset_pose (pose, -vehicle_info.rear_overhang_m , -half_width - right_margin, 0.0 ).position ;
118+ const auto point3 =
119+ calc_offset_pose (pose, -vehicle_info.rear_overhang_m , half_width + left_margin, 0.0 ).position ;
120+
121+ Polygon2d polygon;
122+ boost::geometry::append (polygon, msg_to_2d (point0));
123+ boost::geometry::append (polygon, msg_to_2d (point1));
124+ boost::geometry::append (polygon, msg_to_2d (point2));
125+ boost::geometry::append (polygon, msg_to_2d (point3));
126+ boost::geometry::append (polygon, msg_to_2d (point0));
127+
128+ boost::geometry::correct (polygon);
129+ return polygon;
130+ };
131+
132+ } // namespace
133+
106134// FIXME(soblin): convergence should be applied from nearest_idx ?
107135std::vector<geometry_msgs::msg::Pose> calculate_error_poses (
108136 const std::vector<TrajectoryPoint> & traj_points,
@@ -145,36 +173,6 @@ std::vector<geometry_msgs::msg::Pose> calculate_error_poses(
145173 return error_poses;
146174}
147175
148- Polygon2d create_pose_footprint (
149- const geometry_msgs::msg::Pose & pose, const VehicleInfo & vehicle_info, const double left_margin,
150- const double right_margin)
151- {
152- using autoware_utils_geometry::calc_offset_pose;
153- const double half_width = vehicle_info.vehicle_width_m / 2.0 ;
154- const auto point0 =
155- calc_offset_pose (pose, vehicle_info.max_longitudinal_offset_m , half_width + left_margin, 0.0 )
156- .position ;
157- const auto point1 =
158- calc_offset_pose (pose, vehicle_info.max_longitudinal_offset_m , -half_width - right_margin, 0.0 )
159- .position ;
160- const auto point2 =
161- calc_offset_pose (pose, -vehicle_info.rear_overhang_m , -half_width - right_margin, 0.0 ).position ;
162- const auto point3 =
163- calc_offset_pose (pose, -vehicle_info.rear_overhang_m , half_width + left_margin, 0.0 ).position ;
164-
165- Polygon2d polygon;
166- boost::geometry::append (polygon, msg_to_2d (point0));
167- boost::geometry::append (polygon, msg_to_2d (point1));
168- boost::geometry::append (polygon, msg_to_2d (point2));
169- boost::geometry::append (polygon, msg_to_2d (point3));
170- boost::geometry::append (polygon, msg_to_2d (point0));
171-
172- boost::geometry::correct (polygon);
173- return polygon;
174- };
175-
176- } // namespace
177-
178176std::optional<std::pair<geometry_msgs::msg::Point, double >> get_collision_point (
179177 const std::vector<TrajectoryPoint> & traj_points, const std::vector<Polygon2d> & traj_polygons,
180178 const geometry_msgs::msg::Point obj_position, const rclcpp::Time obj_stamp,
0 commit comments