ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
3

How to generate map with hector_slam and Kinect

asked 2011-09-29 02:17:14 -0500

Scott gravatar image

updated 2016-10-24 09:00:49 -0500

ngrennan gravatar image

Has anyone successfully got the new hector_slam package to work with the Kinect yet? Below is the launch file I am using so far.

<launch>
  <!-- kinect and frame ids -->
  <include file="$(find openni_camera)/launch/openni_node.launch"/>

  <!-- static tf between openni_camera and map frame -->
  <node pkg="tf" type="static_transform_publisher" name="map_link" args="0 0 0 0 0 0  /map /openni_camera 100" />

  <!-- openni manager -->
  <node pkg="nodelet" type="nodelet" name="openni_manager" output="screen" respawn="true" args="manager"/>

  <!-- throttling -->
  <node pkg="nodelet" type="nodelet" name="pointcloud_throttle" args="load pointcloud_to_laserscan/CloudThrottle openni_manager">
    <param name="max_rate" value="2"/>
    <remap from="cloud_in" to="/camera/depth/points"/>
    <remap from="cloud_out" to="cloud_throttled"/>
  </node>

  <!-- fake laser -->
  <node pkg="nodelet" type="nodelet" name="kinect_laser" args="load pointcloud_to_laserscan/CloudToScan openni_manager">
    <param name="output_frame_id" value="/openni_depth_frame"/>
    <remap from="cloud" to="cloud_throttled"/>
  </node>


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

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

I think I am getting close but here are the errors I get when I run it.

Frame /openni_depth_frame exists with parent /openni_camera. Frame /openni_camera exists with parent /map. Frame /map exists with parent NO_PARENT. Frame /openni_rgb_optical_frame exists with parent /openni_rgb_frame. Frame /openni_rgb_frame exists with parent /openni_camera.

Thanks in advance for any suggestions or help. -Scott

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
3

answered 2011-09-29 09:53:34 -0500

updated 2012-02-23 01:00:28 -0500

Hi Scott,

I'm working on a "how to setup your robot for hector_slam" tutorial right now, but in the end it should work out of the box if you have a robot set up for gmapping. Assuming your laser scan has the "scan" topic name and you have set the base_frame parameter correctly, it should work.

That being said, I haven't testet it with the Kinect yet, but I expect that it won't work too well because of the higher noise and much smaller FOV provided by the fake Kinect laser scans. hector_slam really works best with high update rate LIDARs.

/Update: I did some testing of hector_mapping with the Kinect and can confirm it doesn't work well. There is potential for improvement, but I unfortunately currently do not have spare time to do work in this direction at the moment.

edit flag offensive delete link more

Comments

Thanks Stefan. I noticed on reading your articled for Robocup that your hand held system had an IMU. Is that a requirement of this code as well? Thanks, -Scott
Scott gravatar image Scott  ( 2011-09-29 23:52:17 -0500 )edit
Hi Scott, a IMU is only beneficial if the platform exhibits roll/pitch motion. There is no need for a IMU on a platform when this is not the case like for example a Turtlebot. We're working on a small tutorial here: http://www.ros.org/wiki/hector_slam/Tutorials/SettingUpForYourRobot
Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2011-09-30 01:53:54 -0500 )edit
1

answered 2012-02-22 22:58:27 -0500

Cav gravatar image

updated 2012-02-22 22:59:40 -0500

I get errors, that

"Transform failed during publishing of map_odom transform: Frame id /base_footprint does not exist!"

so I had to add one more static_transofrm_publisher:

<node pkg="tf" type="static_transform_publisher" name="map_2_base_link" args="0 0 0 0 0 0 /map /base_footprint 100"/> 
<node pkg="tf" type="static_transform_publisher" name="base_footprint_2_base_stabilized_link" args="0 0 0 0 0 0 /base_footprint /base_stabilized 100"/> 
<node pkg="tf" type="static_transform_publisher" name="base_2_base_stablized_link" args="0 0 0 0 0 0 /base_stabilized /base_frame 100"/> 
<node pkg="tf" type="static_transform_publisher" name="base_2_laser_link" args="0 0 0 0 0 0 /base_frame /openni_camera 100"/> 
<node pkg="tf" type="static_transform_publisher" name="base_2_nav_link" args="0 0 0 0 0 0 /base_frame /nav 100"/>

