PcdGeneration
Abstract
Pcd Generation
is a tool for a vehicle based point cloud mapping in a simulation environment.
It is useful when you need a point cloud based on some location, but are not able to conduct physically mapping on the real place.
When Pcd Generation
is conducted, Vehicle
object (carrying LiDAR
) is warped along all centerlines of lanelets in the imported OSM
map.
Point cloud map is generated to record points by LiDAR
on Vehicle
object on each centerlines of lanelets.
Overview
Traffic Simulation
consists of the following flow:
graph TB
subgraph A["PcdGeneration::Initialize()"]
direction TB
AA("Load LaneletMap")~~~AB("Create `Capture Pose Queue`")
end
AB-->BA
subgraph B["PcdGeneration::OnUpdate()"]
direction TB
BA--"yes"-->BE("PcdGeneration::SavePcd()")
BA{`Capture Pose Queue` is empty}--"no"-->BB("Dequeue `Capture Pose Queue`")-->BC("Move pose")-->BD("Capture by LiDAR")-->BA
end
Configuration
PcdGeneration
can be configured from PcdGenerator
and RGLMappingAdapter
components.
The configurable elements are listed in the following table:
PcdGenerator
Parameter | Description |
---|---|
Osm Data Container | Imported OSM file. |
Vehicle Transform | Game object containing sensors to capture pointcloud. |
Rgl Mapping Adapter | Reference of LiDAR object which is attached RGLMappingAdapter . |
Output Pcd File Path | Result PCD file name.On captured, it will be saved in Assets/[Output Pcd File Path] |
Capture Location Interval | Distance in meters between consecutive warps along the centerline of a lanelet. |
World Origin ROS | World origin in ROS coordinate systems, will be added to every point coordinates. |
RGLMappingAdapter
Parameter | Description |
---|---|
Enable Downsampling | Enable/disable point cloud data downsampling. |
Leaf Size | Resolution of point cloud data downsampling. |
Execution and Parameters
Execution
If you play prepared scene, PcdGenerator
will automatically start mapping.
PCD
file will be written when you stop scene or all lanelets in the route are captured.
If the Vehicle
stops moving and you see the following message in the bottom left corner, you can safely stop the scene.
pcd save success
The Point cloud (*.pcd
) file is saved to the location you specified in the Output Pcd File Path
of PcdGenerator
.
Parameters
Following parameters are useful to point cloud map of quality and file size you want to.
Leaf Size
Downsampling aims to reduce PCD
size which for large point clouds may achieve gigabytes in exchange for map details.
It is essential to find the acceptable balance between the file size and details level.
Leaf Size
can be configured by RGLMappingAdapter
component.
A small Leaf Size
results in a more detailed PCD
, while a large Leaf Size
could result in excessive filtering such that objects like buildings are not recorded in the PCD
.
Leaf Size = 1.0 | Leaf Size = 10.0 | Leaf Size = 100.0 |
---|---|---|
![]() |
![]() |
![]() |
Capture Location Interval
If the Capture Location Interval
is too small, it could result in a sparse PCD
where some region of the map is captured well but the other regions aren't captured at all.
Capture Location Interval
can be configured by PcdGeneration
component.
Capture Location Interval = 6 | Capture Location Interval = 20 | Capture Location Interval = 100 |
---|---|---|
![]() |
![]() |
![]() |
Instruction
To use Pcd Generation
, please follow the steps below.
For the preparation, the following must be prepared:
- 3D map (.fbx)
- lanelet map (.osm)
- LiDAR sensor (.fbx)
Info
AWSIM includes AutowareSimulationDemo
scene.
Please refer to:
* Assets/Awsim/Scenes/PcdGenerationDemo.unity
1. Add a Vehicle
object
Add Vehicle
object to carry LiDAR and capture points.
In addition, visual elements of Vehicle
if needed.
Please create Vehicle
object as the following:
- Create empty
GameObject
(should beVehicle
) - (optional) Create empty
GameObject
(should beVehicle/Geometry
)- If needed, visual elements of
Vehicle
added here - Visual element can even be a simple
Cube
object as the sample image
- If needed, visual elements of
2. Add a Camera
Add Unity Camera
to visualize recording process.
Please create Unity Camera
as the following:
- Create
Camera
object (should beVehicle/Follow Camera
) - Attach
FollowCamera
component toFollow Camera
- Fill in
Target
field withVehicle
- Modify
Transform
- Using
Cameras
Unity view allows you to check the camera view
- Using
3. Add a LiDAR
related objects
Add LiDAR
object and configure components to record points.
LiDAR object
Please create and configure LiDAR
object as the following:
- Create
LiDAR
object (should beVehicle/LiDAR
) - Set
Transform.Position.Y
2.5 - Attach
PointCloudVisualization
component toLiDAR
- Attach
LidarSensor
component toLiDAR
- Select
Model Preset
(VelodyneVLP16
andVelodyneVLS128
is recommended)VelodyneVLS128
can create more detail maps thanVelodyneVLP16
VelodyneVLP16
can work lighter thanVelodyneVLS128
- Set
Apply Distance Gaussian Noise
andApply Angular Gaussian Noise
False
- Select
- Attach
RGLMappingAdapter
component toLiDAR
RGLSceneManager
Please create SceneManager
object as the following:
- Create empty
GameObject
(should beRGLSceneManager
) - Attach
SceneManager
component toRGLSceneManager
4. Setup PcdGenerator
Add PcdGenerator
component to manage above objects and create point cloud map.
- Create empty
GameObject
(should bePcdGenerator
) - Attach
PcdGenerator
component toPcdGenerator
- Fill in
Osm Data Container
field with.osm
file- If there is not
.osm
file in project, move.osm
file toAssets/Awsim/Externals
directory using file expoler
- If there is not
- Fill in
Vehicle Transform
field withVehicle
- Fill in
Rgl Mapping Adapter
field withLiDAR
- (optional) Fill in
World Origin ROS
field if your map hasMgrs Position
component
5. Call methods of PcdGenerator
and FollowCamera
Some methods of PcdGenerator
and FollowCamera
should be called from callback of MonoBehaviour
to enable Pcd Generation
.
Please implement as the following:
- Create or open class which is inherit
MonoBehaviour
- Make fields of
PcdGenerator
andFollowCamera
- Add description of calling method of
PcdGenerator
andFollowCamera
The method should be called are listed in the following table:
Pcd Generation
Method | Description |
---|---|
Initialize() | Should be called Start() callback. |
OnUpdate() | Should be called Update() callback. |
FollowCamera
Method | Description |
---|---|
Initialize() | Should be called Start() callback. |
OnUpdate() | Should be called Update() callback. |
Info
AWSIM includes AutowareSimulationDemo
scene.
Please refer to:
* Assets/Awsim/Scenes/PcdGenerationDemo/PcdGenerationDemo.cs
* Assets/Awsim/Scenes/PcdGenerationDemo.unity
scene
Modify and Verify PCD
files
Modify PCD
Generated PCD
files should be downsample because they are typically too large.
In addition, they should be converted to ASCII format because Autoware
accepts only this format. (Pcd Generation
returns PCD in binary format)
The tool (DownsampleLargePCD
) can realize downsampling and converting PCD
files.
Please clone and build DownsampleLargePCD
tool following Github repository.
Please use DownsampleLargePCD
tool as the following:
- Change the working directory to the location with
DownsampleLargePCD
tool. - Use
DownsampleLargePCD
tool to downsample and savePCD
inASCII
format.- You can also save
PCD
in binary format by adding-binary 1
option.
- You can also save
Note
If you don't want to downsample but want to convert PCD
file to ASCII
, you should use pcl_convert_pcd_ascii_binary
tool.
This tool is available in the pcl-tools
package and can be installed on Ubuntu with the following command:
Verify PCD
To verify your PCD
you can launch the Autoware*
(https://github.com/autowarefoundation/autoware).
Please verify PCD
as the following:
-
Copy your
PCD
from theAWSIM
project directory to theAutoware
map directory -
Source the
ROS
andAutoware
-
Launch the
planning simulation
with the map directory path (map_path
) and PCD file (pointcloud_map_file
) specifiedros2 launch autoware_launch planning_simulator.launch.xml \ vehicle_model:=sample_vehicle \ sensor_model:=sample_sensor_kit \ map_path:=<ABSOLUTE_PATH_TO_AUTOWARE_MAP> \ pointcloud_map_file:=<PCD_FILE_NAME>
PCD file location
The PCD file needs to be located in the Autoware map directory and as a
pointcloud_map_file
parameter you only supply the file name, not the path.Absolute path
When launching
Autoware
never use~/
to specify the home directory. Either write the full absolute path or use$HOME
environmental variable. -
Wait for the
Autoware
to finish loading and inspect thePCD
visually given the effect ofLeaf Size
and effect ofCapture Location Interval
.