|
@@ -22,6 +22,8 @@ Cartographer是Google开源的一个可跨多个平台和传感器配置以2D和
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
## 2.Carttographer安装
|
|
|
|
|
|
### 2.1 apt安装
|
|
@@ -74,13 +76,13 @@ colcon build --packages-up-to cartographer_ros
|
|
|
|
|
|
如果是源码编译请先source下工作空间后再使用下面指令查看是否安装成功;
|
|
|
|
|
|
-```
|
|
|
+```shell
|
|
|
ros2 pkg list | grep cartographer
|
|
|
```
|
|
|
|
|
|
能看到下面的结果即可
|
|
|
|
|
|
-```
|
|
|
+```shell
|
|
|
cartographer_ros
|
|
|
cartographer_ros_msgs
|
|
|
```
|
|
@@ -95,15 +97,17 @@ cartographer_ros_msgs
|
|
|
|
|
|
Cartographer参数是使用lua文件来描述的,不会lua也没关系,我们只是改改参数而已。
|
|
|
|
|
|
-3.1 轨迹构建参数
|
|
|
+> 小鱼提示:lua中的注释采用 -- 开头
|
|
|
|
|
|
-**文件:trajectory_builder_2d**
|
|
|
+### 3.1 前端参数
|
|
|
+
|
|
|
+**文件:trajectory_builder_2d**
|
|
|
|
|
|
`src/cartographer_core/cartographer/configuration_files/trajectory_builder_2d.lua`
|
|
|
|
|
|
请你打开这个文件自行浏览,小鱼对其中我们可能会在初次建图配置的参数进行介绍。
|
|
|
|
|
|
-```
|
|
|
+```lua
|
|
|
-- 是否使用IMU数据
|
|
|
use_imu_data = true,
|
|
|
-- 深度数据最小范围
|
|
@@ -112,17 +116,105 @@ Cartographer参数是使用lua文件来描述的,不会lua也没关系,我
|
|
|
max_range = 30.,
|
|
|
-- 传感器数据超出有效范围最大值时,按此值来处理
|
|
|
missing_data_ray_length = 5.,
|
|
|
-
|
|
|
+ -- 是否使用实时回环检测来进行前端的扫描匹配
|
|
|
+ use_online_correlative_scan_matching = true
|
|
|
+ -- 运动过滤,检测运动变化,避免机器人静止时插入数据
|
|
|
+ motion_filter.max_angle_radians
|
|
|
+```
|
|
|
+
|
|
|
+### 3.2 后端参数
|
|
|
+
|
|
|
+**文件:pose_graph.lua**-后端参数配置项
|
|
|
+
|
|
|
+路径`src/cartographer_core/cartographer/configuration_files/pose_graph.lua`
|
|
|
+
|
|
|
+该文件主要和地图构建
|
|
|
+
|
|
|
+```lua
|
|
|
+--Fast csm的最低分数,高于此分数才进行优化。
|
|
|
+constraint_builder.min_score = 0.65
|
|
|
+--全局定位最小分数,低于此分数则认为目前全局定位不准确
|
|
|
+constraint_builder.global_localization_min_score = 0.7
|
|
|
+```
|
|
|
+
|
|
|
+### 3.3 Carotgrapher_ROS参数配置
|
|
|
+
|
|
|
+该部分参数主要是用于和ROS2进行通信和数据收发的配置,比如配置从哪个话题读取里程记数据,从哪个话题来获取深度信息(雷达)。
|
|
|
+
|
|
|
+**文件:backpack_2d.lua**
|
|
|
+
|
|
|
+路径:`src/cartographer_core/cartographer_ros/cartographer_ros/configuration_files/backpack_2d.lua`
|
|
|
+
|
|
|
+```lua
|
|
|
+include "map_builder.lua"
|
|
|
+include "trajectory_builder.lua"
|
|
|
+
|
|
|
+options = {
|
|
|
+ map_builder = MAP_BUILDER,
|
|
|
+ trajectory_builder = TRAJECTORY_BUILDER,
|
|
|
+ -- 用来发布子地图的ROS坐标系ID,位姿的父坐标系,通常是map。
|
|
|
+ map_frame = "map",
|
|
|
+ -- SLAM算法跟随的坐标系ID
|
|
|
+ tracking_frame = "base_link",
|
|
|
+ -- 将发布map到published_frame之间的tf
|
|
|
+ published_frame = "base_link",
|
|
|
+ -- 位于“published_frame ”和“map_frame”之间,用来发布本地SLAM结果(非闭环),通常是“odom”
|
|
|
+ odom_frame = "odom",
|
|
|
+ -- 是否提供里程计
|
|
|
+ provide_odom_frame = true,
|
|
|
+ -- 只发布二维位姿态(不包含俯仰角)
|
|
|
+ publish_frame_projected_to_2d = false,
|
|
|
+ -- 是否使用里程计数据
|
|
|
+ use_odometry = false,
|
|
|
+ -- 是否使用GPS定位
|
|
|
+ use_nav_sat = false,
|
|
|
+ -- 是否使用路标
|
|
|
+ use_landmarks = false,
|
|
|
+ -- 订阅的laser scan topics的个数
|
|
|
+ num_laser_scans = 0,
|
|
|
+ -- 订阅多回波技术laser scan topics的个数
|
|
|
+ num_multi_echo_laser_scans = 1,
|
|
|
+ -- 分割雷达数据的个数
|
|
|
+ num_subdivisions_per_laser_scan = 10,
|
|
|
+ -- 订阅的点云topics的个数
|
|
|
+ num_point_clouds = 0,
|
|
|
+ -- 使用tf2查找变换的超时秒数
|
|
|
+ lookup_transform_timeout_sec = 0.2,
|
|
|
+ -- 发布submap的周期间隔
|
|
|
+ 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.,
|
|
|
+ -- 固定的frame位姿采样率
|
|
|
+ fixed_frame_pose_sampling_ratio = 1.,
|
|
|
+ -- IMU数据采样率
|
|
|
+ imu_sampling_ratio = 1.,
|
|
|
+ -- 路标采样率
|
|
|
+ landmarks_sampling_ratio = 1.,
|
|
|
+}
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 4.总结
|
|
|
|
|
|
-本节我们简单的介绍了Cartographer以及二进制和源码安装的方法,下一节我们就开始为fishbot配置cartographer,接着就可以使用fishbot进行建图了。
|
|
|
+本节我们简单的介绍了Cartographer以及二进制和源码安装的方法,并对参数进行介绍。
|
|
|
|
|
|
+下一节我们就开始为fishbot配置cartographer,接着就可以使用fishbot进行建图了。
|
|
|
|
|
|
|
|
|
+
|
|
|
+参考文章:
|
|
|
+
|
|
|
+- https://google-cartographer.readthedocs.io/en/latest/configuration.html
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
--------------
|
|
|
|
|
|
技术交流&&问题求助:
|