使用自己的激光雷达在cartographer导航框架下绘制地图,报错 lua_parameter_dictionary.cc:83] Check failed: status == 0解决方法。

原创,转载请标注。
在这个方面网上有很多资料,我基本上都试了一遍,但是始终会有问题,我不知道相关博主是怎么成功的,同时也发现有很多志同道合的人也和我遇到了同样的问题,下面进入正题吧。
1.安装cartographer,可参考我上一篇博文,也可以参考其他大神博文,都大同小异。
2.你要有自己激光雷达的相关数据包,我是使用的杉川公司的lidar delta 2b 激光雷达,价格便宜,售后和技术是在不敢恭维。
后期上传我的数据包。
3.修改cartographer下的文件,
3.1 修改catkin_ctg/src/cartographer_ros/cartographer_ros/configuration_files/revo_lds.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 = "horizontal_laser_link",
  published_frame = "horizontal_laser_link",
  odom_frame = "odom",
  provide_odom_frame = true,
  publish_frame_projected_to_2d = false,
  use_pose_extrapolator = true,
  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.submaps.num_range_data = 35
TRAJECTORY_BUILDER_2D.min_range = 0.3
TRAJECTORY_BUILDER_2D.max_range = 8.
TRAJECTORY_BUILDER_2D.missing_data_ray_length = 1.
TRAJECTORY_BUILDER_2D.use_imu_data = false
TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.linear_search_window = 0.1
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.translation_delta_cost_weight = 10.
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.rotation_delta_cost_weight = 1e-1

POSE_GRAPH.optimization_problem.huber_scale = 1e2
POSE_GRAPH.optimize_every_n_nodes = 35
POSE_GRAPH.constraint_builder.min_score = 0.65

return options

修改

  tracking_frame = "horizontal_laser_link",
  published_frame = "horizontal_laser_link",

里面的"horizontal_laser_link",改成你自己激光雷达的frame_id,我的是laser,一般都是laser。
其余的不要动,我按照其他人的改了之后 报错,其他人修改的程序如下:

include "map_builder.lua"
 
options = {  map_builder = MAP_BUILDER,
 
 map_frame = "map",
 
tracking_frame = "base_link",
 
published_frame = "base_link",
 
odom_frame = "odom",
 
provide_odom_frame = true,
 
use_odometry_data = false,

use_constant_odometry_variance = false,

constant_odometry_translational_variance = 0.,

constant_odometry_rotational_variance = 0.,
 
use_horizontal_laser = true,
 
use_horizontal_multi_echo_laser = false,

  horizontal_laser_min_range = 0.3,
  horizontal_laser_max_range = 8.,
  horizontal_laser_missing_echo_ray_length = 0.,

 
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

报错如下:

[ INFO] [1551876266.064116311]: I0306 20:44:26.000000  1039 configuration_file_resolver.cc:41] Found '/home/zyh/catkin_ctg/install_isolated/share/cartographer_ros/configuration_files/revo_lds.lua' for 'revo_lds.lua'.
F0306 20:44:26.064491  1039 lua_parameter_dictionary.cc:83] Check failed: status == 0 (3 vs. 0) [string "include "map_builder.lua"..."]:2: unexpected symbol near char(194)
[FATAL] [1551876266.064849343]: F0306 20:44:26.000000  1039 lua_parameter_dictionary.cc:83] Check failed: status == 0 (3 vs. 0) [string "include "map_builder.lua"..."]:2: unexpected symbol near char(194)
*** Check failure stack trace: ***
    @     0x7fa2a70df46d  google::LogMessage::Fail()
    @     0x7fa2a70e1a23  google::LogMessage::SendToLog()
    @     0x7fa2a70deffb  google::LogMessage::Flush()
    @     0x7fa2a70e096e  google::LogMessageFatal::~LogMessageFatal()
    @           0x6215c9  cartographer::common::(anonymous namespace)::CheckForLuaErrors()
    @           0x621dad  cartographer::common::LuaParameterDictionary::LuaParameterDictionary()
    @           0x6220cd  cartographer::common::LuaParameterDictionary::LuaParameterDictionary()
    @           0x5c26d1  cartographer_ros::LoadOptions()
    @           0x59083b  cartographer_ros::(anonymous namespace)::Run()
    @           0x58dfa4  main
    @     0x7fa2a2f96830  __libc_start_main
    @           0x590559  _start
[cartographer_node-2] process has died [pid 1039, exit code -6, cmd /home/zyh/catkin_ctg/install_isolated/lib/cartographer_ros/cartographer_node -configuration_directory /home/zyh/catkin_ctg/install_isolated/share/cartographer_ros/configuration_files -configuration_basename revo_lds.lua scan:=scan __name:=cartographer_node __log:=/home/zyh/.ros/log/91b1ffc0-400d-11e9-9569-00e04c982253/cartographer_node-2.log].
log file: /home/zyh/.ros/log/91b1ffc0-400d-11e9-9569-00e04c982253/cartographer_node-2*.log

根据报错信息可以看出是在lua这个文件里面 map_builder 没有给相关数值定义。
4.修改catkin_ctg/src/cartographer_ros/cartographer_ros/launch/demo_revo_lds.launch文件。
修改代码如下:




  

  
    
  

  " 

修改完之后,回到catkin_ctg目录下面编译

catkin_make_isolated --install --use-ninja

5.运行
先运行激光雷达节点,当然,先要给端口权限
先查看一下端口

ls -l /dev/ttyUSB*

显示相应端口,如:

crw-rw---- 1 root dialout 188, 0 3月   6 19:22 /dev/ttyUSB0

我这里是USB0,给USB0权限

sudo chmod 666 /dev/ttyUSB0

然后运行激光雷达节点launch文件

roslaunch delta_2b_lidar delta_2b_lidar.launch

运行cartographer框架

roslaunch cartographer_ros demo_revo_lds.launch

正常打开rviz,并且显示正常,如下
使用自己的激光雷达在cartographer导航框架下绘制地图,报错 lua_parameter_dictionary.cc:83] Check failed: status == 0解决方法。_第1张图片
结束!

你可能感兴趣的:(ROS)