其他分享
首页 > 其他分享> > ROS 用hector_slam建图

ROS 用hector_slam建图

作者:互联网

安装hector_slam

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

进入hector_slam_launch包,在launch目录下添加三个launch文件

  1. slam.launch
<launch>

    <param name="/use_sim_time" value="false"/>

      <node pkg="rviz" type="rviz" name="rviz" args="-d $(find hector_slam_launch)/rviz_cfg/mapping_demo.rviz"/>

    <include file="$(find hector_slam_launch)/launch/hector_mapping.launch"/>

     

    <include file="$(find hector_slam_launch)/launch/geotiff_mapper.launch">

      <arg name="trajectory_source_frame_name" value="scanmatcher_frame"/>

    </include>

 </launch>

2、hector_mapping.launch

<launch>

 

<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping"   output="screen">

  <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" />

 

  <!-- Map size / start point -->

    <param name="map_resolution" value="0.050"/>

    <param name="map_size" value="1048"/>

    <param name="map_start_x" value="0.5"/>

    <param name="map_start_y" value="0.5" />

    <param name="map_multi_res_levels" value="2" />

   

    <!-- Map update parameters -->

    <param name="update_factor_free" value="0.4"/>

    <param name="update_factor_occupied" value="0.9" />   

    <param name="map_update_distance_thresh" value="0.4"/>

    <param name="map_update_angle_thresh" value="0.06" />

    <param name="laser_z_min_value" value = "-1.0" />

    <param name="laser_z_max_value" value = "1.0" />

 

</node>

 

<node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster" args="0 0 0 0 0 0 /base_link /laser_frame 100" /> 

 

</launch>

3、geotiff_mapper.launch

<launch>

<arg name="trajectory_source_frame_name" default="/base_link"/>

<arg name="trajectory_update_rate" default="4"/>

<arg name="trajectory_publish_rate" default="0.25"/>

 

<node pkg="hector_trajectory_server" type="hector_trajectory_server" name="hector_trajectory_server" output="screen">

<param name="target_frame_name" type="string" value="/map" />

<param name="source_frame_name" type="string" value="$(arg trajectory_source_frame_name)" />

<param name="trajectory_update_rate" type="double" value="$(arg trajectory_update_rate)" />

<param name="trajectory_publish_rate" type="double" value="$(arg trajectory_publish_rate)" />

</node>

 

<node pkg="hector_geotiff" type="geotiff_node" name="hector_geotiff_node" output="screen" launch-prefix="nice -n 15">

<remap from="map" to="/dynamic_map" />

<param name="map_file_path" type="string" value="$(find hector_geotiff)/maps" />

<param name="map_file_base_name" type="string" value="uprobotics" />

<param name="geotiff_save_period" type="double" value="0" />

<param name="draw_background_checkerboard" type="bool" value="true" />

<param name="draw_free_space_grid" type="bool" value="true" />

</node>

</launch>

 启动激光雷达node,以rplidar为例

roslaunch rplidar_ros rplidar.launch

 启动hector建图

roslaunch hector_slam_launch slam.launch

标签:ros,launch,hector,建图,slam,rplidar,ROS
来源: https://blog.csdn.net/BAIFOL/article/details/122634236