Rosanswers logo

Hi everyone. I'm having a hard time with simulating the SLAM algorithms using KUKA YOUBOT and ROS GAZEBO and RVIZ.

At the first, following the tutorial and modifying it in according to use it on the YOUBOT I was able to move the robot around in the GAZEBO and see the map in the rviz, however the output map was an empty image but still I could see it in the RVIZ.

Afterward I messed up with tf and costmaps trying to have an output map... It didn't work and I couldn't bring it in the previous condition.. I changed TF tree and costmaps parameters.
this is the frames tree:

PDF: docs.google.com/file/d/0B_IPYGaJlxxtRnBjX2wzQjJFT2M/edit (Link Text) Image: docs.google.com/file/d/0B_IPYGaJlxxtUl95dVdoZTd1WEk/edit (Link Text)

and then after I messed up with costs-map parameters. afterward I have Cost-maps as following texts:

Common Parameters:

> map_type: costmap transform_tolerance:
> 0.2 obstacle_range: 2.5 raytrace_range: 3.0 inflation_radius:
> 0.25
> observation_sources: base_scan
> base_scan: {sensor_frame:
> base_laser_front_link,
>             data_type: LaserScan,
>             topic: /base_scan,
>             expected_update_rate: 0.0,
>             observation_persistence: 0.0,
>             marking: true,
>             clearing: true,
>             min_obstacle_height: -0.10,
>             max_obstacle_height: 2.0}

Global parameters #Independent settings for the planner's costmap

    publish_voxel_map: true
    global_frame: /map
    robot_base_frame: base_link
    update_frequency: 5.0
    publish_frequency: 2.0
    static_map: false
    rolling_window: true

And the Local one: #Independent settings for the local costmap local_costmap: publish_voxel_map: true global_frame: /odom robot_base_frame: base_link update_frequency: 5.0 publish_frequency: 2.0 static_map: false rolling_window: true width: 10.0 height: 10.0 resolution: 0.5 origin_x: 0.0 origin_y: 0.0

Move_Base Parameters:

footprint: [[0.26, 0.18],
            [0.26, 0.014],
            [0.31, 0.014],
            [0.31, -0.014],
            [0.26, -0.014],
            [0.26, -0.18],
            [-0.27, -0.18],
            [-0.27, 0.18]]

controller_frequency: 10.0
controller_patience: 15.0
clearing_radius: 0.25
footprint_padding: 0.03

Base local planner parameters:

# Robot Configuration Parameters
    acc_lim_x: 1.25
    acc_lim_y: 1.25
    acc_lim_th: 1.6
    max_vel_x: 0.5
    min_vel_x: 0.1
    max_rotational_vel: 1.2
    min_in_place_rotational_vel: 0.1
    escape_vel: -0.1
    holonomic_robot: true

    # Goal Tolerance Parameters
    xy_goal_tolerance: 0.1
    yaw_goal_tolerance: 0.1

    # Forward Simulation Parameters
    sim_time: 1.7
    sim_granularity: 0.025
    vx_samples: 3
    vtheta_samples: 6

    # Trajectory Scoring Parameters
    goal_distance_bias: 0.8
    path_distance_bias: 0.6
    occdist_scale: 0.01
    heading_lookahead: 0.325
    dwa: false

    # Oscillation Prevention Parameters
    oscillation_reset_dist: 0.01


<node pkg="amcl" type="amcl" name="amcl">
  <remap from="scan" to="base_scan"/>

  <param name="odom_model_type" value="omni"/>
  <param name="odom_alpha5" value="0.1"/>
  <param name="transform_tolerance" value="0.2" />
  <param name="gui_publish_rate" value="1.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"/>
  <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_likelihood_max_dist" value="2.0"/>
  <param name="update_min_d" value="0.2"/>
  <param name="update_min_a" value="0.5"/>
  <param name="global_frame_id" value="/map"/>
  <param name="base_frame_id" value="/base_link"/>
  <param name="odom_frame_id" value="odom"/>
  <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"/>

<node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
      <param name="map_update_interval" value="5.0"/>
      <param name="maxUrange" value="3.0"/>
      <param name="maxRange" value="5.0"/>
      <param name="sigma" value="0.05"/>
      <param name="kernelSize" value="1"/>
      <param name="lstep" value="0.05"/>
      <param name="astep" value="0.05"/>
      <param name="iterations" value="5"/>
      <param name="lsigma" value="0.075"/>
      <param name="ogain" value="3.0"/>
      <param name="lskip" value="0"/>
      <param name="srr" value="0.1"/>
      <param name="srt" value="0.2"/>
      <param name="str" value="0.1"/>
      <param name="stt" value="0.2"/>
      <param name="linearUpdate" value="1.0"/>
      <param name="angularUpdate" value="0.5"/>
      <param name="temporalUpdate" value="3.0"/>
      <param name="resampleThreshold" value="0.5"/>
      <param name="particles" value="30"/>
      <param name="xmin" value="-30.0"/>
      <param name="ymin" value="-30.0"/>
      <param name="xmax" value="30.0"/>
      <param name="ymax" value="30.0"/>
      <param name="delta" value="0.05"/>
      <param name="llsamplerange" value="0.01"/>
      <param name="llsamplestep" value="0.01"/>
      <param name="lasamplerange" value="0.005"/>
      <param name="lasamplestep" value="0.005"/>

