0
$\begingroup$

Rosanswers logo

First off, I understand that versions of this question have been asked before, but I have already scoured through ROS wiki, ROS answers, google, etc. and I'm still lost. I am brand new to Linux, and ROS, but have MUCH time to devote to learning this material.

I am running a fresh install of Ubuntu 16.04 and ROS Kinetic. My objective is to use the Neato Lidar and Hector SLAM to create a 2D map of our office. I have the Lidar running and it can create real-time maps on rviz, but I am having issues when trying to implement Hector SLAM. I think my problem stems from a tf issue. In order to get to this point, I used this tutorial: http://meetjanez.splet.arnes.si/2015/08/22/neato-xv-11-to-ros-slam/. I had already completed everything to get the Lidar drivers running (as in the tutorial, but from the ROS source), and the tutorial was useful to help me understand how to get the SLAM installed. But, in the very last step when I launch the neato.launch file, I get a repeating error of

 lookupTransform base_footprint to laser timed out. Could not transform laser scan into base_frame

and a one-time error of

No transform between frames /map and /base_link available after 20.002796 seconds of waiting. This warning only prints once.

My launch files are as follows.. neato.launch :

<?xml version="1.0"?>

<launch>

  <!--<node pkg="xv_11_laser_driver" type="neato_laser_publisher" name="xv_11_node">
    <param name="port" value="/dev/ttyACM0"/>
    <param name="firmware_version" value="2"/>
    <param name="frame_id" value="laser"/>
  </node>-->

 
  <node pkg="tf" type="static_transform_publisher" name="map_to_odom" args="0.0 0.0 0.0 0 0 0.0 /odom /base_link 10"/>

  <node pkg="tf" type="static_transform_publisher" name="base_frame_laser" args="0 0 0 0 0 0 /base_link /laser 10"/>


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

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

  <node pkg="rviz" type="rviz" name="rviz" args="-d rviz_cfg.rviz"/>
  <include file="$(find hector_geotiff)/launch/geotiff_mapper.launch"/>
</launch>

mapping_default.launch ...

<?xml version="1.0"?>

<launch>
  <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 base_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.7" />    
    <param name="map_update_distance_thresh" value="0.2"/>
    <param name="map_update_angle_thresh" value="0.9" />
    <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>
    
  <!--<node pkg="tf" type="static_transform_publisher" name="map_nav_broadcaster" args="0 0 0 0 0 0 map nav 100"/>-->
</launch>

My frames.pdf with roscore, rosrun xv_11_laser_driver neato_laser_publisher, and roslaunch hector_slam_launch neato.launch running in different terminals shows a diagram like so..

odom

| (broadcaster: /map_to_odom)

V

base_link

| (broadcaster: /base_frame_laser)

V

laser

I rviz, I can manually set the Fixed Frame to base_link, odom, etc. and get a Global Status: Ok, but cannot get the same Ok status when trying to add a map visualization. Can you please help me understand this tf linking issue and help me solve it so that I am able to make a 2D map of our office in rviz? I would like to thank you in advance for any help you can provide. I look forward to working with you and being able to show you my finished product.

update: when I use

rosrun gmapping slam_gmapping scan:=base_scan

in yet another terminal, run rviz, set the Global Fixed Frame to either map, odom, or base_link, then add a laser scan with topic /scan, I can see a live scan or the room. When I add a map visualizer and set the topic to /map, the status is OK but the scan isnt shown on the screen. Instead I just get a transparent white mask whore transparency can be changed with the alpha


Originally posted by ateator on ROS Answers with karma: 37 on 2016-06-06

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Ask this to yourself: How could be possible to detect the pose of the base_link frame if the obstacles are being detected in another frame (/laser) that it is totally unrelated?

The SLAM cannot be done because it is not possible to "measure" the distance and layout of the obstacles from the base_link frame.

You can easily solve it using a static transform publisher that relate the /base_link and the /laser frames http://wiki.ros.org/static_transform_publisher

Here you will have to define the position and orientation of the sensor in the robot base reference system.

For hector slam without odometry may be enough to consider the /base_link and the /laser frame located in the same place.


Originally posted by Pablo Iñigo Blasco with karma: 2982 on 2016-06-06

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by ateator on 2016-06-07:
Thank you for your reply. I will work on this today and get back to you.

Comment by ateator on 2016-06-07:
After checking my neato.launch file, you can see that there is a static_transform_publisher between /base_link and /laser. This is also seen in my frames.pdf. I think this is what you are suggesting? Please update me if my interpretations of your suggestions are incorrect.

Comment by ateator on 2016-06-07:
In reference to my neato.launch file, I changed the static_transform publisher between /odom and /base_link to betwwen /map and /base_link. This solved the one time error asking for that link. I still get the recurring error asking for lookupTransform base_footprint to laser

Comment by ateator on 2016-06-07:
Yet another update: got it (semi) working! i added yet another static_transform publisher between /laser and /base_footprint and not the map is viewable on rviz, I can see cordinate axes moving, and the map builds as I move! It has problems understanding where exactly I am but thats from the laser

Comment by Pablo Iñigo Blasco on 2016-06-07:
You do not have to provide the transform between map and base_link, that transform is the one provided by hector slam

Comment by Pablo Iñigo Blasco on 2016-06-07:
concerning: "No transform between frames /map and /base_link available after 20.002796 seconds of waiting. This warning only prints once." It may appear while the slam is not working properly

Comment by ateator on 2016-06-07:
When I delete that line from neato.launch, everything fails to run. Is there a better way to solve this?

Comment by Pablo Iñigo Blasco on 2016-06-07:
It is hard to say, you will have to study in detail the meaning of the different frames. Another question: why you put in your question a command to launch gmapping?

Comment by ateator on 2016-06-07:
That part is irrelevant now. I now think the issue is that there is a timing issue between the nodes. I am getting an error saying that publishing map_odom transform would require extrapolation into the future. The map works, but it's not haveing an easy time building onto itself

Comment by Pablo Iñigo Blasco on 2016-06-07:
that error now is different... this is not the way we should use ros answers... In any case, if you are using different computers for the ros network make sure that the clocks are synchronized... besides make sure that you are restarting properly roscore

Comment by fyi on 2019-04-24:
has this been solved? i am having the same issue at the moment

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.