Построение карты и локализация мобильного робота в ROS без одометрии с использованием laser_scan_matcher

! SLAM Hector SLAM. ROS. , Hokuyo URG-04LX-UG01 gmapping amcl. laser_scan_matcher. , .

laser_scan_matcher


, ! ROS Indigo, ROS (Jade, Kinetic, Hydro). ( ROS Kinetic apt-get).

laser_scan_matcher , Canonical Scan Matcher, . . , .

:

sudo apt-get install ros-indigo-laser-scan-matcher

:

roscore
roslaunch laser_scan_matcher demo.launch

rviz:



laser_scan_matcher , bag . . , gmapping. my_gmapping_launch.launch gmapping:

cd ~/catkin_ws/src
catkin_create_pkg my_laser_matcher
cd src/my_laser_matcher
mkdir launch
vim launch/my_gmapping_launch.launch

my_gmapping_launch.launch:

my_gmapping_launch.launch
<?xml version="1.0"?>                                                                                                                           
<launch>                                                                                                      
    <node pkg="tf" type="static_transform_publisher" name="base_link_to_laser"                                
           args="0.0 0.0 0.0 0.0 0.0 0.0 /base_link /laser 40" />                                             
                                                                                                              
  <node pkg="laser_scan_matcher" type="laser_scan_matcher_node" name="laser_scan_matcher_node" output="screen">
   <param name="fixed_frame" value = "odom"/>                                                                 
   <param name="use_odom" value="true"/>                                                                      
   <param name="publish_odom" value = "true"/>                                                                
   <param name="use_alpha_beta" value="true"/>                                                                
   <param name="max_iterations" value="10"/>                                                                  
  </node>                                                                                                     
                                                                                                              
  <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">                             
   <param name="map_udpate_interval" value="1.0"/>                                                            
   <param name="delta" value="0.02"/>                                                                         
  </node>                                                                                                     
</launch>


static_transform_publisher tf base_link → laser, laser_scan_matcher slam_gmapping. . Hokuyo ROShokuyo_node:

sudo apt-get install ros-indigo-hokuyo-node

getID hokuyo_node :

rosrun hokuyo_node getID /dev/ttyACM0

:

Error: Failed to open port. Permission denied.
[ERROR] 1263843357.793873000: Exception thrown while opening Hokuyo.
Failed to open port: /dev/ttyACM0. Permission denied (errno = 13). You probably don't have premission to open the port for reading and writing. (in hokuyo::laser::open) You may find further details at http://www.ros.org/wiki/hokuyo_node/Troubleshooting

/dev/ttyACM0:

sudo chmod a+rw /dev/ttyACM0

getID hokuyo_node :

Device at /dev/ttyACM0 has ID H0906078

hokuyo_node:

rosrun hokuyo_node hokuyo_node

my_gmapping_launch.launch:

roslaunch my_laser_matcher my_gmapping_launch.launch
rosrun rviz rviz

:

rostopic list

:

/initialpose
/move_base_simple/goal
/odom
/pose2D
...
/imu/data

laser_scan_matcher.

rviz LaserScan /scan , . Map TF. TF Frames, : odom, map, base_link. , , . /map Fixed frame Displays Global options.

rviz :

图片

. map_saver map_server :

rosrun map_server map_saver

amcl


amcl. my_localize.launch :

