yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
PALMSLAM📖
1. Product Introduction
  • 0.Get started
  • 1. Learning route
  • 2. Frequently Questions
  • 3. Control panel introduction
  • 4. Introduction to LiDAR
  • 5. Robot charging and battery considerations
  • 6.Unboxing and reviewing
2. Assembly video
  • Installation Video
3. Basic configuration
  • 0. Get started quickly
  • 1. Write the firmware
  • 2. Virtual machine installation and startup system
  • 3. Expansion board configuration parameters
  • 4. How to choose the alarm level and radar model
  • 5. Connection Agent
4. LiDAR course
  • 0. Enter the same docker terminal
  • 1. Robot information release
  • 2. Robot URDF model
  • 3. Basic distance measurement function
  • 4. SLAM Gmapping
  • 5. SLAM Cartographer
  • 6. APP mapping
5. Linux operating system
  • 1.Introduction to Linux system
  • 2.Ubuntu file system
  • 3.Ubuntu common commands
  • 4.Ubuntu common editors
  • 5.Ubuntu software operation commands
  • 6.Virtual machine installation
  • 7.SSH remote control
  • 8.VNC remote control
  • 9.Transfer files remotely
  • 10.Driver library and communication
  • 11.Static IP and hotspot mode
  • 12.Bind device ID
  • 13.Capacity expansion and resource allocation
  • 14.Update system software sources
  • 15.Set root user password
  • 16.sudo free password
  • 17.Connect to WiFi network
  • 18.View system version
  • 19.Customized service management
  • 20.Back up system image
6. ROS2 Basic Course
  • 1.Introduction to ROS2
  • 2.ROS2 install Humble
  • 3.ROS2 development environment
  • 4.ROS2 workspace
  • 5.ROS2 function package
  • 6.ROS2 node
  • 7.ROS2 topic communication
  • 8.ROS2 service communication
  • 9.ROS2 action communication
  • 10.ROS2 custom interface message
  • 11.ROS2 parameter service case
  • 12.ROS2 meta-function package
  • 13.ROS2 distributed communication
  • 14.ROS2 DDS
  • 15.ROS2 time related API
  • 16.ROS2 common command tools
  • 17.ROS2 rviz2 use
  • 18.ROS2 rqt toolbox
  • 19.ROS2 Launch startup file configuration
  • 20.ROS2 recording and playback tool
  • 21.ROS2 URDF model
  • 22.ROS2 Gazebo simulation platform
  • 23.ROS2 TF2 coordinate transformation
Download
  • System_File
  • VM_File
  • Code
  • Software_Tool
  • Hareware_Info
  • 3D_Model_File
  • Instruction_Manual
  • ROS2_Basic_VM
Download ZIP

Welcome to PALMSLAM repository

4. SLAM Gmapping

Gmapping

Note: The virtual machine needs to be in the same LAN as the car, and the ROS_DOMAIN_ID needs to be consistent. You can check [Expansion Board Parameter Configuration] to set the IP and ROS_DOMAIN_ID on the board.

1. Introduction to Gmapping

  • Gmapping is only applicable to points with less than 1440 points in a single frame of two-dimensional laser points. If the number of laser points in a single frame is greater than 1440, then there will be a problem like [[mapping-4] process has died].
  • Gmapping is a commonly used open source SLAM algorithm based on the filter SLAM framework.
  • Gmapping is based on the RBpf particle filter algorithm, and the real-time positioning and mapping processes are separated. Positioning is performed first and then mapping.
  • Gmapping has made two major improvements on the RBpf algorithm: improved proposal distribution and selective resampling.

Advantages: Gmapping can build indoor maps in real time, and the amount of calculation required to build small scene maps is small and the accuracy is high.

Disadvantages: As the scene increases, the number of particles required increases. Because each particle carries a map, the memory and calculation required to build a large map will increase. Therefore, it is not suitable for building large scene maps. And there is no loop detection, so the map may be misaligned when the loop is closed. Although increasing the number of particles can make the map closed, it comes at the cost of increasing the amount of calculation and memory.

