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

likelihood field of map

asked 2012-12-05 12:13:17 -0600

moyashi gravatar image

updated 2012-12-05 12:38:18 -0600

Hi, I'd like to ask about a convert of a map data.

Amcl package uses map.pgm with map.yaml.
However, map.png which is gained by slam_gmapping
has solid edges to represent obstacles(walls, tables and so on).

When and where a map data is converted to a likelihood field ?
(If possible, could you show me the correspond part of source codes?)
And which parameter is used to determine the likelihood field's standard deviation?

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2012-12-06 04:00:45 -0600

updated 2012-12-07 12:35:12 -0600

As far as I know, gmapping maintains occupancy values internally. However, the ROS wrapper thresholds them into binary free/occupied values.

Take a look at this file:


Starting at line 625:

for(int x=0; x < smap.getMapSizeX(); x++)
  for(int y=0; y < smap.getMapSizeY(); y++)
    GMapping::IntPoint p(x, y);
    double occ=smap.cell(p);
    assert(occ <= 1.0);
    if(occ < 0)[MAP_IDX(, x, y)] = -1;
    else if(occ > occ_thresh_)
      //[MAP_IDX(, x, y)] = (int)round(occ*100.0);[MAP_IDX(, x, y)] = 100;
    else[MAP_IDX(, x, y)] = 0;

The default value for occ_thresh_ is 0.25. It appears that if you want the occupancy values, you can simply revert the line which was commented out, and change the code to:[MAP_IDX(, x, y)] = (int)round(occ*100.0);
//[MAP_IDX(, x, y)] = 100;

I have created a ticket here.

EDIT: response to comment

I'm not sure whether amcl currently assumes binary values or not.

With laser sensors, you typically reach saturation probabilities (0 or 1) pretty fast, since lasers have a small uncertainty spread. My intuition is that since the nav stack is mainly developed for laser-equipped ground robots, the binary value is a good approximation.

edit flag offensive delete link more


Thank you for your kind answer and creating the ticket !! After I change the line, I need to modify amcl package to use likelihood field which doesn't have binary values but 0~255 values don't I ? Why do you think nav stack use binary values even though it's less robust ?

moyashi gravatar image moyashi  ( 2012-12-06 11:59:49 -0600 )edit

Thank you for your response.I'd like to be sure whether amcl assumes binary or not. Would you mind if I ask the question in an additional question form which includes url info of this form?

moyashi gravatar image moyashi  ( 2012-12-09 13:23:33 -0600 )edit

sure, sounds like a good idea

Ivan Dryanovski gravatar image Ivan Dryanovski  ( 2012-12-09 13:45:59 -0600 )edit
moyashi gravatar image moyashi  ( 2012-12-10 14:18:06 -0600 )edit

Question Tools


Asked: 2012-12-05 12:13:17 -0600

Seen: 1,360 times

Last updated: Dec 07 '12