Robotics StackExchange | Archived questions

No map in rviz using Hector_slam with lidar_lite

I have been working on getting a hector slam working from lidar lite laser.

I am turning the laser 360° with a motor and in rviz I get points that show me room that I am in.

I have read the tf section and am currently just using static tf (the laser has no odom)

I am running 3 launch files and will include them, also with what comes when I start the launch file.

The problem is that there is no map being generated.

Hera are the launch files

lidar.launch:

<launch>
<node pkg="rviz" type="rviz" name="rviz" />
<include file="/home/ubuntu/ros_catkin_ws/hector_mapping.launch"/>
<include file="/home/ubuntu/ros_catkin_ws/geotiff_mapper.launch">
    <arg name="trajectory_source_frame_name" value="scanmatcher_frame"/>
</include>
</launch>

and here is hector.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.025"/>
<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="-2.5" />
<param name="laser_z_max_value" value="7.5" />

<!-- 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" />
</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="tf" type="static_transform_publisher" name="map_to_base"      args="0 0 0 0 0 0 /map /base_link 100" />

<node pkg="tf" type="static_transform_publisher" name="map_to_frame"      args="0 0 0 0 0 0 /map /scanmatcher_frame 100" />
</launch>

and 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="/home/viki/Desktop/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>

output when I run the lidar.launch

... logging to /home/ubuntu/.ros/log/1d718a5a-fe48-11e4-8617-b827ebb8ff55/roslaunch-ubuntu-16706.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubuntu:36740/

SUMMARY

PARAMETERS * /hectorgeotiffnode/drawbackgroundcheckerboard: True

NODES / basetolaserbroadcaster (tf/statictransform_publisher)

hector_geotiff_node (hector_geotiff/geotiff_node)

hector_mapping (hector_mapping/hector_mapping)

hector_trajectory_server (hector_trajectory_server/hector_trajectory_server)

map_to_base (tf/static_transform_publisher)

map_to_frame (tf/static_transform_publisher)

rviz (rviz/rviz)

ROSMASTERURI=http://localhost:11311

core service [/rosout] found

process[rviz-1]: started with pid [17077]

process[hector_mapping-2]: started with pid [17114]

process[basetolaser_broadcaster-3]: started with pid [17178]

process[maptobase-4]: started with pid [17256]

HectorSM map lvl 0: cellLength: 0.025 res x:2048 res y: 2048

process[maptoframe-5]: started with pid [17318]

HectorSM map lvl 1: cellLength: 0.05 res x:1024 res y: 1024

HectorSM map lvl 2: cellLength: 0.1 res x:512 res y: 512

[ INFO] [1432059523.652529679]: HectorSM pbaseframe: baselink

[ INFO] [1432059523.653141293]: HectorSM pmapframe_: map

[ INFO] [1432059523.654512022]: HectorSM podomframe: baselink

[ INFO] [1432059523.655179991]: HectorSM pscantopic_: scan

[ INFO] [1432059523.655804001]: HectorSM pusetfscantransformation_: true

[ INFO] [1432059523.656398793]: HectorSM ppubmapodomtransform_: true

[ INFO] [1432059523.656952960]: HectorSM pscansubscriberqueuesize_: 5

[ INFO] [1432059523.657229679]: HectorSM pmappubperiod: 2.000000

[ INFO] [1432059523.657774887]: HectorSM pupdatefactorfree: 0.400000

[ INFO] [1432059523.658395668]: HectorSM pupdatefactoroccupied: 0.700000

[ INFO] [1432059523.659262439]: HectorSM pmapupdatedistancethreshold_: 0.200000

[ INFO] [1432059523.659945772]: HectorSM pmapupdateanglethreshold_: 0.060000

[ INFO] [1432059523.660655720]: HectorSM plaserzminvalue_: -2.500000

[ INFO] [1432059523.660932074]: HectorSM plaserzmaxvalue_: 7.500000

libGL error: failed to open drm device: No such file or directory

libGL error: failed to load driver: i965

process[hectortrajectoryserver-6]: started with pid [17396]

process[hectorgeotiffnode-7]: started with pid [17457]

[ INFO] [1432059524.199556449]: Waiting for tf transform data between frames /map and scanmatcher_frame to become available

[ INFO] [1432059524.581971553]: No plugins loaded for geotiff node

[ INFO] [1432059524.582619366]: Geotiff node started

[ INFO] [1432059525.200452595]: Finished waiting for tf, waited 1.001257 seconds

[ INFO] [1432059550.135537741]: lookupTransform baselink to laser timed out. Could not transform laser scan into baseframe.

If I look at the topic /scan in laser data and have /base_link in all other setting I can see the room. But no hector mapping has started.

Side note: I am running this is raspberry pie 2 using ubuntu. Then ssh into it from my laptop ubuntu. using command ssh -Y and then the hostname.

Asked by emilmare on 2015-05-19 13:43:17 UTC

Comments

