Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualizing all possible areas that LIDAR can see with GridMap #1307

Open
omerfarukadastec opened this issue Apr 2, 2024 · 4 comments
Open

Comments

@omerfarukadastec
Copy link

Hi,

I need to visualize all possible areas that a LIDAR positioned on any robot/vehicle can see and the blind spots that may occur, depending on its location and technical features. For this, I wrote some codes using the classes in the "mrpt-maps" and "mrpt-opengl" modules, but I could not get exactly the result I wanted. I started the development process by examining the "maps_gmrf_map_example" and "maps_gridmap3D_simple" examples included in the C++ examples.

When I used COccupancyGridMap3D, I could not get the visualization I wanted and I could not even visualize the occupied voxels, only the grid map I created just appeared.

When I used CColouredOctoMap, I got a result close to what I wanted, even if it was black and white, but the main problem with CColouredOctoMap is that it only colors the pointcloud points where they reach. For this reason, the spaces between the pointcloud rings are not colored when they are on a flat area, as seen in the image below. What I'm basically trying to achieve is to color the grid cells that a pointcloud point originating from the sensor center passes through throughout its path.

2024-03-26_15-32

When I use CGasConcentrationGridMap2D, my main problem is that I cannot access the resulting grid cells. I am also trying to develop the code I developed for more than one LIDAR, and I need to color the areas seen by more than one LIDAR according to this system. Additionally, when there are many points, everywhere on the map is almost the same color, and I want to be able to clearly distinguish places that are outside the LIDAR range.

2024-03-25_15-27

What is your suggestion at this point? Am I missing some functions in the classes I use? Are there any other classes that I missed that would solve my problem? Basically what I'm trying to do can be done with MRPT? If possible, what can be improved using?

I generate LIDAR data using MVSim. In the code I developed, I access pointcloud data by subscribing through the ROS system.

@jlblancoc
Copy link
Member

Hi,
You mean a 2D planar lidar or a 3D lidar?

Your goal is to use one particular lidar scan (fixed data) to ray trace the cells that are visible, right? Or do you want to simulate that lidar data? (I guess it's the former since you're using mvsim but just to confirm)

@omerfarukadastec
Copy link
Author

Hi,

I'm trying to do it using 3D lidar. My goal is to color all visible cells using ray tracing or another method according to the pointcloud data received by MVSim. In addition, my goal is to perform this process with multiple lidars, for example, to visualize how many lidars any A cell can be seen by. To give an example, if cell A is seen by 2 different lidars, it is blue; if it sees 3, it is yellow; if it sees 4, it is orange.

At this point, yes, I'm basically trying to do ray tracing, but not through a single lidar scan. For example, when the position of the lidar changes on MVSim, my goal is to be able to see the result again. However, if this is not possible, I can also go through a single scan. I am trying to fully learn the opportunities that MRPT and MVSim offer me in this regard.

@jlblancoc
Copy link
Member

jlblancoc commented Apr 4, 2024

I think the best way to go might be using Bonxai's voxel maps, which are integrated in MRPT thru:

See these examples:

With that (using the standard insertObservation() API call to insert the 3D point cloud in the voxel map), you should be able to see observed cells by each 3D scan.

Now, counting them and coloring in a custom way is another story. You could create a mrpt::opengl::COctoMapVoxels and manually add the voxels with the color you want for each one, by going over all the bonxai's voxel map cells with the provided visitor methods to which you can pass a C++ lambda.

@omerfarukadastec
Copy link
Author

Thanks for the suggestions, I'll try to use the CVoxelMap, CVoxelMapRGB and COctoMapVoxels. I'll update after trying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants