ROS for Robot (Theoretical) 04 SLAM

SLAM (Simultaneous Localization And Mapping) is a technique used in robotics to simultaneously create a map of an environment while keeping track of the robot’s location within it.

There are several well-established libraries and frameworks available that simplify SLAM implementation. We need to install the package by “sudo apt-get install ros–slam-gmapping “. Then create launch file

<!-- Start Gmapping -->
<node name="slam_gmapping" pkg="gmapping" type="slam_gmapping" output="screen">
    <param name="base_frame" value="base_link"/>
    <param name="odom_frame" value="odom"/>
</node>

<!-- Start the robot base controller -->
<node name="base_controller" pkg="your_package" type="your_base_controller_node" />

<!-- Start the laser scanner driver -->
<node name="laser_driver" pkg="your_package" type="your_laser_driver_node" />

type command “roslaunch your_package slam. Launch” to launch it. can visualize it by command “rosrun rviz rviz”.

A bit more complex launch file is

<!-- Start Gmapping -->
<node name="slam_gmapping" pkg="gmapping" type="slam_gmapping" output="screen">
    <!-- Set the base frame -->
    <param name="base_frame" value="base_link"/>
    <!-- Set the odometry frame -->
    <param name="odom_frame" value="odom"/>
    <!-- Set other gmapping parameters as needed -->
    <param name="map_update_interval" value="5.0"/>
    <param name="maxUrange" value="30.0"/>
    <param name="sigma" value="0.05"/>
    <param name="kernelSize" value="1"/>
    <param name="lstep" value="0.05"/>
    <param name="astep" value="0.05"/>
    <param name="iterations" value="5"/>
    <param name="lsigma" value="0.075"/>
    <param name="ogain" value="3.0"/>
    <param name="lskip" value="0"/>
    <param name="srr" value="0.1"/>
    <param name="srt" value="0.2"/>
    <param name="str" value="0.1"/>
    <param name="stt" value="0.2"/>
    <param name="linearUpdate" value="1.0"/>
    <param name="angularUpdate" value="0.5"/>
    <param name="temporalUpdate" value="-1.0"/>
    <param name="resampleThreshold" value="0.5"/>
    <param name="particles" value="30"/>
    <param name="xmin" value="-10.0"/>
    <param name="ymin" value="-10.0"/>
    <param name="xmax" value="10.0"/>
    <param name="ymax" value="10.0"/>
    <param name="delta" value="0.05"/>
    <param name="llsamplerange" value="0.01"/>
    <param name="llsamplestep" value="0.01"/>
    <param name="lasamplerange" value="0.005"/>
    <param name="lasamplestep" value="0.005"/>
</node>

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.