平台:ubuntu18.04 + rosmelodic
设备: 速腾16线激光雷达(RS-Helios-16P)、IMU(WHT901B-485),使用方法见前文
1.创建backpack_2d_rs_16urdf文件
(路径:car2_ws/install_isolated/share/cartographer_ros/urdf)
<robot name="cartographer_backpack_2d">
<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="rslidar">
<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="laser_joint" type="fixed">
<parent link="base_link" />
<child link="rslidar" />
<origin xyz="0.1007 0 0.0558" />
</joint>
</robot>
2.创建rs16_3d.lua文件
(路径:car2_ws/src/cartographer_ros/cartographer_ros/configuration_files)
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 = false,
publish_frame_projected_to_2d = false,
use_pose_extrapolator = false,
use_odometry = 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.,
landmarks_sampling_ratio = 1.,
}
TRAJECTORY_BUILDER_3D.num_accumulated_range_data = 1
MAP_BUILDER.use_trajectory_builder_3d = true
MAP_BUILDER.num_background_threads = 7
POSE_GRAPH.optimization_problem.huber_scale = 5e2
POSE_GRAPH.optimize_every_n_nodes = 320
POSE_GRAPH.constraint_builder.sampling_ratio = 0.03
POSE_GRAPH.optimization_problem.ceres_solver_options.max_num_iterations = 10
POSE_GRAPH.constraint_builder.min_score = 0.62
POSE_GRAPH.constraint_builder.global_localization_min_score = 0.66
return options
3.创建cartographer_rs16_3d.launch文件
(路径:car2_ws/src/cartographer_ros/cartographer_ros/launch)
<launch>
<param name="robot_description"
#对应之前的urdf文件
textfile="$(find cartographer_ros)/urdf/backpack_2d_rs_16.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
#对应之前的lua文件
-configuration_basename rs16_3d.lua"
output="screen">
#对应自己的激光点云话题
<remap from="points2" to="/rslidar_points" />
#对应自己的IMU话题
<remap from="imu" to="/wit/imu" />
</node>
<node name="cartographer_occupancy_grid_node" pkg="cartographer_ros"
type="cartographer_occupancy_grid_node" args="-resolution 0.05" />
</launch>
4.创建demo_rs16_3d.launch文件
(路径:car2_ws/src/cartographer_ros/cartographer_ros/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="/use_sim_time" value="false" />
<include file="$(find cartographer_ros)/launch/cartographer_rs16_3d.launch" />
<node name="rviz" pkg="rviz" type="rviz" required="true"
args="-d $(find cartographer_ros)/configuration_files/demo_3d.rviz" />
</launch>
5.编译并运行
catkin_make_isolated --install --use-ninja
source ./devel_isolated/setup.bash
roslaunch cartographer_ros demo_rs16_3d.launch
6.运行 激光雷达和IMU【见 前文】
文章来源:https://www.toymoban.com/news/detail-772359.html
7. 结果:
1.rqt_grapher
文章来源地址https://www.toymoban.com/news/detail-772359.html
到了这里,关于使用速腾16线激光雷达与IMU 实现Cartographer 3D建图的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!