c++navigationrosroboticspose

initial pose of robot in ROS navigation stack


I have a relatively simple issue with the initialization of the robot pose in navigation stack. After doing a SLAM in the environment and saving the static map from map_server with desired resolution and size, and after finally making it available from static map server, I can not properly initialize my robot pose. Although, the initialization is possible with RVIZ (2D pose estimation option), it is inaccurate obviously since I am doing it by hand. This has a second draw back namely, when I am using a position (/move_base_trajectory topic) tracking instead of velocity tracking (/cmd_vel topic), there is an offset of the current position which I should manually compensate in my low-level controller. Is there any other proper (automatic) pose initialization approach?
PS: I am using Lidar /scan topic to feed costmap functionalities. I have also tested the initilization of the robot with hector_slam stack which pretty accurate however, with that I am getting a second map which interferes with the first one and pose association does not work. There should be a more proper approach I guess. I am loading my static map within the launch file:

<master auto="start"/>
 <!-- Run the map server --> 
    <node name="map_server" pkg="map_server" type="map_server" args="$(find my_robot_name_2dnav)/mymap.pgm 0.1"/>

and my static map yaml file is as simple as

image: mymap.pgm
resolution: 0.100000
origin: [-12.549999, -12.549999, 0.000000]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196

Solution

  • Use AMCL for localization in a pre-built map.

    You will have to specify an estimate of the initial robot position, which can be done through Rviz or by specifying it as a parameter. The initial position need not be exact, even if it is not very accurate AMCL will refine the position over time.