Skip to content

Commit

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

Signed-off-by: Shunsuke Miura <[email protected]>

* change using sentence

Signed-off-by: Shunsuke Miura <[email protected]>

* fix

Signed-off-by: Shunsuke Miura <[email protected]>

* remove unused code

Signed-off-by: Shunsuke Miura <[email protected]>
  • Loading branch information
miursh authored and TomohitoAndo committed Aug 3, 2022
1 parent b4492a9 commit 7af412e
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 7af412e

Please sign in to comment.