利用SICK-TIM561-2050101激光雷达在ROS下做SLAM - Something TO DO

利用SICK-TIM561-2050101激光雷达在ROS下做SLAM

Something TO DO posted @ 2017年11月15日 08:24 in SLAM with tags slam sick tim561-2050101 , 7816 阅读

前面提醒:单位刚购买了仙知机器人的AGV,由于想单独使用激光雷达,又不想拆解机器人,所以采用网线与激光雷达通信。

下面开始正文

 

版本说明:

系统:Ubuntu16.04

ROS:kinetic

激光雷达:Sick TIM561-2050101

条件:

  1. 已经安装配置好ROS系统
  2. 创建好的工作空间

 

需要安装的包:

  1. hector_slam (http://wiki.ros.org/hector_slam)

命令(其他版本ROS只需要更改kinetic为其他版本即可):

Sudo apt-get install ros-kinetic-hector-slam

 

    2. 激光雷达ros驱动sick_tim

命令:

cd ~/catkin_ws/src

git clone https://github.com/uos/sick_tim.git

cd ~/catkin_ws/

catkin_make

 

激光雷达ros驱动说明:下载后的launch文件夹中有几个型号的雷达ros驱动,他们分别适配的激光雷达在wiki(http://wiki.ros.org/sick_tim)中有说明,可以在wiki中的2 supported scanner types中查阅,本文采用Sick TIM561-2050101,是和sick_tim551_2050001的ros驱动适配的,所以本文采用该驱动。

SLAM:

    1. 连接方式:默认采用USB连接,无需进行修改,我要采用网线连接,所以需要对sick_tim551_2050001.launch文件做相应的修改,launch文件中也有说明,

 <!-- Uncomment this to enable TCP instead of USB connection; 'hostname' is the host name 
	or IP address of the laser scanner In cases where a race condition exists and the computer
	boots up before the TIM is ready, increase 'timelimit.'>
         <param name="hostname" type="string" value="192.168.1.42" />
         <param name="port" type="string" value="2112" />
         <param name="timelimit" type="int" value="5" />
       -->

 

所以我们改为:

<!-- Uncomment this to enable TCP instead of USB connection; 'hostname' is the host name 
	or IP address of the laser scanner In cases where a race condition exists and the computer
	boots up before the TIM is ready, increase 'timelimit.'-->
         <param name="hostname" type="string" value="192.168.192.100" />
         <param name="port" type="string" value="2112" />
         <param name="timelimit" type="int" value="15" />

 

并且相应的修改hostname的取值value为激光雷达的IP地址,端口号如果需要根据需要修改,并且相应的增加连接创建等待时间为15秒。

    2. 测试雷达

在sick_tim/launch下创建view_sick.launch,并输入以下内容:

<!--
  Used for visualising sick in action.  
  
  It requires sick_tim551_2050001.launch.
 -->
<launch>
  <include file="$(find sick_tim)/launch/sick_tim551_2050001.launch" />

  <node name="rviz" pkg="rviz" type="rviz" args="-d $(find sick_tim)/rviz/sick.rviz"/>
</launch>

 

命令(编译及运行):

cd ~/catkin_ws/

catkin_make

roslaunch sick_tim view_sick.launch

 

    3. 创建地图

在sick_tim/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>

 

命令(编译及运行,关闭上面测试雷达的窗口后进行):

cd ~/catkin_make
catkin_make
roslaunch sick_tim view_sick.launch
roslaunch sick_tim hector_mapping_demo.launch

 

建图完成后的整体效果,还是有一定的漂移,

以上是测试情况。

-------------------------------------------------------分割线-----------------------------------------------------------------------------------------------

查看hector slam的源代码后发现,在hector_slam/hector_mapping/include/hector_slam_lib/map/OccGridMapUtil.h文件中采用介绍Bilinear filtering的构图方法中

公式4,5,6对应的代码为:

// /*
    return Eigen::Vector3f(
      ((intensities[0] * xFacInv + intensities[1] * factors[0]) * (yFacInv)) +
      ((intensities[2] * xFacInv + intensities[3] * factors[0]) * (factors[1])),
      -((dx1 * xFacInv) + (dx2 * factors[0])),
      -((dy1 * yFacInv) + (dy2 * factors[1]))
    );//original code
   // */

而根据论文公式推导,代码应该是

 ///*
      return Eigen::Vector3f(
      ((intensities[0] * xFacInv + intensities[1] * factors[0]) * (yFacInv)) +
      ((intensities[2] * xFacInv + intensities[3] * factors[0]) * (factors[1])),
      -((dx1 * yFacInv) + (dx2 * factors[1])),
      -((dy1 * xFacInv) + (dy2 * factors[0]))
    );//modify according to the paper
    //*/

 

从理论上来说更改后的代码应该更符合Bilinear filtering的拟合理论,并且对应于原来的代码和修改后的代码分别做了以下测试,保证其他外部环境相同,查看不同代码所建地图的情况,从我建的地图来说,原来的代码相比于修改后的代码更容易发生漂移,如下图所示:

Avatar_small
Bluehost Login 说:
2022年8月09日 15:57

Blue host Webmail lets the individual create their professional and personalized email address. Having a business or personal brand does require a personalized email address, which increases more credibility. The attraction from customers will be more when you use your business related or personal name in the mail instead of using @outlook or @gmail. Bluehost Login There are options under Blue host Webmail that allow users to create personal email without actually creating a website. The Blue host Webmail control panel allows you to create multiple emails with a user-friendly option to access the same.

Avatar_small
MBOSE Question Paper 说:
2022年9月03日 22:33

Meghalaya Board of School Education (MBOSE) Responsible For Conducting SSLC Annual Examination Starting Date Wednesday 4th March, 2023, End of Exam Monday 16 March 2023, Students Download MBOSE SSLC Model Paper 2023 at Official Website Only, MBOSE Question Paper MBOSE SSLC Model Question Paper 2023 now available on the official website, Meghalaya Board has been Announced SSLC Public Examination Time Table 2023 soon, Students can Download MBOSE SSLC Previous Question Paper & Solved Question paper which is helpful in your study.

Avatar_small
Meghalaya 8th Class 说:
2023年7月19日 21:13

Students Should Download the Respective Stream wise MBOSE Board 8th Class Exam Syllabus Subjects of Hindi, English, Mathematics, Science, Social Science etc, Pdf Format Provide Check the same From our page here,Students need to Start Their Preparation by first Downloading the Stream wise MBOSE 8th Class Curriculum Syllabus 2024 Latest Edition.Meghalaya Board Class Syllabus 2024 is Designed in Meghalaya 8th Class Syllabus 2024 Accordance with the NCERT Based Guidelines and helps Students to get an Overview of the Hindi, English Medium All Subject, MBOSE keeps a Class Exam Pattern with the aim to Provide a Quality Education for All Students, On the basis of the Current Educational Demands


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee