cartographer 3d 初试,运行速腾聚创data

不黑不吹,这个文章不错
谷歌cartographer使用速腾聚创3d激光雷达数据进行三维建图

结合文章,先上图
在这里插入图片描述
再上数据
链接: https://pan.baidu.com/s/17P_NhPinVU6zlNG5p01PZw 提取码: 63gv

再上配置文件urdf

<!--
  Copyright 2016 The Cartographer Authors

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<robot name="cartographer_backpack_3d">
  <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">
    <visual>
      <origin xyz="0.0 0.0 0.0" />
      <geometry>
        <box size="0.06 0.04 0.02" />
      </geometry>
      <material name="orange" />
    </visual>
  </link>

  <link name="rslidar">
    <visual>
      <origin xyz="0.0 0.0 0.0" />
      <geometry>
        <cylinder length="0.07" radius="0.05" />
      </geometry>
      <material name="gray" />
    </visual>
  </link>

  <link name="vertical_vlp16_link">
    <visual>
      <origin xyz="0.0 0.0 0.0" />
      <geometry>
        <cylinder length="0.07" radius="0.05" />
      </geometry>
      <material name="gray" />
    </visual>
  </link>

  <link name="base_link" />

  <joint name="imu_joint" type="fixed">
    <parent link="base_link" />
    <child link="imu" />
    <origin xyz="0 0 0" rpy="0 0 0" />
  </joint>

  <joint name="rslidar_joint" type="fixed">
    <parent link="base_link" />
    <child link="rslidar" />
    <origin xyz="-0.25 0 0.4" rpy="0. 0 0" />
  </joint>

  <joint name="vertical_vlp16_link_joint" type="fixed">
    <parent link="base_link" />
    <child link="vertical_vlp16_link" />
    <origin xyz="0.19 0. 0.04" rpy="0. 1.3963 0." />
  </joint>
</robot>

再上launch文件

<!--
  Copyright 2016 The Cartographer Authors

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<launch>

  <arg name="bag_filename" default="/home/your_name/Downloads/ros_bag/Bluewhale/2018-08-11-13-20-34.bag" />
 
  <param name="/use_sim_time" value="true" />

  <include file="$(find cartographer_ros)/launch/backpack_3d.launch" />

  <node name="rviz" pkg="rviz" type="rviz" required="true"
      args="-d $(find cartographer_ros)/configuration_files/demo_3d.rviz" />
  <node name="playbag" pkg="rosbag" type="play"
      args="-r 3 --clock $(arg bag_filename)" />
</launch>

再上backpack_3d.launch文件

<!--
  Copyright 2016 The Cartographer Authors

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<launch>
  <param name="robot_description"
    textfile="$(find cartographer_ros)/urdf/backpack_3d_peak_bluewhale.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 backpack_3d_peak.lua"
      output="screen">
    <!-- remap from="points2" to="points_raw" /-->
    <!-- remap from="imu" to="imu_correct" /-->

    <!-- remap from="points2" to="horizontal_laser_3d" /-->
    <!-- remap from="points2_2" to="vertical_laser_3d" /-->

    <!-- remap from="points2" to="kitti/velo/pointcloud" /-->
    <!-- remap from="imu" to="kitti/oxts/imu" /-->

    <!-- remap from="points2" to="rslidar_points" /-->
    <!-- remap from="imu" to="imu_data" /-->

    <remap from="points2" to="rslidar_points" />
    <remap from="imu" to="xqserial_server/IMU" />
  </node>

  <node name="cartographer_occupancy_grid_node" pkg="cartographer_ros"
      type="cartographer_occupancy_grid_node" args="-resolution 0.05" />
</launch>

再上配置文件lua,这个很重要,影响到是否能建好图

-- Copyright 2016 The Cartographer Authors
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
--      http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.

include "map_builder.lua"
include "trajectory_builder.lua"

options = {
  map_builder = MAP_BUILDER,
  trajectory_builder = TRAJECTORY_BUILDER,
  map_frame = "map",
  tracking_frame = "base_link",
  published_frame = "base_link",
  odom_frame = "odom",
  provide_odom_frame = true,
  publish_frame_projected_to_2d = false,
  use_pose_extrapolator = true,
  use_odometry = true, --false
  use_nav_sat = false,
  use_landmarks = false,
  num_laser_scans = 0,
  num_multi_echo_laser_scans = 0,
  num_subdivisions_per_laser_scan = 1,
  num_point_clouds = 1,
  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., --1.
  landmarks_sampling_ratio = 1.,
}

