Skip to content

Commit 68cf246

Browse files
committed
fixed point cloud generation issue. visual inspection looks good for heightmap
1 parent 882f4a3 commit 68cf246

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

‎src/lidar/src/lidar_node.cpp‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,23 @@ void DEM(const sensor_msgs::PointCloud2ConstPtr& pointCloudMsg)
9191
// If the point is within the image size bounds
9292
if(map_pc2rc(cloud->points[j].x, cloud->points[j].y, &row, &column) == 1 && row >= 0 && row < IMAGE_HEIGHT && column >=0 && column < IMAGE_WIDTH){
9393
if(cloud->points[j].z > heightArray[row][column]){
94-
//ROS_ERROR("%d,%d", row,column);
9594
heightArray[row][column] = cloud->points[j].z;
96-
9795
}
9896
}
9997
}
10098

10199
// Create "point cloud" to be published for visualization and later python node PNG generation
102100
int index = 0;
101+
double x, y;
103102
for(int i = 0; i < IMAGE_HEIGHT; ++i){
104103
for(int j = 0; j < IMAGE_WIDTH; ++j){
105104
// Add point
106-
index = i * j;
107-
//cloud_grid->points[index].x = (double)j;
108-
//cloud_grid->points[index].y = (double)i;
105+
//index = i * j;
106+
(void)map_rc2pc(&x, &y, i, j);
107+
cloud_grid->points[index].x = x;
108+
cloud_grid->points[index].y = y;
109109
cloud_grid->points[index].z = heightArray[i][j];
110+
++index;
110111
}
111112
}
112113

0 commit comments

Comments
 (0)