my_localize.launch
<launch>

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


  <node pkg="tf" type="static_transform_publisher" name="base_link_to_laser" 
    args="0.0 0.0 0.0 0.0 0.0 0.0 /base_link /laser 40" />

  <node name="hokuyo" pkg="hokuyo_node" type="hokuyo_node" respawn="false" output="screen">
    <param name="calibrate_time" type="bool" value="false"/> 
    <param name="port" type="string" value="/dev/ttyACM0"/> 
    <param name="intensity" type="bool" value="false"/>
  </node>

  <node pkg="laser_scan_matcher" type="laser_scan_matcher_node" 
    name="laser_scan_matcher_node" output="screen">
    <param name="fixed_frame" value = "odom"/>
    <param name="use_alpha_beta" value="true"/>
    <param name="max_iterations" value="10"/>
  </node>

 <node name="map_server" pkg="map_server" type="map_server" args="/home/vladimir/catkin_ws/map.yaml"/>

  <node pkg="amcl" type="amcl" name="amcl" output="screen" >
  <!-- Publish scans from best pose at a max of 10 Hz -->
  <param name="odom_model_type" value="diff"/>
  <param name="odom_alpha5" value="0.1"/>
  <param name="transform_tolerance" value="0.2" />
  <param name="gui_publish_rate" value="10.0"/>
  <param name="laser_max_beams" value="30"/>
  <param name="min_particles" value="500"/>
  <param name="max_particles" value="5000"/>
  <param name="kld_err" value="0.05"/>
  <param name="kld_z" value="0.99"/>
  <param name="odom_alpha1" value="0.2"/>
  <param name="odom_alpha2" value="0.2"/>
  <!-- translation std dev, m -->
  <param name="odom_alpha3" value="0.8"/>
  <param name="odom_alpha4" value="0.2"/>
  <param name="laser_z_hit" value="0.5"/>
  <param name="laser_z_short" value="0.05"/>
  <param name="laser_z_max" value="0.05"/>
  <param name="laser_z_rand" value="0.5"/>
  <param name="laser_sigma_hit" value="0.2"/>
  <param name="laser_lambda_short" value="0.1"/>
  <param name="laser_lambda_short" value="0.1"/>
  <param name="laser_model_type" value="likelihood_field"/>
  <!-- <param name="laser_model_type" value="beam"/> -->
  <param name="laser_likelihood_max_dist" value="2.0"/>
  <param name="update_min_d" value="0.2"/>
  <param name="update_min_a" value="0.5"/>
  <param name="odom_frame_id" value="odom"/>

  <param name="base_frame_id" type="str" value="base_link" />
  <param name="global_frame_id" type="str" value="map" />

  <param name="resample_interval" value="1"/>
  <param name="transform_tolerance" value="0.1"/>
  <param name="recovery_alpha_slow" value="0.0"/>
  <param name="recovery_alpha_fast" value="0.0"/>
  <param name="use_map_topic" value="true" />
  <param name="first_map_only" value="true" />
</node>

</launch>


gmapping /laser → /base_link static_transform_publisher, hokuyo_node laser_scan_matcher. map_server , args yaml. amcl . amcl .

github . :

roslaunch my_laser_matcher my_localize.launch

rviz. map Fixed frame Global options. :

rostopic list

:

...
/amcl/parameter_descriptions
/amcl/parameter_updates
/amcl_pose
...
/map
/map_metadata
/map_updates
...
/particlecloud

amcl_pose , amcl.
:

rostopic echo /amcl_pose

:

header: 
  seq: 15
  stamp: 
    secs: 1482430591
    nsecs:  39625000
  frame_id: map
pose: 
  pose: 
    position: 
      x: 0.781399671581
      y: 0.273353260585
      z: 0.0
    orientation: 
      x: 0.0
      y: 0.0
      z: -0.636073020536
      w: 0.771628869694
  covariance: [0.2187289446708912, -0.010178711317316846, 0.0, 0.0, 0.0, 0.0, -0.010178711317316819, 0.23720047371620548, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.07106236846890918]
---

rviz :

图片

. :

图片

. rviz. amcl . 2D Pose Estimate. rviz 2D Pose Estimate, rviz ( base_link) . , :

图片

() . .

图片

, my_localize.launch:

[ INFO] [1482431993.717411186]: Setting pose (1482431993.717383): -0.413 -0.071 0.057

:



/particlecloud (Pose) . — geometry_msgs/PoseArray.

/particlecloud:

图片

rviz :

图片

, . 2D Pose estimate, amcl ros.org.

! (gmapping amcl) Navigation stack ROS, . laser_scan_matcher, gmapping amcl. , .
ROS ROS. !

PS: 2017 !

Source: https://habr.com/ru/post/zh-CN399827/


All Articles