TRAJECTORY_BUILDER_3D.num_accumulated_range_data = 1 --160
TRAJECTORY_BUILDER_3D.min_range = 0.2
TRAJECTORY_BUILDER_3D.max_range = 20.
TRAJECTORY_BUILDER_2D.min_z = 0.1
TRAJECTORY_BUILDER_2D.max_z = 1.0
TRAJECTORY_BUILDER_3D.use_online_correlative_scan_matching = false

MAP_BUILDER.use_trajectory_builder_3d = true
MAP_BUILDER.num_background_threads = 4 --7
POSE_GRAPH.optimization_problem.huber_scale = 5e2
POSE_GRAPH.optimize_every_n_nodes = 40 --320
POSE_GRAPH.constraint_builder.sampling_ratio = 0.03
POSE_GRAPH.optimization_problem.ceres_solver_options.max_num_iterations = 20 --10
POSE_GRAPH.constraint_builder.min_score = 0.5 --0.62
POSE_GRAPH.constraint_builder.global_localization_min_score = 0.55 -0.66
POSE_GRAPH.optimization_problem.use_online_imu_extrinsics_in_3d = true

return options

最后运行第一个launch文件就可以了,要在launch文件中配置好你的urdf、lua文件,可以啦

  • 1
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
【资源说明】 基于单线激光雷达SLAM建图与路径规划c++实现源码+项目说明(SLAM建图、定位、路径规划).zip 单线激光雷达SLAM建图与路径规划 使用的硬件:autolabor pro1小车、小觅双目相机(S1030标准版本)、IntelNUC迷你主机、显示器、2D激光雷达 Delta-1A 使用的软件:ubuntu 16.04 LTS、ROS-kinetic、小觅驱动、autolabor pro1小车驱动、Delta-1A驱动、VINS-Fusion算法、ROS-navigation导航包、gmapping建图算法、cartographer_ros建图算法 ## tf介绍 tf变换:map(地图坐标系)-->odom(里程计坐标系)——>base_link(小车基座坐标系)——>传感器坐标系(lidar、camera) ---- map-->odom 由建图算法提供 ---- odom --> base_link 由小车驱动提供 ---- base_link --> 传感器坐标系 根据传感器在小车上安装的位置确定,使用static_transform_publisher静态坐标转换来设置 所需传感器数据类型: sensor_msgs/LaserScan 使用Delta-1A驱动发布的雷达扫描话题,话题名:/scan 所需里程计信息数据类型:nav_msgs/Odometry 使用autolabor pro1发布的里程计,话题名:/wheel_odom ## 建图 采用gmapping与 cartographer_ros建图算法分别进行建图 ### gmapping建图:(雷达+小车) 打开终端,执行如下指令: $ cd ~/catkin_ws_lidar_slam/ $ source devel/setup.bash $ roslaunch autolabor_box_launch create_map_gmapping.launch ####打开小车urdf模型、驱动、键盘控制节点、打开雷达驱动、打开gmapping节点、打开rviz可视化节点 ####此时使用键盘的上下左右键控制小车移动,开始建图 ####建图完成后,开启新的终端执行如下指令,保存地图: $ rosrun map_server map_saver -f map_name ####保存地图 map_name为保存地图的名称,运行结果,会生成2个文件,后缀名分别为 .pgm .yaml ### cartographer_ros建图:(雷达+小车) ##打开终端,执行如下指令: $ cd ~/catkin_ws_lidar_slam/ $ source devel/setup.bash $ roslaunch autolabor_box_launch create_map_cartographer.launch ####此时使用键盘的上下左右键控制小车移动,开始建图 ####建图完成后,开启新的终端执行如下指令,保存地图: $ rosrun map_server map_saver -f map_name ### cartographer_ros建图:(雷达+小车+IMU) $ cd ~/catkin_ws_lidar_slam/ $ roslaunch autolabor_box_launch create_map_cartographer_imu.launch ####此时使用键盘的上下左右键控制小车移动,开始建图 ####建图完成后,开启新的终端执行如下指令,保存地图: $ rosrun map_server map_saver -f map_name ## 定位与路径规划 分别使用gmapping建图算法与cartographer_ros建图算法建立的地图进行定位与路径规划 ### gmapping算法建立的地图进行定位与路径规划 打开终端,执行如下指令: $ cd ~/catkin_ws_lidar_slam/ $ source devel/setup.bash $ roslaunc 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载使用,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可直接用于毕设、课设、作业等。 欢迎下载,沟通交流,互相学习,共同进步!

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

可峰科技

生活不易

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值