Design: Map Server
The map server (package cpm_lab_map_server, executable cpm_lab_map_server_node) loads one Lanelet2 map and
publishes it to the lab. The maps of the lab are in the package cpm_lab_maps; the map format is described in
Lanelet2 Maps.
Source: src/maps/cpm_lab_map_server/ — src/MapServer.cpp (loading and projection),
component/map_server_node.cpp (ROS interface), component/MapServerParameterRos.hpp (parameters).
Loading
The control flow starts the map server with the absolute path of the selected map in map_path: a file of
$CPM_LAB_HOME/maps/ or of cpm_lab_maps/maps/. Started by hand, map_path may also be relative to the share
directory of cpm_lab_maps:
ros2 run cpm_lab_map_server cpm_lab_map_server_node --ros-args -r __ns:=/lab -p map_path:=$HOME/cpm_lab/maps/mylab.osm
The map must contain a node with the tag origin (latitude and longitude of the lab origin) and may contain a node
orientation. The map server projects the geographic coordinates into metric lab coordinates with these reference
nodes, so the map coordinates match the IPS, whose origin is the outer corner of the calibration board (see
IPS Camera Calibration). Loading errors stop the node with an error message.
Interface
Topic |
Type |
Notes |
|---|---|---|
|
|
the binary Lanelet2 map with its name; reliable, transient local, published once |
|
|
a |
|
|
|
Because the map is transient local, every late subscriber receives it: the bridge forwards it to the planner domain, the control flow reads the spawn points of the simulated vehicles from it, and the recorder stores it with the run.
Parameters (config/default.yaml): map_path, frame_id (map) and parent_frame_id (world).
Using the Map
C++:
cpm_lab_lanelet2_extension_cppconverts the message back into alanelet::LaneletMap(lanelet::utils::conversion::fromBinMsg) and provides the projector.Python:
cpm_lab_lanelet2_extension_pydeserializes the message forlanelet2_python, as the example planner andcpm_evaldo.RViz:
cpm_lab_map_server_visualizationturns the map into aMarkerArrayon/lab/map_markers, scaled bymap_scale(18.04) for the display. The colors and layer heights are parameters in itsconfig/default.yaml.
Adding a Map
For a lab, put the .osm file into ~/cpm_lab/maps/; no rebuild is needed, see Your Own Maps and IPS Configurations.
Maps for all labs go into cpm_lab_maps/maps/ with a changelog entry. Check a new map with the tools in
Lanelet2 Maps before using it with vehicles.