Rplidar学习—— rplidar使用cartographer_ros进行地图云生成

一、Cartographer简介

  Cartographer是google开源的通用2D和3D定位与地图同步构建的SLAM工具,并提供ROS接口。官网地址:https://github.com/googlecartographer

 

二、安装方法

1、安装全部依赖项

复制代码

sudo apt-get update
sudo apt-get install -y \
cmake \
g++ \
git \
google-mock \
libboost-all-dev \
libeigen3-dev \
libgflags-dev \
libgoogle-glog-dev \
liblua5.2-dev \
libprotobuf-dev \
libsuitesparse-dev \
libwebp-dev \
ninja-build \
protobuf-compiler \
python-sphinx \
ros-kinetic-tf2-eigen \
libatlas-base-dev \
libsuitesparse-dev \
liblapack-dev

复制代码

 

 

2、安装ceres solver,下载安装在主目录下,由于googlesource.com需要FQ,这里使用hitcm(张明明)的github地址

复制代码

# Build and install Ceres.
# git clone https://ceres-solver.googlesource.com/ceres-solver
# cd ceres-solver
git clone https://github.com/hitcm/ceres-solver-1.11.0.git
cd ceres-solver-1.11.0
mkdir build
cd build
cmake .. -G Ninja
ninja
ninja test
sudo ninja install

复制代码

 

 

3、安装cartographer,下载安装在主目录下,这里同样使用的是hitcm(张明明)的github地址

复制代码

# Build and install Cartographer.
git clone https://github.com/hitcm/cartographer.git
cd cartographer
mkdir build
cd build
cmake .. -G Ninja
ninja
ninja test
sudo ninja install

复制代码

 

 

4、安装cartographer_ros,这里使用的是hitcm(张明明)的github地址,由于google官方的教程需要FQ下载一些文件,因此容易失败,经验证hitcm(张明明)对原文件进行了少许修改后可以成功安装,在他的修改中核心代码不变,只修改了编译文件。

复制代码

# Install wstool and rosdep.
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build
# Create a new workspace in 'catkin_ws'.
mkdir catkin_ws
cd catkin_ws
wstool init src
# 下载到catkin_ws下面的src文件夹下面
cd src
git clone https://github.com/hitcm/cartographer_ros.git
# 然后到catkin_ws下面运行catkin_make安装 (会失败,所以根据提示改变命令)
cd
cd catkin_ws
catkin_make
source ./devel/setup.zsh

复制代码

 

 

5、改变命令进行编译

catkin_make_isolated --install --use-ninja

 

 

6、修改cartographer_ros--cartographer_ros--launch--demo_revo_lds.launch

复制代码

    <launch>  
      
      <param name="/use_sim_time" value="true" />  
      <node name="cartographer_node" pkg="cartographer_ros"  
          type="cartographer_node" args="  
              -configuration_directory $(find cartographer_ros)/configuration_files  
              -configuration_basename revo_lds.lua"  
          output="screen">  
        <remap from="scan" to="scan" />  
      </node>  
      <node name="rviz" pkg="rviz" type="rviz" required="true"  
          args="-d $(find cartographer_ros)/configuration_files/demo_2d.rviz" />  
    </launch>

复制代码

 

 

  修改cartographer_ros--cartographer_ros--configuration_files--revo_lds.lua

 

复制代码

options = {

  map_builder = MAP_BUILDER,

  sensor_bridge = {

    horizontal_laser_min_range = 0.3,

    horizontal_laser_max_range = 8,

    horizontal_laser_missing_echo_ray_length = 1.2,

    constant_odometry_translational_variance = 0.,

    constant_odometry_rotational_variance = 0.,

  },

  map_frame = "map",

  tracking_frame = "laser",

  published_frame = "laser",

  odom_frame = "odom",

  provide_odom_frame = true,

  use_odometry_data = false,

  use_constant_odometry_variance = true,

  constant_odometry_translational_variance = 1e-2,

  constant_odometry_rotational_variance = 1e-1,

  use_horizontal_laser = true,

  use_horizontal_multi_echo_laser = false,
  
  horizontal_laser_min_range = 0.1,
  
  horizontal_laser_max_range = 30.,
  
  horizontal_laser_missing_echo_ray_length = 5.,

  num_lasers_3d = 0,

  lookup_transform_timeout_sec = 0.2,

  submap_publish_period_sec = 0.3,

  pose_publish_period_sec = 5e-3,

}

MAP_BUILDER.use_trajectory_builder_2d = true

TRAJECTORY_BUILDER_2D.use_imu_data = false

TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true

SPARSE_POSE_GRAPH.optimization_problem.huber_scale = 1e2

return options

复制代码

 

 

 

 

   修改完以上2个文件重新编译一下,命令行输入

 

catkin_make_isolated --install --use-ninja

 

 

 

 7、运行

  最后命令行中运行rplidar的Node和launch文件

 

roslaunch rplidar_ros rplidar.launch 
roslaunch cartographer_ros demo_revo_lds.launch

 

 

 

 

 

 

 

 

转载:https://www.cnblogs.com/BlueMountain-HaggenDazs/p/6691709.html

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值