Ask Your Question

RVIZ is unable to show the map from hector_slam

asked 2018-10-22 04:31:34 -0500

rui gravatar image

updated 2019-01-09 01:45:53 -0500

jayess gravatar image

I do not have any errors. I am able to see the laserscan and it is able to detect and show the movement of the sensor. However, I am unable to see the map. I have put in the respective topics and fixed frames as many tutorials have mentioned. Can anyone help me check if anything is wrong? Thank you.

view_sick.launch file:

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

hector_mapping_demo.launch file:

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


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

bag info:
path:        2018-10-18-11-51-00.bag
version:     2.0
duration:    31.8s
start:       Oct 18 2018 11:51:01.40 (1539834661.40)
end:         Oct 18 2018 11:51:33.15 (1539834693.15)
size:        79.0 MB
messages:    3253
compression: none [18/18 chunks]
types:       diagnostic_msgs/DiagnosticArray         [60810da900de1dd6ddd437c3503511da]
             dynamic_reconfigure/Config              [958f16a05573709014982821e6822580]
             dynamic_reconfigure/ConfigDescription   [757ce9d44ba8ddd801bb30bc456f946f]
             geometry_msgs/PoseStamped               [d3812c3cbc69362b77dc0b19b345f8f5]
             geometry_msgs/PoseWithCovarianceStamped [953b798c0f514ff060a53a3498ce6246]
             nav_msgs/MapMetaData                    [10cfc8a2818024d3248802c00c95f11b]
             nav_msgs/OccupancyGrid                  [3381f2d731d4076ec5c71b0759edbe4e]
             rosgraph_msgs/Log                       [acffd30cd6b6de30f120938c17c593fb]
             sensor_msgs/LaserScan                   [90c7ef2dc6895d81024acba2ac42f369]
             sensor_msgs/PointCloud                  [d8e9c3f5afbdd8a130fd1d2763945fca]
             tf2_msgs/TFMessage                      [94810edda583a504dfda3829e70d7eec]
topics:      /diagnostics                                    31 msgs    : diagnostic_msgs/DiagnosticArray        
             /map                                            17 msgs    : nav_msgs/OccupancyGrid                 
             /map_metadata                                    1 msg     : nav_msgs/MapMetaData                   
             /poseupdate                                    479 msgs    : geometry_msgs/PoseWithCovarianceStamped
             /rosout                                         17 msgs    : rosgraph_msgs/Log                       (5 connections)
             /rosout_agg                                      6 msgs    : rosgraph_msgs/Log                      
             /scan                                          474 msgs    : sensor_msgs/LaserScan                  
             /sick_tim571_2050101/parameter_descriptions      1 msg     : dynamic_reconfigure/ConfigDescription  
             /sick_tim571_2050101/parameter_updates           1 msg     : dynamic_reconfigure/Config             
             /slam_cloud                                    482 msgs    : sensor_msgs/PointCloud                 
             /slam_out_pose                                 474 msgs    : geometry_msgs/PoseStamped              
             /tf                                           1269 msgs    : tf2_msgs/TFMessage                      (2 connections)

                                   1 msg     : tf2_msgs/TFMessage!

image description

edit retag flag offensive close merge delete


Are they your actuals launch files ? I don't know if it's just typos but things like <!**-- or param name**= would generate errors for sure.

Delb gravatar image Delb  ( 2018-10-22 08:10:16 -0500 )edit

typo typo sry

rui gravatar image rui  ( 2018-10-22 08:13:00 -0500 )edit

You also launch rviz twice with the same name, which launch file are you actually using ?

Delb gravatar image Delb  ( 2018-10-22 08:16:05 -0500 )edit

the bottom one

rui gravatar image rui  ( 2018-10-22 08:18:50 -0500 )edit

What do you get when you echo the map topic?

curi_ROS gravatar image curi_ROS  ( 2018-10-24 05:32:24 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-10-22 10:11:08 -0500

KinWah gravatar image
<?xml version="1.0"?>

  <arg name="tf_map_scanmatch_transform_frame_name" default="scanmatcher_frame"/>
  <arg name="base_frame" default="base_link"/>
  <arg name="odom_frame" default="base_link"/>
  <arg name="pub_map_odom_transform" default="true"/>
  <arg name="scan_subscriber_queue_size" default="5"/>
  <arg name="scan_topic" default="scan"/>
  <arg name="map_size" default="2048"/>

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

    <!-- Frame names -->
    <param name="map_frame" value="map" />
    <param name="base_frame" value="$(arg base_frame)" />
    <param name="odom_frame" value="$(arg odom_frame)" />

    <!-- Tf use -->
    <param name="use_tf_scan_transformation" value="true"/>
    <param name="use_tf_pose_start_estimate" value="false"/>
    <param name="pub_map_odom_transform" value="$(arg pub_map_odom_transform)"/>

    <!-- Map size / start point -->
    <param name="map_resolution" value="0.050"/>
    <param name="map_size" value="$(arg map_size)"/>
    <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.02" />
    <param name="laser_z_min_value" value = "-1.0" />
    <param name="laser_z_max_value" value = "1.0" />

    <!-- Advertising config --> 
    <param name="advertise_map_service" value="true"/>

    <param name="scan_subscriber_queue_size" value="$(arg scan_subscriber_queue_size)"/>
    <param name="scan_topic" value="$(arg scan_topic)"/>

    <!-- Debug parameters -->
      <param name="output_timing" value="false"/>
      <param name="pub_drawings" value="true"/>
      <param name="pub_debug_output" value="true"/>
    <param name="tf_map_scanmatch_transform_frame_name" value="$(arg tf_map_scanmatch_transform_frame_name)" />

  <node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster" args="0 0 0 0 0 0 base_link laser 30"/>

This is my launch file. Maybe it can serve as a reference for your troubleshooting process. It is working fine on RPLIDAR running with Raspberry Pi 3.

I am not sure this is your expected solution but due to the word limit in the comment section, I am unable to share with you my launch file. Therefore I reply as a solution.

Hopefully, it is useful for you.

edit flag offensive delete link more


I am using raspberry pi 3 B+ may i ask which OpenGL config did you use?

rui gravatar image rui  ( 2018-10-23 21:17:44 -0500 )edit

I think our project is slightly different. my raspberry (slave) is just to publish laser data and the mapping is done on laptop (master). I am not sure how to check opengl config :3 i am new to this. but i use the default because as far as i remember, i did not change any of it.

KinWah gravatar image KinWah  ( 2018-10-24 00:34:43 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2018-10-22 04:31:34 -0500

Seen: 174 times

Last updated: Jan 09 '19