but as Stefan said already, it does not work too well.

edit flag offensive delete link more
1

answered 2011-09-30 05:22:12 -0500

Scott gravatar image

I was able to get this to work with the Kinect using your new tutorial. (WAY COOL). But I fear it's accuracy is suffering due to the lower details of the kinect vs a real scanning laser. Maybe somebody can find a way to improve on it, but for others that want to give it a try, here is what I did. Due to needing time for the openni_node to startup I had to break the launch file into two files. After the first launch file I run rosrun image_view image_view image:=/camera/rgb/image_color to make sure I have a live feed coming from the kinect.

Launch file 1: <launch> <include file="$(find openni_camera)/launch/openni_node.launch"/>

<node pkg="nodelet" type="nodelet" name="openni_manager" output="screen" respawn="true" args="manager"/>

<node pkg="nodelet" type="nodelet" name="pointcloud_throttle" args="load pointcloud_to_laserscan/CloudThrottle openni_manager"> <param name="max_rate" value="2"/> <remap from="cloud_in" to="/camera/depth/points"/> <remap from="cloud_out" to="cloud_throttled"/> </node>

<node pkg="nodelet" type="nodelet" name="kinect_laser" args="load pointcloud_to_laserscan/CloudToScan openni_manager"> <param name="output_frame_id" value="/openni_depth_frame"/> <remap from="cloud" to="cloud_throttled"/> </node>

</launch>

Launch file #2: (again double check you can see the image from the kinect before running this with steps noted above)

<launch>

<param name="pub_map_odom_transform" value="true"/> <param name="map_frame" value="map"/> <param name="base_frame" value="base_frame"/> <param name="odom_frame" value="base_frame"/>

<node pkg="tf" type="static_transform_publisher" name="map_2_base_link" args="0 0 0 0 0 0 /map /base_stabilized 100"/> <node pkg="tf" type="static_transform_publisher" name="base_2_base_stablized_link" args="0 0 0 0 0 0 /base_stabilized /base_frame 100"/> <node pkg="tf" type="static_transform_publisher" name="base_2_laser_link" args="0 0 0 0 0 0 /base_frame /openni_camera 100"/> <node pkg="tf" type="static_transform_publisher" name="base_2_nav_link" args="0 0 0 0 0 0 /base_frame /nav 100"/>

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

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

</launch>

edit flag offensive delete link more
1

answered 2012-08-14 07:56:09 -0500

roster gravatar image

updated 2012-08-16 08:07:58 -0500

hi,

i use the two launchfiles from scott. When i start the first one the camera check is ok. when i start the second one i get this error (but rviz starts):

Trajectory Server: Transform from /map to /base_link failed: Frame id /base_link does not exist! Frames (10): Frame /openni_depth_optical_frame exists with parent /openni_depth_frame.

Frame /openni_depth_frame exists with parent /openni_camera.

Frame /base_stabilized exists with parent /map.

Frame /map exists with parent NO_PARENT.

Frame /openni_rgb_optical_frame exists with parent /openni_rgb_frame.

Frame /openni_rgb_frame exists with parent /openni_camera.

Frame /nav exists with parent /base_frame.

Frame /base_frame exists with parent /base_stabilized.

Frame /openni_camera exists with parent /base_frame.

then rvis starts and i can see the the kinect-laser-fake. The problem is that the new points are in the old one... so i dont get the frame of my room

has anybody a solution for this problem? i cant fix it :-(

"Trajectory Server: Transform from /map to /base_link failed: Frame id /base_link does not exist! "

edit flag offensive delete link more

Comments

Hey, by any chance were you able to get this code working? im having the same problem..

samarth.rajan gravatar image samarth.rajan  ( 2012-11-26 00:37:40 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2011-09-29 02:17:14 -0500

Seen: 4,441 times

Last updated: Aug 16 '12