occupancy_grid_utils cellsInConvexPolygon usage

asked 2014-11-24 11:00:28 -0500

heuristicus gravatar image

updated 2014-11-24 13:18:55 -0500

I'm trying to use the occupancy_grid_utils package for manipulating an occupancy grid, but I seem to be unable to get the right results from some of the functions, in particular cellsInConvexPolygon, found here.

The function requires the nav_msgs/MapMetaData and a geometry_msgs/Polygon, which look like this:

Metadata:

map_load_time: 0.000000000
resolution: 0.05
width: 230
height: 360
origin: 
  position: 
    x: 0
    y: 0
    z: 0
  orientation: 
    x: 0
    y: 0
    z: 0
    w: 0

Polygon:

points[]
  points[0]: 
    x: 3
    y: 3
    z: 0
  points[1]: 
    x: 3
    y: 5
    z: 0
  points[2]: 
    x: 5
    y: 5
    z: 0
  points[3]: 
    x: 5
    y: 3
    z: 0

When I call the function, the iterator returned contains all of the cells in the OccupancyGrid, a total of 82800. From what I can see, the function which checks that a cell intersects with an edge of the polygon (line 69 of geometry.cpp) never returns true. Is there something I'm doing wrong in the function call or polygon construction, or is this an issue within the library code?

Edit: I'm currently running ROS Hydro on Ubuntu 12.04.

edit retag flag offensive close merge delete