6. Pure Visual 2D Mapping and Navigation
6. Pure Visual 2D Mapping and Navigation
6. Pure Visual 2D Mapping and Navigation
depthimage_to_laserscan: http://wiki.ros.org/depthimage_to_laserscan
6.1. Introduction
depthimage_to_laserscan takes a depth image (float encoded meters or preferably uint16
encoded millimeters for OpenNI devices) and generates a 2D laser scan based on the provided
parameters. depthimage_to_laserscan uses delayed subscription, which does not subscribe to
image or camera information until a user scans.
The depthimage_to_laserscan function package converts depth images into lidar data, and its
mapping and navigation functions are the same as lidar. Note: The scanning range of the depth
camera is not 360°.
6.2. Use
Note: Pure depth mapping navigation in this section does not work well and is not
recommended.
Note: When building a map, the slower the speed, the better the effect (note that the
rotation speed should be slower). If the speed is too fast, the effect will be poor.
According to different models, you only need to set the purchased model in [.bashrc], X1 (normal
four-wheel drive) X3 (Mailun) Take X3 as an example
#Raspberry Pi 5 master needs to enter docker first, please perform this step
#If running the script into docker fails, please refer to ROS/07, Docker tutorial
~/run_docker.sh
Find the [ROBOT_TYPE] parameters and modify the corresponding car model
<PI5 needs to open another terminal to enter the same docker container
There may be some scattered points during the mapping process. If the mapping environment is
well closed, relatively regular, and the movement is slow, the scattering phenomenon will be much
smaller.
map.yaml
image: map.pgm
resolution: 0.05
origin: [-15.4,-12.2,0.0]
Negate: 0
occupied_thresh: 0.65
free_thresh: 0.196
Parameter analysis:
image: The path of the map file, which can be an absolute path or a relative path.
Origin: 2D pose (x, y, yaw) in the lower left corner of the map. The yaw here is rotated
counterclockwise (yaw=0 means no rotation). Many parts of the current system ignore the
yaw value.
negate: whether to reverse 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 will be
considered fully occupied.
free_thresh: Pixels with occupancy probability less than this threshold will be considered
completely free.
6.2.4. Navigation
<PI5 needs to open another terminal to enter the same docker container
Click [2D Nav Goal] of the [rviz] tool, and then select a target point on the map where there
are no obstacles. Release the mouse to start navigation. Only one target point can be
selected, and it will stop when it is reached.
2. Multi-point navigation
Same as the first step of single-point navigation, first set the initial pose of the car.
Click [Publish Point] of the [rviz] tool, and then select the target point on the map where there
are no obstacles. Release the mouse to start navigation. You can click [Publish Point] again,
and then select the point, and the robot will click on it. Cruising between points.
When using the [2D Pose Estimate] tool of the [rviz] tool to set the initial pose of the car, the
multi-point navigation function is automatically canceled.
Subscription
Type Description
topic
Node view
rqt_graph
6.4. Configuration parameters
Required TF
Description
transformation
Released TF
Description
Transform
View tf tree