HD map with JOSM & Lanelet2 - part 1
Summary
After getting a pointcloud map with for example LeGo-LOAM in rosbag file, load it to JOSM with real scale for easier lane map drawing.
End results:
Prerequisite
- ROS1 tested with melodic & noetic
- pcl-ros
- JOSM
- Lanelet2
- 3D_Slam_tools
1 - Convert bag to pcd
2 - Convert pcd to bt
Use arrow key to adjust the map distortion if needed, ctrl-c to close and save to .bt file.
3 - Convert bt to pgm map file
- Setting a large
z_min
allow the map to keep all the ground points which are very useful for creating lanes. - Adjust
z_max
to remove useless point clouds, like tree and building.
Run map_saver to save the map:
Example output:
map.yaml
map.pgm
4 - Visualization in JOSM
Add PicLayer plugin in JOSM:
mkdir -p ~/.josm/plugins
open josm
Edit -> Preferences -> Plugins click Download list, wait for the plugins list, check the PicLayer plugin checkbox, click update plugins
checkout files in ~/.josm/plugins, restart if needed
Convert pgm to png
It becomes a rgba image with transparent background, very useful to overlay on satellite image.
Add png in JOSM
Imagery->New picture layer from file... -> choose the previous output.png
Imagery->Mapbox Satellite, this is usually a good satellite image
Save calibration, open .cal file, change INITIAL_SCALE
value to 100* the resolution in map.yaml ( in map.pgm resolution=0.05 so 0.05*100 = 5.0)
Reload the png, the png will be at the right scale, follow step 2 and 3 in the previous picture to align (in step 2, you can put the order and opacity of layers that’s why a rgba image comes handy)
Result:
0 - Next
How to draw lane with josm, load it in RVIZ with Lanelets and planning with mission planner.