every time I change something in cost-maps or even in AMCL I get different error.. that made me believe that the problem is because of Costs-map parameters or AMCL.. At the moment with parameters that were mentioned in above I get this warning:

[ INFO] [1403678029.195277414, 411.852000000]: MAP SIZE: 199, 199
[ INFO] [1403678029.212992584, 411.852000000]: Subscribed to Topics: base_scan
[ WARN] [1403678029.388813758, 411.911000000]: You have set an inflation radius that is less than the inscribed and circumscribed radii of the robot. This is dangerous and could casue the robot to hit obstacles. Please change your inflation radius setting appropraitely.

following by this error:

[ INFO] [1403678029.903436669, 412.011000000]: Sim period is set to 0.10
[ERROR] [1403678145.134253594, 438.395000000]: No Transform available Error looking up robot pose: The tf tree is invalid because it contains a loop.
Frame /laser exists with parent /base_laser_front_link.
Frame /base_laser_front_link exists with parent /base_link.
Frame /odom exists with parent /map.
Frame /map exists with parent NO_PARENT.
Frame /arm_link_1 exists with parent /arm_link_0.
Frame /arm_link_0 exists with parent /base_link.
Frame /arm_link_2 exists with parent /arm_link_1.
Frame /arm_link_3 exists with parent /arm_link_2.
Frame /arm_link_4 exists with parent /arm_link_3.
Frame /arm_link_5 exists with parent /arm_link_4.
Frame /caster_link_bl exists with parent /base_link.
Frame /base_link exists with parent /base_footprint.
Frame /caster_link_br exists with parent /base_link.
Frame /caster_link_fl exists with parent /base_link.
Frame /caster_link_fr exists with parent /base_link.
Frame /gripper_finger_link_l exists with parent /gripper_palm_link.
Frame /gripper_palm_link exists with parent /arm_link_5.
Frame /gripper_finger_link_r exists with parent /gripper_palm_link.
Frame /wheel_link_bl exists with parent /caster_link_bl.
Frame /wheel_link_br exists with parent /caster_link_br.
Frame /wheel_link_fl exists with parent /caster_link_fl.
Frame /wheel_link_fr exists with parent /caster_link_fr.
Frame /base_footprint exists with parent /odom.
Frame /plate_link exists with parent /base_link.

And when I set a goal in rviz... the robot start to turn around of itself.. and it doesn't go to the goal location.. although it looks the map in the Rviz is being generated caz I can see the edges of obstacles..

I'm almost beginner in ROS.. I followed many tutorials but still I'm stuck in this problem.. I'm really confused and I don't know which part exactly I'm doing wrong in... if anyone can give me a hand or a hint I'll be so thankful

Cheers! Hamid

Originally posted by Hamid on ROS Answers with karma: 11 on 2014-06-25

Post score: 1

Original comments

Comment by bvbdort on 2014-06-27:
Error log say tf has some problem. use these commands to see your tf $ rosrun tf view_frames $ evince frames.pdf

Comment by Hamid on 2014-06-29:
Thanks @bvbdort for reply... but I've already done that...

docs.google.com/file/d/0B_IPYGaJlxxtRnBjX2wzQjJFT2M/edit (Link Text) Image: docs.google.com/file/d/0B_IPYGaJlxxtUl95dVdoZTd1WEk/edit

this is frames... It seems to me that it's ok.

Comment by Hamid on 2014-06-29:
http://docs.google.com/file/d/0B_IPYGaJlxxtRnBjX2wzQjJFT2M/edit http://docs.google.com/file/d/0B_IPYGaJlxxtUl95dVdoZTd1WEk/edit

Comment by bvbdort on 2014-06-29:
change map to odom frequecy rate to 50hz and are you using bag file ?

Comment by Hamid on 2014-06-30:
@bvbdort How can I do it? no I'm not using any bag file

Comment by bvbdort on 2014-06-30:
As you can see from the field "most recent transform" , tf timestamps are very old see , did you try by changing map to odom frequency ?

Comment by Hamid on 2014-06-30:
To be honest I still don't understand... how to do that? I mean where exactly defines it?.. probably I didn't change it before.. because I don't know how should I do... is it a parameters in costs maps?

