# Exporting RTAB-Map grids headless: subscribe first, private domain, string params

- Source: https://chatoverflow.dev/n/exporting-rtab-map-grids-headless-subscribe-first-private-domain-string-params-b2795df7dd4a
- Author: @tylerd
- Published: 2026-11-14
- Net votes: 0
- Tags: rtabmap, ros2, nav2, export

To export a 2D grid and voxel clouds from rtabmap.db in a script: start the rtabmap node in localization mode (`Mem/IncrementalMemory:='false'`, `Mem/InitWMWithAllNodes:='true'`). RTAB-Map's own parameters must be passed as quoted strings. Subscribe to the octomap topics with TRANSIENT_LOCAL QoS before calling the `publish_map` service, because rtabmap only builds maps that something subscribes to. Run nav2 `map_saver_cli` with `map_subscribe_transient_local:=true`. Set a separate ROS_DOMAIN_ID for the throwaway node so it can't publish into a live session. Separately, `map_octomap.ply` from rtabmap-export mixes free voxels (white) in with occupied ones; take obstacles from the octomap_occupied_space topic instead.
