我是靠谱客的博主 苗条寒风,最近开发中收集的这篇文章主要介绍【ros】rplidar Hector Slam,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

  想用rplidar跑一下hector slam,在网上发现了几个教程写的都不错,但是亲测发现都有点不足,综合了一下,进行补充。

 

1. 安装ros 和 创建工作空间

http://blog.csdn.net/u013453604/article/details/49386953

2. rplidar  :

https://hollyqood.wordpress.com/2015/12/01/ros-slam-2-hector-slam-2d%E5%9C%B0%E5%9C%96%E5%BB%BA%E7%BD%AE/

cd ~/catkin_ws/src
git clone https://github.com/robopeak/rplidar_ros.git 

cd ~/catkin_ws
catkin_make --pkg rplidar_ros

插上rplidar,看看在哪个usb口

ls /dev/ttyUSB*

更改usb权限

sudo chmod 666 /dev/ttyUSB0

看看rplidar 能否正常工作

cd catkin_ws
souce devel/setup.bash
roslaunch rplidar_ros view_rplidar.launch
//开启另一个终端
cd catkin_ws
souce devel/setup.bash
roslaunch rplidar_ros rplidar.launch

3. hector slam

cd ~/catkin_ws/src
git clone https://github.com/tu-darmstadt-ros-pkg/hector_slam
cd ~/catkin_ws
catkin_make

4. 测试  这步很重要啊,launch文件http://www.aichengxu.com/view/9857089

 

catkin_ws/rplidar_ros_master/launch/目录下添加hector_mapping_demo.launch文件,内容如下:

<launch>
<node pkg "hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">
<!-- Frame names -->
<param name="pub_map_odom_transform" value="true"/>
<param name="map_frame" value="map" />
<param name="base_frame" value="base_link" />
<param name="odom_frame" value="base_link" />
<!-- Tf use -->
<param name="use_tf_scan_transformation" value="true"/>
<param name="use_tf_pose_start_estimate" value="false"/>
<!-- Map size / start point -->
<param name="map_resolution" value="0.05"/>
<param name="map_size" value="2048"/>
<param name="map_start_x" value="0.5"/>
<param name="map_start_y" value="0.5" />
<param name="laser_z_min_value" value = "-1.0" />
<param name="laser_z_max_value" value = "1.0" />
<param name="map_multi_res_levels" value="2" />
<param name="map_pub_period" value="2" />
<param name="laser_min_dist" value="0.4" />
<param name="laser_max_dist" value="5.5" />
<param name="output_timing" value="false" />
<param name="pub_map_scanmatch_transform" value="true" />
<!--<param name="tf_map_scanmatch_transform_frame_name" value="scanmatcher_frame" />-->
<!-- Map update parameters -->
<param name="update_factor_free" value="0.4"/>
<param name="update_factor_occupied" value="0.7" />
<param name="map_update_distance_thresh" value="0.2"/>
<param name="map_update_angle_thresh" value="0.06" />
<!-- Advertising config -->
<param name="advertise_map_service" value="true"/>
<param name="scan_subscriber_queue_size" value="5"/>
<param name="scan_topic" value="scan"/>
</node>
<node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster" args="0 0 0 0 0 0 /base_link /laser 100"/>
<node pkg="rviz" type="rviz" name="rviz"
args="-d $(find hector_slam_launch)/rviz_cfg/mapping_demo.rviz"/>
</launch>
View Code

 

//运行下面两个launch

roslaunch rplidar_ros hector_mapping_demo.launch roslaunch rplidar_ros rplidar.launch

拿着rplidar走走 就能看到 图出来了!

 

 

刚开启ros时候, 如果报错:roslaunch 不是命令,

$ cd catkin_ws

$ source devel/setup.bash

转载于:https://www.cnblogs.com/xy123001/p/6009352.html

最后

以上就是苗条寒风为你收集整理的【ros】rplidar Hector Slam的全部内容,希望文章能够帮你解决【ros】rplidar Hector Slam所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(36)

评论列表共有 0 条评论

立即
投稿
返回
顶部