Exercise 2.15.......remap?

Respected Prof,
I was trying to solve the exercise. I launched the .launch file with the following code lines:

    <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
        <rosparam file="$(find my_mapping_launcher)/params/gmapping_params.yaml" command="load" />


It wasn’t working. Then I went through exercise solution and realized that the following lines are missing:
arg name=“scan_topic” default="/kobuki/laser/scan" /
remap from=“scan” to="$(arg scan_topic)"/

  1. Why does it not work without these lines ?
  2. What does these lines do ?

Hello @abdulbasitisdost,

By default, the gmapping node will listen to a topic named /scan in order to get the laser readings for creating the map of the environment. In this case, the robot is not publishing the laser readings into a topic named /scan but named /kobuki/laser/scan instead. Therefore, we need to make a remap in the launch file so that the gmapping node subscribes to the proper topic.