Skip to content

Commit

Permalink
fix(scan_ground_filter): fix segmentation fault (tier4#1503)
Browse files Browse the repository at this point in the history
* feat(scan_ground_filter): fix segfault

Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp>

* change using sentence

Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp>

* fix

Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp>

* remove unused code

Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp>
  • Loading branch information
miursh authored and boyali committed Oct 3, 2022
1 parent a9f1705 commit f029030
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace ground_segmentation
using pointcloud_preprocessor::get_param;
using tier4_autoware_utils::calcDistance3d;
using tier4_autoware_utils::deg2rad;
using tier4_autoware_utils::normalizeDegree;
using tier4_autoware_utils::normalizeRadian;
using vehicle_info_util::VehicleInfoUtil;

Expand Down Expand Up @@ -87,7 +88,8 @@ void ScanGroundFilterComponent::convertPointcloud(
for (size_t i = 0; i < in_cloud->points.size(); ++i) {
auto radius{static_cast<float>(std::hypot(in_cloud->points[i].x, in_cloud->points[i].y))};
auto theta{normalizeRadian(std::atan2(in_cloud->points[i].x, in_cloud->points[i].y), 0.0)};
auto radial_div{static_cast<size_t>(std::floor(theta / radial_divider_angle_rad_))};
auto radial_div{
static_cast<size_t>(std::floor(normalizeDegree(theta / radial_divider_angle_rad_, 0.0)))};

current_point.radius = radius;
current_point.theta = theta;
Expand Down

0 comments on commit f029030

Please sign in to comment.