当前位置:网站首页>Interesting practice of robot programming 16 synchronous positioning and map building (SLAM)
Interesting practice of robot programming 16 synchronous positioning and map building (SLAM)
2022-07-05 01:28:00 【zhangrelay】
360 Laser is used to avoid obstacles , How can that be? , It's totally overqualified ……
stay Gazebo In the simulator SLAM when , Various environments and robot models can be selected or created in the virtual world .SLAM Simulation and Practice TurtleBot3 Of SLAM Very similar .
Through the three-dimensional environment of the keyboard remote control and autonomous obstacle avoidance driving , Have fully mastered the basic use of , Next entry SLAM link .
The effect is shown below :

This article does not contain SLAM Algorithm details , Follow up blog updates .
For more cool applications based on maps, please refer to the following :


Start the simulation world
There are three Gazebo Environmental Science , But to use SLAM Create map , It is recommended to use TurtleBot3 World or TurtleBot3 House.
Use one of the following commands to load Gazebo Environmental Science . In this directive , Will use TurtleBot3 World.
Please be there. burger、waffle、waffle_pi In Chinese, it means TURTLEBOT3_MODEL Parameters use the correct keywords .
- world
- $ export TURTLEBOT3_MODEL=burger
$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py - house
- $ export TURTLEBOT3_MODEL=burger
$ ros2 launch turtlebot3_gazebo turtlebot3_house.launch.py
Choose one of the two above .
function SLAM node
Use Ctrl + Alt + T From remote PC Open a new terminal and run SLAM node . By default Cartographer SLAM Method .
- $ export TURTLEBOT3_MODEL=burger
$ ros2 launch turtlebot3_cartographer cartographer.launch.py use_sim_time:=True
Run the autonomous obstacle avoidance node
Use Ctrl + Alt + T From remote PC Open a new terminal , And then from PC function drive node .
- ros2 run turtlebot3_gazebo turtlebot3_drive

Run the remote control operation node
Use Ctrl + Alt + T From remote PC Open a new terminal , And then from the remote PC Run the remote operation node .
- ros2 run turtlebot3_teleop teleop_keyboard
Save the map
After successfully creating the map , Use Ctrl + Alt + T From remote PC Open a new terminal and save the map .
- ros2 run nav2_map_server map_saver_cli -f ~/map


