Point Cloud Export#

Point cloud exporter tool can be used to generate point clouds from the environments and save them in binary PCD format. Exporter will only work on properly prepared environments - you can either use one of the existing environment assets or create a new environment.

Exported data contains position (4 bytes per axis per point, float type) and intensity (1 byte per point, uint8 type) for each point. Points are generated precisely on meshes, with no noise. For more information about point distribution and density, see generation process section.

To use the exporter, you need to have at least one point cloud generating sensor in your project. You can use lidar sensor for this - simply make sure that the sensor repository is cloned into Assets/External/Sensors in the Simulator project.

Accessing the exporter top#

To access point cloud exporter window, open Simulator project in Unity editor, then navigate into Simulator/Export Point Cloud on the menu bar. Point cloud exporter window will be opened.

Exporter settings top#

Parameter Name Description
Generator Class Class that will be used for generating points. See generator class section for details.
Template Settings template for the generator class. This assumes that lidar is used, see notes below.
Height Height above the ground at which generator will be placed. See generation process section for details.
Distance Step distance between subsequent generations. See generation process section for details.
Ratio Fraction of randomly selected points that will be kept after each generation.
Output path Path to the PCD file that will be created.

Note: Template assumes that lidar sensor will be used as the generator class. If you use another generator class or create your own, some of the values in template may not be applicable. Templates with higher numbers generate more points per scan.

Generation process top#

Generation process follows a simple loop: generator is moved along all the roads in the environment with movement step defined by Distance. For each position it's placed at a defined Height, then a scan happens. Scan generates a number of points. Fraction of them (defined by Ratio) is randomly picked and appended to the point cloud, the rest is discarded.

Assuming that the lidar sensor is used as generator, this approach has a few implications: - For each scan, points are more dense closer to the sensor position - In the final point cloud, points are more dense near the roads - Points are not uniformly distributed - Elements invisible from the road are not included in the point cloud - Circular patterns can be visible if Distance is too high

While this approach creates data sets similar to real world scenario of scanning environment through sensors attached to a vehicle, it might not be suitable for some use cases that require uniform distribution or inclusion of occluded areas. Custom generator class can address these issues.

Generator class top#

Generator class is responsible for providing a set of points for each scan position during generation process. Its behavior is not defined beyond that, so if you have a particular case that is not covered by default implementation (e.g. you need uniform sampling or no occlusion), you can create a custom generator class.

Default implementation of the point cloud generator can be found in the lidar sensor repository. If you want to use any other class for generating point cloud, it has to be a valid sensor plugin that implements IPointCloudGenerator interface. All sensor plugins implementing this interface will be listed under the Generator Class section in settings.

IPointCloudGenerator defines 3 methods that have to be implemented: - void ApplySettings(LidarTemplate template) - called once before first scan. Use this for initialization. Settings for selected lidar template are available here. - Vector4[] GeneratePoints(Vector3 position) - called for each scan. This implementation should return an array of points (x, y, z, intensity) in world space generated for given position. - void Cleanup() - called once after last scan. Use this to clean up any used resources.