image-20241122164116828

2. Program function description

The car connects to the agent and runs the program. The map building interface will be displayed in rviz. Hold the handheld radar with your hand and keep walking parallel. When your hand shakes, the device will make a beeping sound to remind you. At this time, you should pay attention to whether your arms are parallel until the map is built. Then run the command to save the map.

3. Start and connect to the agent

If you are using the factory virtual machine system, you can enter in the terminal:

sh ~/start_agent_computer.sh

If you use a third-party virtual machine system, you need to install the docker development environment first and open the terminal to enter:

xxxxxxxxxx
sudo docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:humble udp4 --port 8090 -v4

image-20240102115728128

Then, turn on the car switch and wait for the car to connect to the agent. The connection is successful as shown in the figure below.

image-20231218200627187

4. Start the program

4.1 Run the command

If it is the Raspberry Pi desktop version and jetson nano desktop version, you need to enter docker in advance, enter in the terminal,

xxxxxxxxxx
sh ~/ros2_humble.sh

If the following interface appears, you have successfully entered docker, image-20240229171639860

Then enter them in docker respectively, (see [Enter the same docker terminal] section)

ros2 launch yahboomcar_bringup yahboomcar_bringup_launch.py    #underlying data program
ros2 launch rf2o_laser_odometry rf2o_laser_odometry.launch.py
ros2 launch yahboomcar_nav display_launch.py    #start rviz, visualize map
ros2 launch yahboomcar_nav map_gmapping_launch.py    #map node
#save map
ros2 launch yahboomcar_nav save_map_launch.py

Take the matching virtual machine as an example, terminal input,

xxxxxxxxxx
ros2 launch yahboomcar_bringup yahboomcar_bringup_launch.py

First, start the car to process the underlying data program, image-20241122165001621

Then, start the laser odometry and input in the terminal,

xxxxxxxxxx
ros2 launch rf2o_laser_odometry rf2o_laser_odometry.launch.py

image-20241122165139598

Then, start rviz, visualize the map, and input in the terminal,

xxxxxxxxxx
ros2 launch yahboomcar_nav display_launch.py

image-20241122165335940

The map node has not been run yet, so there is no data. Next, run the map node and enter in the terminal,

xxxxxxxxxx
ros2 launch yahboomcar_nav map_gmapping_launch.py

image-20241122165442993

Then hold the handheld radar in parallel with your hands and walk through the area to be mapped normally. After the map is built, enter the following command to save the map and enter in the terminal,

xxxxxxxxxx
ros2 launch yahboomcar_nav save_map_launch.py

image-20241122165703261

A map named yahboom_map will be saved. This map is saved in,

xxxxxxxxxx
/home/yahboom/yahboomcar_ws/src/yahboomcar_nav/maps

Two files will be generated, one is yahboom_map.pgm, the other is yahboom_map.yaml, look at the contents of yaml,

