Skip to content

Commit

Permalink
fix(autoware_lidar_centerpoint): fixed rounding errors that caused il…
Browse files Browse the repository at this point in the history
…legal memory access (#9795)

fix: fixed rounding errors that caused illegal memory address

Signed-off-by: Kenzo Lobos-Tsunekawa <kenzo.lobos@tier4.jp>
  • Loading branch information
knzo25 authored Jan 7, 2025
1 parent 7fb4c1b commit ab845fb
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ __global__ void generateVoxels_random_kernel(

int voxel_idx = floorf((point.x - min_x_range) / pillar_x_size);
int voxel_idy = floorf((point.y - min_y_range) / pillar_y_size);
voxel_idx = voxel_idx < 0 ? 0 : voxel_idx >= grid_x_size ? grid_x_size - 1 : voxel_idx;
voxel_idy = voxel_idy < 0 ? 0 : voxel_idy >= grid_y_size ? grid_y_size - 1 : voxel_idy;
unsigned int voxel_index = (grid_x_size - 1 - voxel_idx) * grid_y_size + voxel_idy;

unsigned int point_id = atomicAdd(&(mask[voxel_index]), 1);
Expand Down

0 comments on commit ab845fb

Please sign in to comment.