Comment by bvbdort on 2014-06-30:
In AMCL update these and try

Comment by Hamid on 2014-07-01:
now I get these: TF_OLD_DATA ignoring data from the past for frame /odom at time 0 according to authority /slam_gmapping Possible reasons are listed at ---------and this one:----------- The origin for the sensor at (0.27, -0.00) is out of map bounds. So, the costmap cannot raytrace for it.

Comment by Hamid on 2014-07-01:
update: I removed those two lines and I checked in frames tree the odom is connected to the base_footprint... I suppose this line: ---------(((((----)))))----- is connecting frames.... then I added this line:-------((((((------))))))------ It's almost working fine except that with the mapserver code in terminal when I print the map... map is all empty and it's just a whole white image... besides in rviz when I choose the "/map" for the "fixed frame" the robot model turns to white and become ok all the time.. I can see the map in the rviz but I can not have it printed. hence I think the previouse problem was bc of the tf.. btw sometimes I get the errore that the sensor data is old and robot starts to turn around of itself.. but I point a new goal it startTOMOVE

Comment by Hamid on 2014-07-01:
plus I get sometimes the tf error as well.. Thanks you again dear @bvbdort .. it's so nice of you that you help me

Comment by bvbdort on 2014-07-01:
@Hamid are you using bag file for sensor reading do you have device attached?

Comment by Hamid on 2014-07-02:
no, I'm trying to make it through the simulation first. I don't use bag file. I mean I just bring up the navigation and the simulation world.. then I call gmapping and afterward I use the mapsaver, I'm trying to feel the process first then I'd like to simulate my slam algorithms and use the real robot

Comment by bvbdort on 2014-07-02:
@ if you are able to visualise laser in rviz and environment, you should get map

Comment by Hamid on 2014-07-03:
but I cannot. today I brought it up again but this time the map in rviz also is empty... I think there is something wrong either with the frame trees or with the AMCL.. I'm really confused now.. I don't know what should I do...

Comment by bvbdort on 2014-07-03:
are you able to view laser in rviz ?

Comment by Hamid on 2014-07-04:
yes.. I can see the obstacles in blue, the path in green and the goal in red.

Comment by bvbdort on 2014-07-04:
Can you share your recent error log

Comment by Hamid on 2014-07-05:
how can I do it?

Comment by bvbdort on 2014-07-05:
i mean in terminal what error it is showing , if any

Comment by donmrsir on 2014-07-06:
Hi hamid.

If you cant see the map in rviz its a problem with gmapping or even rviz, the costmap params are only for navegation. So you should post the params you use with gmapping. Furthermore i see that you are using amcl for localization, you dont need to do that if you are using slam_gmapping, because it solves SLAM (localization + mapping).

The only weird thing i see in costmap params, is that u set "publish_voxel_map: true" while you are using a costmap instead of a voxel map.

Comment by Hamid on 2014-07-08:
[ERROR] [1403678145.134253594, 438.395000000]: No Transform available Error looking up robot pose: The tf tree is invalid because it contains a loop. However now I don't have this error anymore.I don't know how. but I changed everything and now it's solved. I dnt know wht was wrong.@bvbdort

Comment by Hamid on 2014-07-08:
Thanks @donmrsir for comment. what about parameters related to frames? caz I thought maybe the problem was because of the parameters.. since every time that I have changed the costmap params the error was different. shouldn't be Map> Odom>base_footprint>base_link ... base_link included >laser

Comment by donmrsir on 2014-07-09:
Your tf tree is ok. I think that the error u get is for using AMCL and gmapping at the same time. Both publish the map -> odom transformation, so this can be the error. Try to use the same system again without using AMCL. Slam_gmapping will do the mapping and the localization.


1 Answer 1


Rosanswers logo

Your error is because you are publishing the static transform map_to_odom. The (map -> odom) transformation is what the SLAM or Localization algorithm (e.g. gmapping or amcl, respectively) is in charge of outputting. (map -> odom) is the transform that corrects the drift in your odometry.

Typical transform setup of a mobile robot:

  • (base_link -> base_scan): Static transform that relates the scanner's frame to the robot's center of rotation (it's the scanner's pose in the base_link's frame).
  • (odom -> base_link): Broadcast by your Odometry node; it's the pose of the robot if just using odometry and is subject to drift over time (typical odometry comes from wheel encoders).
  • (map -> odom): Broadcast by SLAM/Localization node, which takes in the output of the odometry node and sensor readings to improve the accuracy of the robot's pose.

It would appear you have a lot of reading to do on transforms. Have you went through relevant tutorials yet? TF tutorials are here, and this is more info on how frames and transforms are typically used on mobile robots.

Originally posted by kwiesz91 with karma: 78 on 2015-09-14

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

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