xxxxxxxxxx
image: yahboom_map.pgm
mode: trinary
resolution: 0.05
origin: [-10, -10, 0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.25
  • image: the image representing the map, i.e. yahboom_map.pgm
  • mode: this property can be one of trinary, scale or raw, depending on the selected mode, trinary mode is the default mode
  • resolution: the resolution of the map, meters/pixels
  • origin: the 2D pose (x,y,yaw) of the lower left corner of the map, where yaw is rotated counterclockwise (yaw=0 means no rotation). Currently many parts of the system ignore the yaw value.
  • negate: whether to invert the meaning of white/black and free/occupied (the interpretation of the threshold is not affected)
  • occupied_thresh: pixels with an occupation probability greater than this threshold are considered fully occupied.
  • free_thresh: Pixels with an occupation probability less than this threshold will be considered completely free

The other is a pdf image,

image-20241122165950114

5. View the node communication graph

Terminal input,

xxxxxxxxxx
ros2 run rqt_graph rqt_graph

image-20241122170142076

If it is not displayed at the beginning, select [Nodes/Topics(all)] and click the refresh button in the upper left corner.

6. View the TF tree

Terminal input,

xxxxxxxxxx
ros2 run tf2_tools view_frames

After running, two files will be generated in the terminal directory, namely .gv and .pdf files. The pdf file is the TF tree.

image-20241122170304531

7. Code analysis

Taking the virtual machine as an example, only map_gmapping_launch.py ​​for building the map is explained here. The file path is,

xxxxxxxxxx
/home/yahboom/yahboomcar_ws/src/yahboomcar_nav/launch

map_gmapping_launch.py

from launch import LaunchDescription
from launch_ros.actions import Node
import os
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from ament_index_python.packages import get_package_share_directory
​
​
def generate_launch_description():
    slam_gmapping_launch = IncludeLaunchDescription(
        PythonLaunchDescriptionSource([os.path.join(
        get_package_share_directory('slam_gmapping'), 'launch'),
         '/slam_gmapping.launch.py'])
    )
​
    base_link_to_laser_tf_node = Node(
     package='tf2_ros',
     executable='static_transform_publisher',
     name='base_link_to_base_laser',
     arguments=['-0.0046412', '0' , '0.094079','0','0','0','base_link','laser_frame']
    )
    
    return LaunchDescription([slam_gmapping_launch,base_link_to_laser_tf_node])
​

Here, a launch file - slam_gmapping_launch and a node for publishing static transformation - base_link_to_laser_tf_node are started

Take the virtual machine as an example, and take a closer look at slam_gmapping_launch. The file is located at,

xxxxxxxxxx
/home/yahboom/gmapping_ws/src/slam_gmapping/launch

slam_gmapping.launch.py,

from launch import LaunchDescription
from launch.substitutions import EnvironmentVariable
import launch.actions
import launch_ros.actions
import os
from ament_index_python.packages import get_package_share_directory
​
def generate_launch_description():
    return LaunchDescription([
        launch_ros.actions.Node(
            package='slam_gmapping', 
            executable='slam_gmapping', 
            output='screen', 
            parameters=[os.path.join(get_package_share_directory("slam_gmapping"), "params", "slam_gmapping.yaml")]),
    ])

Here, the slam_gmapping node is started and the slam_gmapping.yaml parameter file is loaded.

Take the matching virtual machine as an example,

xxxxxxxxxx
/home/yahboom/gmapping_ws/src/slam_gmapping/params

slam_gmapping.yaml

xxxxxxxxxx
/slam_gmapping:
  ros__parameters:
    angularUpdate: 0.25
    astep: 0.05
    base_frame: base_footprint
    map_frame: map
    odom_frame: odom
    delta: 0.05
    iterations: 5
    kernelSize: 1
    
    lasamplerange: 0.005
    lasamplestep: 0.005
    linearUpdate: 0.5
    llsamplerange: 0.01
    llsamplestep: 0.01
    
    lsigma: 0.075
    lskip: 0
    lstep: 0.05
    map_update_interval: 3.0
    maxRange: 6.0
    maxUrange: 4.0
    minimum_score: 0.0
    occ_thresh: 0.25
    ogain: 3.0
    particles: 30
    qos_overrides:
      /parameter_events:
        publisher:
          depth: 1000
          durability: volatile
          history: keep_all
          reliability: reliable
      /tf:
        publisher:
          depth: 1000
          durability: volatile
          history: keep_last
          reliability: reliable
    resampleThreshold: 0.5
    sigma: 0.05
    srr: 0.1
    srt: 0.2
    str: 0.1
    stt: 0.2
    temporalUpdate: 1.0
    transform_publish_period: 0.05
    use_sim_time: false
    xmax: 100.0
    xmin: -100.0
    ymax: 100.0
    ymin: -100.0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Basic distance measurement function
SLAM Cartographer

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文