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

How to show the complete map in Rviz? #41

Closed
Rolanding opened this issue Feb 5, 2018 · 4 comments
Closed

How to show the complete map in Rviz? #41

Rolanding opened this issue Feb 5, 2018 · 4 comments

Comments

@Rolanding
Copy link

Rolanding commented Feb 5, 2018

I want to build a big outdoor map by using the Loam. But in the rviz, it just show a fixed-size map. Actually all the points cloud still exist in the rviz but it just show the sub map around the car. So how to show the complete map? And further more, how to save the full map into a .PCD file, Thanks.

@StefanGlaser
Copy link
Contributor

Your case sounds very similar to #39 however, the answers somehow disappeared...
@deepmeng maybe you're also interested, or may help on this one.

The mapping component of loam uses a sliding window approach for holding the accumulated point cloud map around the robot. At the beginning, the current implementation initializes a 3D grid around the initial position. Each cube within this grid is represented by a point cloud.
For each incoming sweep, the mapping component then only updates a small region of cubes around its current position. The updated region is then concatenated into one big point cloud, downsampled and published via the laser_cloud_surround topic.
The robot can move freely within the grid. However, as soon as it approaches any boundary of the grid, the grid is shifted in the corresponding direction, loosing previously accumulated map cubes on the opposite side of the grid. The size of the grid is currently hard-coded within the LaserMapping constructor (_laserCloudWidth, _laserCloudHeight, _laserCloudDepth). The size of each cube is (also hard-coded) 50x50x50 meter.

You should be able to publish the complete map to the laser_cloud_surround topic by simply concatenating all cubes into one big point cloud, instead of only the updated region. You'll find the corresponding code at the top of the LaserMapping::publishResult() method. Something like:

// accumulate full map cloud
_laserCloudSurround->clear();
for (int i = 0; i < _laserCloudNum; i++) {
  *_laserCloudSurround += *_laserCloudCornerArray[i];
  *_laserCloudSurround += *_laserCloudSurfArray[i];
}

should do the work. However, I guess this will have some negative impact on the runtime of the component, as it involves a lot of computation just to be able to display the whole map in the UI in real time.

For saving the full map into a .PCD file, you can do the same as above (concatenate all point cloud cubes into one big point cloud) and save the resulting point cloud instance using the PCL. Of course, I strongly recommend to implement an external trigger for saving the map into a .PCD file, as it's not reasonable to do this within the main loop.

@Rolanding
Copy link
Author

@StefanGlaser Thanks a lot, it really helps. And I've been in contact with deepmeng.

@Rmargin
Copy link

Rmargin commented Jul 10, 2020

HaHa

@hhongwei1009
Copy link

Your case sounds very similar to #39 however, the answers somehow disappeared... @deepmeng maybe you're also interested, or may help on this one.

The mapping component of loam uses a sliding window approach for holding the accumulated point cloud map around the robot. At the beginning, the current implementation initializes a 3D grid around the initial position. Each cube within this grid is represented by a point cloud. For each incoming sweep, the mapping component then only updates a small region of cubes around its current position. The updated region is then concatenated into one big point cloud, downsampled and published via the laser_cloud_surround topic. The robot can move freely within the grid. However, as soon as it approaches any boundary of the grid, the grid is shifted in the corresponding direction, loosing previously accumulated map cubes on the opposite side of the grid. The size of the grid is currently hard-coded within the LaserMapping constructor (_laserCloudWidth, _laserCloudHeight, _laserCloudDepth). The size of each cube is (also hard-coded) 50x50x50 meter.

You should be able to publish the complete map to the laser_cloud_surround topic by simply concatenating all cubes into one big point cloud, instead of only the updated region. You'll find the corresponding code at the top of the LaserMapping::publishResult() method. Something like:

// accumulate full map cloud
_laserCloudSurround->clear();
for (int i = 0; i < _laserCloudNum; i++) {
  *_laserCloudSurround += *_laserCloudCornerArray[i];
  *_laserCloudSurround += *_laserCloudSurfArray[i];
}

should do the work. However, I guess this will have some negative impact on the runtime of the component, as it involves a lot of computation just to be able to display the whole map in the UI in real time.

For saving the full map into a .PCD file, you can do the same as above (concatenate all point cloud cubes into one big point cloud) and save the resulting point cloud instance using the PCL. Of course, I strongly recommend to implement an external trigger for saving the map into a .PCD file, as it's not reasonable to do this within the main loop.

It didn't work.Is there a specific method?

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

4 participants