How can I edit a map from cartographer?
I used cartographer_ros (ROS noetic) to create a 2D SLAM map from a laser scan. The generated maps has some imperfections, for example it laser scanner does not detect a mirror. I edited the generated map.pgm to correct it.
But when I use it later on for localization with cartographer_node it shows the original map and not the edited map. What is the proper procedure to use an edited map?
Here is the launch file for navigation. The map.yaml
points to the edited map.pgm
<arg if="$(eval arg('robot_name') == '/')" name="frame_prefix" value="" />
<arg unless="$(eval arg('robot_name') == '/')" name="frame_prefix" value="$(arg robot_name)/" />
<group ns="$(arg robot_name)">
<!-- Map server -->
<arg name="map_file" default="$(find mini_pupper)/maps/map.yaml"/>
<node pkg="map_server" name="map_server" type="map_server" args="$(arg map_file)" >
<param name="frame_id" value="$(arg frame_prefix)map" />
</node>
<!-- Localization -->
<arg name="pbstream_file" default="$(find mini_pupper)/maps/map.pbstream"/>
<node name="cartographer_node" pkg="cartographer_ros"
type="cartographer_node" args="
-configuration_directory $(find mini_pupper)/config/cartographer
-configuration_basename nav.lua
-load_state_filename $(arg pbstream_file)"
output="screen">
</node>
<node name="cartographer_occupancy_grid_node" pkg="cartographer_ros"
type="cartographer_occupancy_grid_node" args="-resolution 0.05" />
<!-- Calls navigation stack -->
<include file="$(find mini_pupper)/launch/include/move_base.launch">
<arg name="frame_prefix" value="$(arg frame_prefix)"/>
<arg name="robot_name" value="$(arg robot_name)"/>
</include>
<node if="$(arg rviz)" name="rviz" pkg="rviz" type="rviz"
args="-d $(find champ_navigation)/rviz/navigate.rviz -f $(arg frame_prefix)map"
output="screen"/>
</group>
Asked by jensanjo on 2022-02-27 05:39:03 UTC
Answers
To use cartographer in pure localization mode, you will need the original .pbtream
map.
I understand the fact that having a correted or almost perfect map in .pgm
is easier, e.g. if you have a floor plan.
But to reuse cartographer with this map you will need to converte it again to .pbtream
.
To do that you can use the Ogm2Pgbm package.
Additionally, if you wanna run the tool in a separate docker container you can follow the instuctions in the readme.
Have fun, and enjoy the power of graph-based localization! :D
Asked by Miguel A. Vega Torres on 2022-11-27 09:27:35 UTC
Comments