完美安装Ubuntu18.04+melodic+gmapping(解决Invoking “make -j4 -l4“ failed等错误)

本人在安装gmapping时,使用了网上各种教程,之后在catkin_make时出现了各种bug,包括Invoking “make -j4 -l4” failed,‘tf2_ros::TransformListener::TransformListener(tf2::BufferCore&, ros::NodeHandle const&, bool)’未定义,ERROR: cannot launch node of type [gmapping/slam_gmapping]: Can’t locate node of type [slam_gmapping] in package [gmapping].最后发现是使用git下载时导致的版本问题。。。。。。。

安装依赖libsdl1.2-dev 、 libsdl-image1.2-dev
sudo apt-get install libsdl1.2-dev
sudo apt install libsdl-image1.2-dev
如果之前没有创建环境,需要创建环境
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
 catkin_init_workspace

下载对应版本的安装包(关键!!!!)
git clone -b melodic-devel https://github.com/ros-perception/openslam_gmapping.git
git clone -b melodic-devel https://github.com/ros-perception/slam_gmapping.git
git clone -b melodic-devel https://github.com/ros-planning/navigation.git
git clone -b melodic-devel https://github.com/ros/geometry2.git
git clone -b ros1 https://github.com/ros-planning/navigation_msgs.git
进行编译
catkin_make
如果安装了别的包可能会报错,可以使用catkin_make_isolate

运行尝试

测试数据下载链接(关注博主即可下载):https://download.csdn.net/download/weixin_43398590/16082608

roscore // 打开ros
rosparam set use_sim_time true			//配置 ROS 启用重放数据中的时间而非本机时间,影响整个系统所有时间 API 的输出结果。在默认情况下,ROS 使用 ubuntu 系统的时间,也就是墙上时钟时间(wall clock)。但我们重播一个记录历史文件时,里面记录的是历史时间,所以我们需要告诉ROS从现在起开始启用模拟时间。(如果不输入这句话会出现很多警告)
rosrun gmapping slam_gmapping scan:=base_scan		//启动 gmapping, 并监听 scan_base topic 发来的消息。该 topic 是由模拟器发布的。
rosrun rviz rviz		//			启动 RViz(如果不需要可视化,可以跳过)
rosbag play XXX.bag	//		运行数据集
  • 5
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值