rosjava/android_core

Possible bug / unexpected behaviour inside OccupancyGrid

Closed this issue · 3 comments

I'm currently working with the visualization part of android_core and wondering about the following part inside OccupancyGridLayer:

if (x < numTilesWide - 1) { tiles.get(tileIndex).setStride(TextureBitmap.STRIDE); } else { tiles.get(tileIndex).setStride(width % TextureBitmap.STRIDE); }

I'm receiving a map with a 2048x2048 resolution and therefore 4 tiles are created. The tiles on top (x = 1) get a stride (aka width) of 0 assigned which makes the content invisible since the TextureBitMap assigns the fillcolor. Setting the stride of the tiles to TextureBitMap.STRIDE instead seems to solve the problem.

I don't know if the current implementation is solving a problem that I'm not aware of which is why I created this issue.

Hi @stringnotfound1,
You might be right about this. If you send a PR with a fix, please include a couple of screenshots showing the before and after so that it's a bit easier to review.
Thanks in advance!

It might take a while until I manage to create the PR so here's a preview. All I did was replacing:

if (x < numTilesWide - 1) {
    tiles.get(tileIndex).setStride(TextureBitmap.STRIDE);
} else {
    tiles.get(tileIndex).setStride(width % TextureBitmap.STRIDE);
}

with

tiles.get(tileIndex).setStride(TextureBitmap.STRIDE);

inside OccupancyGridLayer.

Before (I changed the COLOR_TRANSPARENT to 0x55FF0000 for better visibility of the 'error'):

occupancy_error_0x55FF0000

After

proper_occupancy_map

Closed via #298; thanks again @stringnotfound1!