用rplidar测cartographer开源算法

一、安装cartographer

参照大神hitcm的记录安装:https://www.cnblogs.com/hitcm/p/5939507.html

1、首先安装ceres solver,选择的版本是1.11,路径随意;

2、然后安装 cartographer,路径随意;

(1)      git clone https://github.com/hitcm/cartographer.git

(2)   cd cartographer/build

(3)   cmake  ..

(4)   make

(5)   sudo make install

注:cmake .. -G Ninja 可能编译不过。

3、安装cartographer_ros。

扫描二维码关注公众号,回复: 4118451 查看本文章

4、数据下载测试————》都没问题,可以看到建图的过程。

二、用自己的底盘进行建图

                底盘附带 lidar和odometry

1、主要涉及两个文件的修改

(1)cartographer_ros/cartographer_ros/launch/demo_revo_lds.launch

——》去掉node “Rviz” 和“playbag”

(2)cartographer_ros/cartographer_ros/configuration_files/revo_lds.lua

——》主要涉及参数的修改,一开始不明白这两个参数到底表示什么,就不同下面四种组合,通过rviz的测试结果来判断,

从结果看,B、D是ok的,A和C是会发生TF转换的错误。如图所示,没有base_link

                                    

可以通过rosrun rqt_tf_tree rqt_tf_tree来查看tree关系。 而参数provide_odom_frame 为false的话,tree也会有错误。

A、  tracking_frame = "base_link",
        published_frame = "laser",

        provide_odom_frame = true,
 

B、  tracking_frame = "laser",
        published_frame = "base_link",

        provide_odom_frame = true,
 

C、  tracking_frame = "laser",
        published_frame = "laser",

        provide_odom_frame = true,
 

D、  tracking_frame = "base_link",
        published_frame = "base_link",

        provide_odom_frame = true,


(3) 其他参数需要再继续了解。

三、雷达lidar,里程计,cartographer_node的launch文件要分开运行。刚开始时把几个launch文件合并在一个launch文件中,总是无法正常运行:

(1)roslaunch robot lidar.launch

(2)roslaunch robot_base robot_odom_encoder.launch

(3)roslaunch cartographer_ros demo_revo_lds.launch

最后运行rosrun teleop_twist_keyboard teleop_twist_keyboard.py,控制底盘运动。

四、初步结果:

猜你喜欢

转载自blog.csdn.net/qq_29230261/article/details/84101758