接着上一篇博客继续:https://blog.csdn.net/Jinxiaoyu886/article/details/90215630 如果还没有安装cartographer、ceres solver、cartographer和cartographer_ros。 可以把下面这个命令 $ wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall 替换成: wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_turtlebot/master/cartographer_turtlebot.rosinstall 其余的不变 按照之前的走就行了。
运行例子:
Download the example bag.(下载例子) wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/turtlebot/cartographer_turtlebot_demo.bag
Launch the 2D LIDAR demo.(2D雷达DEMO) $ roslaunch cartographer_turtlebot demo_lidar_2d.launch bag_filename:=${HOME}/Downloads/cartographer_turtlebot_demo.bag
Launch the 2D depth camera demo.(2D深度相机DEMO) $ roslaunch cartographer_turtlebot demo_depth_camera_2d.launch bag_filename:=${HOME}/Downloads/cartographer_turtlebot_demo.bag
Launch the 3D depth camera demo.(3D深度相机DEMO) $ roslaunch cartographer_turtlebot demo_depth_camera_3d.launch bag_filename:=${HOME}/Downloads/cartographer_turtlebot_demo.bag
在运行例子时,如果出现
ERROR: cannot launch node of type [cartographer_ros/cartographer_node]: can't locate node [cartographer_node] in package [cartographer_ros] ERROR: cannot launch node of type [cartographer_ros/cartographer_occupancy_grid_node]: can't locate node [cartographer_occupancy_grid_node] in package [cartographer_ros] ERROR: cannot launch node of type [cartographer_turtlebot/cartographer_flat_world_imu_node]: can't locate node [cartographer_flat_world_imu_node] in package [cartographer_turtlebot]类似与上述的错误。 第一、 检查你的包路径是否已经在ROS路径之中,通过vim ~/.bashrc 可以添加修改。 第二、 回到根目录,cd进你的工作空间,输入: $ source devel/setup.bash $ source install_isolated/setup.bash 这两句很重要,如果失败就关闭终端重新来一次,这两句话是要在每次运行前都要输入的。
对于第二个例子,2D深度相机DEMO,在运行时候会出现 ERROR: cannot launch node of type [depthimage_to_laserscan]: can't locate node [depthimage_to_laserscan] in package [depthimage_to_laserscan] 这个错误提示我们是缺少depthimage_to_laserscan包。
在终端输入 $ sudo apt-get install ros-kinetic-depthimage-to-laserscan $ git clone https://github.com/ros-perception/depthimage_to_laserscan 然后在cd进包里,用cmake编译,然后make, sudo make install。 最后在bashrc里添加环境路径。 然后就可以运行了。 祝大家好运!