Answers

I dont think you need the geotiff mapper, I will post a hector launch file which implements all nodes in one launch file.. You need transforms from odom -> base_link and base_link -> laser

<node pkg="tf" type="static_transform_publisher" name="odom_to_base_lnk" args="0 0 0 0 0 0 /odom /base_link 100"/>
<node pkg="tf" type="static_transform_publisher" name="base_lnk_to_laser_lnk" args="0 0 0 0 0 0 /base_link /laser_link 100"/>

This file works for me, my laserframe is camera_link and the first three lines are the driver for my scanner.. Also my laser data is published to /laser/scan instead of /scan..

 <launch>
    <node name="laser" pkg="cob_sick_s300" type="cob_sick_s300" respawn="false" output="screen">
        <rosparam command="load" file="s300_config.yaml"/>
    </node>

    <node pkg="tf" type="static_transform_publisher" name="odom_to_base_lnk" args="0 0 0 0 0 0 /odom /base_link 100"/>
    <node pkg="tf" type="static_transform_publisher" name="base_lnk_to_laser_lnk" args="0 0 0 0 0 0 /base_link /camera_link 100"/>

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


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

        <param name="use_tf_scan_transformation" value="true"/>
        <param name="use_tf_pose_start_estimate" value="false"/>

        <param name="map_resolution" value="0.050"/>
        <param name="map_size" value="2048"/>
        <param name="map_start_x" value="0.5"/>
        <param name="map_start_y" value="0.5" />
        <param name="map_multi_res_levels" value="3" />

        <param name="update_factor_free" value="0.4"/>
        <param name="update_factor_occupied" value="0.9" />    
        <param name="map_update_distance_thresh" value="0.04"/>
        <param name="map_update_angle_thresh" value="0.006" />

        <param name="advertise_map_service" value="true"/>

        <param name="scan_subscriber_queue_size" value="5"/>
        <param name="scan_topic" value="laser/scan"/>

        <param name="tf_map_scanmatch_transform_frame_name" value="scanmatcher_frame" />

    </node>
 </launch>

Asked by felixwatzlawik on 2015-05-20 09:08:10 UTC

Comments

Looks like I added an answer to my question. not a comment to you. Sorry about that.

Asked by emilmare on 2015-05-20 10:19:05 UTC

Thank you very much for your reply. Today I went with a new launch file

<launch>

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

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

    <param name="base_frame" value="base_link"/>
    <param name="odom_frame" value="base_link"/>
    <param name="pub_map_odom_transform" value="true"/>
    <param name="scan_subscriber_queue_size" value="25"/>

    <!-- Map size / start point -->
    <param name="map_resolution" value="0.050"/>
    <param name="map_size" value="2048"/>
    <param name="map_start_x" value="0.5"/>
    <param name="map_start_y" value="0.5" />
    <param name="map_multi_res_levels" value="2" />
    </node>

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

        <node pkg="tf" type="static_transform_publisher" name="map_nav_broadcaster" args="0 0 0 0 0 0 base_link laser 100"/>

    <node pkg="tf" type="static_transform_publisher" name="map_to_base"      args="0 0 0 0 0 0 /map /base_link 10" />

    <node pkg="tf" type="static_transform_publisher" name="map_to_frame"      args="0 0 0 0 0 0 /map /scanmatcher_frame 10" />


  </launch>

and I made a bag file of my laser reading ( the laser reading is slow, takes 27 second to go one circle) here is the bag file.

https://www.dropbox.com/s/2lyk28zt9vyavrg/test1.bag?dl=0

When I start the bag file using rosbag play test1.bag --clock

run the test.launch and then run rviz I get one map.

http://i.imgur.com/utgcrpd.png

The warning I get under the hector mapping is

Warning: TF_OLD_DATA ignoring data from the past for frame base_link at time 0 according to authority unknown_publisher
Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
     at line 260 in /tmp/buildd/ros-indigo-tf2-0.5.9-0trusty-20150326-1129/src/buffer_core.cpp
Warning: TF_OLD_DATA ignoring data from the past for frame scanmatcher_frame at time 0 according to authority unknown_publisher
Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
     at line 260 in /tmp/buildd/ros-indigo-tf2-0.5.9-0trusty-20150326-1129/src/buffer_core.cpp

and under rviz I get

[ WARN] [1432132718.095414451, 1432132025.987704380]: TF_OLD_DATA ignoring data from the past for frame base_link at time 0 according to authority unknown_publisher
Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
[ WARN] [1432132718.095502765, 1432132025.987704380]: TF_OLD_DATA ignoring data from the past for frame scanmatcher_frame at time 0 according to authority unknown_publisher
Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained

The map is generated once and does not update.

Asked by emilmare on 2015-05-20 09:56:26 UTC

Comments

change it to "/base_link /laser" also change the 10's to 100's and tell me if it works.

Asked by felixwatzlawik on 2015-06-01 10:09:25 UTC