Hello Hans,
That's a good point. So I went back to the
costmap_2d
Wiki page and refreshed my memory regarding obstacle
parameters. First of all, the max range of the laser scanner does
not appear as a parameter for the costmap--it applies only to the
laser scanner itself. The two parameters relevant to the costmap
are
obstacle_range and
raytrace_range as
described below:
~<name>/obstacle_range (
double, default: 2.5)
- The default maximum distance from
the robot at which an obstacle will be inserted into the cost
map in meters. This can be over-ridden on a per-sensor basis.
~<name>/raytrace_range (
double, default: 3.0)
The default range in meters at which to
raytrace out obstacles from the map using sensor data. This can be
over-ridden on a per-sensor basis.
Note how the default
raytrace_range is greater than the
default
obstacle_range and you probably always want this
to be the case so that a ray can always travel further than the
furthest possible obstacle in order to clear it. However, no matter
how far out we make the
raytrace_range, an obstacle will
not be cleared unless the laser scanner receives a return signal
from a point beyond the original obstacle.
So it seems that whatever value you convert your 0.0 scan values to,
you will need to make your
raytrace_range parameter larger
than that value so that the modified values are registered.
I did some experiments with my Kobuki this morning using a Hokuyo
laser scanner attached to the front of the Kobuki base. I placed an
obstacle a couple of meters in front of the robot and it was picked
up on the costmap. I then removed the obstacle to see if the robot
would clear it from the costmap. As it turns out, it depended on
what was behind the original obstacle. In one case, there was a
black sofa that did not reflect the laser at all so the missing
obstacle was not cleared from the map. Looking at the raw scan
values, I saw that the Hokuyo reports either
nan or
inf
instead of 0 for these non returns. In the second case, I placed
the obstacle in front of a white wall. In this case, the costmap
was easily cleared after I removed the obstacle since the wall sent
back strong reflection data from the laser. But even in this case,
I could prevent clearing by making the
raytrace_range too
small. In other words, if the wall was further away than the
raytrace_range,
the obstacle would not be cleared unless I moved the robot forward
to be inside that range.
Finally, note that the
obstacle_range parameter described
above prevents the "ghost obstacles" you mention below from being
created.
--patrick
--
The Pi Robot Project
http://www.pirobot.org/wordpress