ros-planning / navigation

ROS Navigation stack. Code for finding where the robot is and how it can get somewhere else.
2.34k stars 1.79k forks source link

Support in map_server for Rather Large Maps #635

Open DLu opened 6 years ago

DLu commented 6 years ago

As reported here

I need to localize a robot in a warehouse of 415x270 meters with a <3cm precision, which make a map of 20768x13612px at 0.020 m/px and a pgm file of 282 MB. (Or 1.7 MB in png). I tried to load it to AMCL but map_server cannot even load the map on a PC with 16GB of ram because SDL yell "Out of memory". I manage to load it by cropping some part of the map, but that's not a real solution. I could also lower the resolution, but it would be a temporary fix until I need a bigger map.

PizzocaroSolomon commented 6 years ago

@DLu Probably 1 year later is too much but I have to ask. Did you find a solution? I have the same problem. Since now I've saved into a .txt file the data of the occupancy grid (created in MATLAB); I've wrote a node that takes this file and create the occupancyGrid msg and the service "static_map". As you can see is a long ride to get the job done but I wonder if there is a better solution...

mikeferguson commented 6 years ago

I think this ticket was solely created from the discussion -- AFAIK, there is nobody actively working on a fix specifically for this. Separately, there is a ticket about changing the datatypes in AMCL -- https://github.com/ros-planning/navigation/issues/778 -- which also has an active PR -- https://github.com/ros-planning/navigation/pull/791 -- you might give that a try. (if you do try out that PR, please drop a comment here or on the PR letting us know if it helped)

SteveMacenski commented 6 years ago

For a given application, I know plenty of companies that tile their maps and load only sections at a time that are relevant in order to help deal with this. It's also a common strategy used in 3D dense and sparse reconstruction due to the amount of data stored.

eduidl commented 3 years ago

This issue would be due to restriction in SDL-1.2.

https://github.com/libsdl-org/SDL-1.2/blob/main/src/video/SDL_surface.c#L47-L52

SDL_Surface * SDL_CreateRGBSurface (Uint32 flags,
            int width, int height, int depth,
            Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
{
    :

    /* Make sure the size requested doesn't overflow our datatypes */
    /* Next time I write a library like SDL, I'll use int for size. :) */
    if ( width >= 16384 || height >= 65536 ) {
        SDL_SetError("Width or height is too large");
        return(NULL);
    }

    :
}