How to use prebuilt map with rosbot


I am trying to use a prebuilt map on rosbot2. The map was built by using tutorial_7 instructions or launch file and used map_server to save and load the same prebuilt map.

Inside tutorial_7_core.launch file, did below modifications

<arg name="rosbot_pro" default="false"/>

<include file="$(find tutorial_pkg)/launch/rosbot_hardware.launch">
    <arg name="rosbot_pro" value="$(arg rosbot_pro)" />

<node pkg="tutorial_pkg" type="drive_controller_node" name="drive_controller"/>

<include file="$(find tutorial_pkg)/launch/amcl_demo.launch"></include>

<arg name="map_file" default="$(find tutorial_pkg)/maps/test_room_map.yaml"/>
<node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />

Used amcl_demo.launch file from rosbot_webgui package and copied it to tutorial_pkg/launch folder. Inside amcl_demo.launch file, with below modifications.

<?xml version="1.0"?>
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<rosparam file="$(find tutorial_pkg)/config/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find tutorial_pkg)/config/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find tutorial_pkg)/config/local_costmap_params.yaml" command="load" />
<rosparam file="$(find tutorial_pkg)/config/global_costmap_params.yaml" command="load" />
<rosparam file="$(find tutorial_pkg)/config/trajectory_planner.yaml" command="load" />

<remap from="cmd_vel" to="cmd_vel"/>
<remap from="odom" to="odom"/>
<remap from="scan" to="/scan"/>
<param name="move_base/DWAPlannerROS/yaw_goal_tolerance" value="1.0"/>
<param name="move_base/DWAPlannerROS/xy_goal_tolerance" value="1.0"/>

When I execute “roslaunch tutorial_pkg tutorial_7.launch” command I could see my prebuilt map on rviz but robot position and orientation are not correct. Could you please tell me how to setup robot position and orientation on prebuilt map? why localisation is not updating robot position in the map?

Any help would be appreciated.



Hello Vinod,

Do you get any output or errors from AMCL and other nodes?
Does AMCL publish any messages on amcl_pose or tf topics?