Welcome to YDLIDAR TW3 repository
2.Handheld lidar mapping
2. Handheld LiDAR Mapping
It is recommended to use our provided virtual machine, as it may not run due to environment differences.
1. Install dependency libraries. Taking the ros-melodic version as an example, enter the following in the terminal:
xxxxxxxxxxsudo apt install ros-melodic-moveit ros-melodic-moveit-visual-tools ros-melodic-kdl-* ros-melodic-joint-state-publisher-gui ros-melodic-trac-ik liborocos-kdl-dev ros-melodic-teleop-twist-keyboard ros-melodic-moveit-resources ros-melodic-navigation ros-melodic-gmapping ros-melodic-hector-slam ros-melodic-slam-karto ros-melodic-robot-state-publisher ros-melodic-geographic-msgs ros-melodic-libuvc-* ros-melodic-rtabmap-ros libavformat-dev libavcodec-dev libswresample-dev libswscale-dev libavutil-dev libsdl1.2-dev ros-melodic-pointcloud-to-laserscan ros-melodic-mbf-msgs ros-melodic-mbf-costmap-core ros-melodic-costmap-converter ros-melodic-bfl ros-melodic-serial ros-melodic-teleop-twist-joy ros-melodic-laser-proc ros-melodic-rosserial-arduino ros-melodic-rosserial-python ros-melodic-rosserial-server ros-melodic-rosserial-client ros-melodic-rosserial-msgs ros-melodic-amcl ros-melodic-map-server ros-melodic-urdf ros-melodic-xacro ros-melodic-interactive-markers ros-melodic-octomap* ros-melodic-joy* ros-melodic-dwa-local-planner ros-melodic-multirobot-map-merge python-catkin-tools python3-dev python3-catkin-pkg-modules python3-numpy python3-yaml build-essential ros-melodic-imu-tools ros-melodic-cartographer*
2. Starting the Mapping Command
Taking gmapping as an example, enter the following in the terminal:
xxxxxxxxxxroslaunch gmapping_test tw3_gmapping.launch It's normal to see this error message at the beginning of the program, because the TensorFlow conversion failed initially but will be successful later.

The following screen indicates successful operation.

3. Saving the Map
Taking gmapping as an example, the command to save the map is:
xxxxxxxxxxrosrun map_server map_saver -f ~/ydlidar_ws/src/gmapping_test/maps/test_map

The map will be saved to the folder /home/yahboom/ydlidar_ws/src/gmapping_test/maps/, consisting of a PGM image and a YAML file.
test_map.yaml
xxxxxxxxxximage/home/yahboom/ydlidar_ws/src/gmapping_test/maps/test_map.pgmresolution0.050000origin-20.000000 -20.000000 0.000000negate0occupied_thresh0.65free_thresh0.196Parameter Explanation:
image: Path to the map file, can be an absolute or relative path.
resolution: Map resolution, meters per pixel.
origin: 2D pose (x, y, yaw) of the bottom left corner of the map. Here, yaw represents a counter-clockwise rotation (yaw=0 indicates no rotation). Many parts of the current system ignore the yaw value.
negate: Whether to invert the meaning of white/black and free/occupied (the interpretation of the threshold is unaffected).
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 are considered completely free.
4. Algorithm information reference website
4.1. Graphing algorithm
Gmapping: http://wiki.ros.org/gmapping/
hector_slam: http://wiki.ros.org/hector_slam
hector_slam/Tutorials: http://wiki.ros.org/hector_slam/Tutorials/SettingUpForYourRobot
hector_mapping: http://wiki.ros.org/hector_mapping
karto: http://wiki.ros.org/slam_karto
Cartographer: https://google-cartographer.readthedocs.io/en/latest/
Cartographer ROS: https://google-cartographer-ros.readthedocs.io/en/latest/
4.2 Autonomous Mapping and Navigation
rrt_exploration: http://wiki.ros.org/rrt_exploration
rrt_exploration/Tutorials: http://wiki.ros.org/rrt_exploration/Tutorials
4.3 Saving Maps
map_server: https://wiki.ros.org/map_server