DLu / navigation_layers

154 stars 136 forks source link

why worldToMapNoBounds? what is the use of min_x_, min_y_, max_x_, max_y_ #67

Open serenadeRay opened 4 years ago

serenadeRay commented 4 years ago

i used this layer recently, when i read the codes, i found that touch(mx, my, &minx, &miny, &maxx, &maxy); appears several times, but i didn't figure out what it is meant for. so as for the worldToMapNoBounds, didn't we consider the boudary of the map?

DLu commented 4 years ago

Just to clarify, which layer are you talking about? Also, what familiarity do you have with the layered costmap algorithm?

serenadeRay commented 4 years ago

@DLu i am talking about range sensor layer when we combined this with amcl, it stucked into the loop sometimes

for (unsigned int x = bx0; x <= (unsigned int)bx1; x++) { for (unsigned int y = by0; y <= (unsigned int)by1; y++)

after debuging we found that bx1 and by1 may be less than 0, so i was wondering why not put a boundary check here, so i do the same operation to the bx1 and by1 as to the bx0 and by0, like this

bx0 = std::max(0, bx0); by0 = std::max(0, by0); bx1 = std::max(0, bx1); by1 = std::max(0, by1);

things got better.

while there is a function called worldToMap may be more reasonable here , so i just want to know the original ideas about this point.

as for the touch things, i did not get the point truth to be told...what is it meant for?