cartographer.launch
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch_ros.actions import Node
from launch.substitutions import LaunchConfiguration
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import ThisLaunchFileDir
def generate_launch_description():
use_sim_time = LaunchConfiguration('use_sim_time', default='false')
turtlebot3_cartographer_prefix = get_package_share_directory('turtlebot3_cartographer')
cartographer_config_dir = LaunchConfiguration('cartographer_config_dir', default=os.path.join(
turtlebot3_cartographer_prefix, 'config'))
configuration_basename = LaunchConfiguration('configuration_basename',
default='turtlebot3_lds_2d.lua')
resolution = LaunchConfiguration('resolution', default='0.05')
publish_period_sec = LaunchConfiguration('publish_period_sec', default='1.0')
rviz_config_dir = os.path.join(get_package_share_directory('turtlebot3_cartographer'),
'rviz', 'tb3_cartographer.rviz')
return LaunchDescription([
DeclareLaunchArgument(
'cartographer_config_dir',
default_value=cartographer_config_dir,
description='Full path to config file to load'),
DeclareLaunchArgument(
'configuration_basename',
default_value=configuration_basename,
description='Name of lua file for cartographer'),
DeclareLaunchArgument(
'use_sim_time',
default_value='false',
description='Use simulation (Gazebo) clock if true'),
Node(
package='cartographer_ros',
executable='cartographer_node',
name='cartographer_node',
output='screen',
parameters=[{'use_sim_time': use_sim_time}],
arguments=['-configuration_directory', cartographer_config_dir,
'-configuration_basename', configuration_basename]),
DeclareLaunchArgument(
'resolution',
default_value=resolution,
description='Resolution of a grid cell in the published occupancy grid'),
DeclareLaunchArgument(
'publish_period_sec',
default_value=publish_period_sec,
description='OccupancyGrid publishing period'),
IncludeLaunchDescription(
PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/occupancy_grid.launch.py']),
launch_arguments={'use_sim_time': use_sim_time, 'resolution': resolution,
'publish_period_sec': publish_period_sec}.items(),
),
Node(
package='rviz2',
executable='rviz2',
name='rviz2',
arguments=['-d', rviz_config_dir],
parameters=[{'use_sim_time': use_sim_time}],
output='screen'),
])
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
The configuration file lua
include "map_builder.lua"
include "trajectory_builder.lua"
options = {
map_builder = MAP_BUILDER,
trajectory_builder = TRAJECTORY_BUILDER,
map_frame = "map",
tracking_frame = "imu_link",
published_frame = "odom",
odom_frame = "odom",
provide_odom_frame = false,
publish_frame_projected_to_2d = true,
use_odometry = true,
use_nav_sat = false,
use_landmarks = false,
num_laser_scans = 1,
num_multi_echo_laser_scans = 0,
num_subdivisions_per_laser_scan = 1,
num_point_clouds = 0,
lookup_transform_timeout_sec = 0.2,
submap_publish_period_sec = 0.3,
pose_publish_period_sec = 5e-3,
trajectory_publish_period_sec = 30e-3,
rangefinder_sampling_ratio = 1.,
odometry_sampling_ratio = 1.,
fixed_frame_pose_sampling_ratio = 1.,
imu_sampling_ratio = 1.,
landmarks_sampling_ratio = 1.,
}
MAP_BUILDER.use_trajectory_builder_2d = true
TRAJECTORY_BUILDER_2D.min_range = 0.12
TRAJECTORY_BUILDER_2D.max_range = 3.5
TRAJECTORY_BUILDER_2D.missing_data_ray_length = 3.
TRAJECTORY_BUILDER_2D.use_imu_data = false
TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true
TRAJECTORY_BUILDER_2D.motion_filter.max_angle_radians = math.rad(0.1)
POSE_GRAPH.constraint_builder.min_score = 0.65
POSE_GRAPH.constraint_builder.global_localization_min_score = 0.7
-- POSE_GRAPH.optimize_every_n_nodes = 0
return options
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
边栏推荐
- Roads and routes -- dfs+topsort+dijkstra+ mapping
- Basic operations of database and table ----- create index
- Global and Chinese market of nutrient analyzer 2022-2028: Research Report on technology, participants, trends, market size and share
- Take you ten days to easily complete the go micro service series (IX. link tracking)
- Nebula importer data import practice
- PHP 基础篇 - PHP 中 DES 加解密详解
- Yyds dry goods inventory [Gan Di's one week summary: the most complete and detailed in the whole network]; detailed explanation of MySQL index data structure and index optimization; remember collectio
- [untitled]
- How to safely eat apples on the edge of a cliff? Deepmind & openai gives the answer of 3D security reinforcement learning
- MySQL REGEXP:正则表达式查询
猜你喜欢

【大型电商项目开发】性能压测-性能监控-堆内存与垃圾回收-39

phpstrom设置函数注释说明

Great God developed the new H5 version of arXiv, saying goodbye to formula typography errors in one step, and mobile phones can also easily read literature
![Pandora IOT development board learning (RT thread) - Experiment 4 buzzer + motor experiment [key external interrupt] (learning notes)](/img/ad/5fbf8c3f71ea204bcd48473c3811f6.png)
Pandora IOT development board learning (RT thread) - Experiment 4 buzzer + motor experiment [key external interrupt] (learning notes)
![[CTF] AWDP summary (WEB)](/img/4c/574742666bd8461c6f9263fd6c5dbb.png)
[CTF] AWDP summary (WEB)

DOM basic syntax

Exploration and Practice of Stream Batch Integration in JD

Analysis and comparison of leetcode weekly race + acwing weekly race (t4/t3)
![[pure tone hearing test] pure tone hearing test system based on MATLAB](/img/1c/62ed6b3eb27a4dff976c4a2700a850.png)
[pure tone hearing test] pure tone hearing test system based on MATLAB

JS implementation determines whether the point is within the polygon range
随机推荐
[Chongqing Guangdong education] National Open University spring 2019 1042 international economic law reference questions
【海浪建模3】三维随机真实海浪建模以及海浪发电机建模matlab仿真
107. Some details of SAP ui5 overflow toolbar container control and resize event processing
POAP:NFT的采用入口?
【微处理器】基于FPGA的微处理器VHDL开发
【LeetCode】88. Merge two ordered arrays
Express routing, express middleware, using express write interface
Main window in QT application
BGP comprehensive experiment
Logstash、Fluentd、Fluent Bit、Vector? How to choose the appropriate open source log collector
Hedhat firewall
Database postragesq PAM authentication
[development of large e-commerce projects] performance pressure test - Optimization - impact of middleware on performance -40
无心剑英译席慕容《无怨的青春》
实战模拟│JWT 登录认证
Is there a sudden failure on the line? How to make emergency diagnosis, troubleshooting and recovery
Global and Chinese markets of emergency rescue vessels (errv) 2022-2028: Research Report on technology, participants, trends, market size and share
Database postragesql client connection default
Take you ten days to easily complete the go micro service series (IX. link tracking)
Database postragesq BSD authentication