When I view the pointcloud in rviz2 with rgb8 as the color transformer everything looks good. When I switch to any other transformer (e.g., flat color) then I see lots of old point cloud data hanging around. I looked at the code and it seems that when it performs the conversion to generate the pointcloud, if the distance to the point is greater than the maximum distance (I think 3m) then it just changes the alpha value to 0 (meaning it just makes it transparent). The point data from the previous calculation is still there (the x, y, z data) so when you look at it in flat color mode, you see the old data. The problem this introduces is that my obstacle layer is treating all that old data as obstacles, and calculating the cost map accordingly.
I changed the code to go ahead and calculate new x, y, z data even though its beyond max distance and it seems to clear everything up, but it's odd that this hasn't come up before unless I'm actually the first trying to use it to generate a costmap.
When I view the pointcloud in rviz2 with rgb8 as the color transformer everything looks good. When I switch to any other transformer (e.g., flat color) then I see lots of old point cloud data hanging around. I looked at the code and it seems that when it performs the conversion to generate the pointcloud, if the distance to the point is greater than the maximum distance (I think 3m) then it just changes the alpha value to 0 (meaning it just makes it transparent). The point data from the previous calculation is still there (the x, y, z data) so when you look at it in flat color mode, you see the old data. The problem this introduces is that my obstacle layer is treating all that old data as obstacles, and calculating the cost map accordingly.
I changed the code to go ahead and calculate new x, y, z data even though its beyond max distance and it seems to clear everything up, but it's odd that this hasn't come up before unless I'm actually the first trying to use it to generate a costmap.