VLP16+IMU+Cartographer+Ubuntu18.04+ROS Melodic使用

Cartographer配置安装

安装工具

sudo apt-get install -y python-wstool ninja-build

创建工作空间

mkdir catkin_ws
cd catkin_ws
wstool init src
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src

rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y

编译安装

catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash

服务器无法连接

ceres-solver失败

gedit catkin_ws/src/.rosinstall

修改

最后一个git:
https://ceres-solver.googlesource.com/ceres-solver.git
改为
https://github.com/ceres-solver/ceres-solver.git

测试

下载数据包
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
测试
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag

使用VLP16-IMU

主要是3个文件VLP16-imu.launch启动文件,VLP16-imu.urdf设置坐标变换,VLP16-imu.lua配置文件

VLP16-imu.launch

<launch>  
  <param name="/use_sim_time" value="false"/>
  <param name="robot_description"
    textfile="$(find cartographer_ros)/urdf/VLP16_imu_cxy.urdf" />

  <node name="robot_state_publisher" pkg="robot_state_publisher"
    type="robot_state_publisher" />

  <node name="cartographer_node" pkg="cartographer_ros"
      type="cartographer_node" args="
          -configuration_directory $(find cartographer_ros)/configuration_files
          -configuration_basename VLP16_imu_cxy.lua"
      output="screen">
      <remap from="/imu" to="/imu/data"/>
    <!--<remap from="echoes" to="horizontal_laser_2d" />-->
  </node>
  <node name="cartographer_occupancy_grid_node" pkg="cartographer_ros"
      type="cartographer_occupancy_grid_node" args="-resolution 0.05" />
</launch>

VLP16-imu.urdf


<robot name="VLP16_imu_cxy">
  <material name="orange">
    <color rgba="1.0 0.5 0.2 1" />
  </material>
  <material name="gray">
    <color rgba="0.2 0.2 0.2 1" />
  </material>
  <link name="imu_link">
    <visual>
      <origin xyz="0 0 0" />
      <geometry>
        <box size="0.06 0.04 0.02" />
      </geometry>
      <material name="orange" />
    </visual>
  </link>
  <link name="velodyne">
    <visual>
      <origin xyz="0 0 0" />
      <geometry>
        <cylinder length="0.05" radius="0.03" />
      </geometry>
      <material name="gray" />
    </visual>
  </link>
  <link name="base_link" />
  <joint name="imu_link_joint" type="fixed">
    <parent link="base_link" />
    <child link="imu_link" />
    <origin xyz="0 0 0" />
  </joint>
  <joint name="horizontal_laser_link_joint" type="fixed">
    <parent link="base_link" />
    <child link="velodyne" />
    <origin xyz="0.1007 0 0.0558" />
  </joint>
</robot>

VLP16-imu.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 = "base_link",
  odom_frame = "odom",
  provide_odom_frame = true,
  publish_frame_projected_to_2d = false,
  use_odometry = false,
  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.num_accumulated_range_data = 10

return options

其中tracking_frame设置为imu的frame id,publilsh_frame设置为base_link(官网上是这么说的,不过有很多设置成laser_link)

num_laser_scans订阅的激光扫描的topic,msg类型为LaserScan

num_multi_echo_laser_scans订阅激光扫描的数量,msg类型为MultiEchoLaserScan

num_point_clouds订阅点云的数量。

官方说明文档https://google-cartographer-ros.readthedocs.io/en/latest/configuration.html

记住每次修改launch和lua文件都需要重新编译!!!!

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值