ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Measuring map size memory requirements

asked 2014-03-19 00:52:52 -0600

koenlek gravatar image

updated 2016-10-24 09:04:50 -0600

ngrennan gravatar image

Hi all,

I am working on a way to compress the memory requirements of large scale mappings (the SLAM kind of mapping). To measure the mileage of my improvements, I need to quantify the memory requirements needed for the mapping. One way is to save the map using the map_saver package, e.g. rosrun map_server map_saver -f mymap_name. And then check the file size manually. Additionaly, I use a topological mapping, which consists of nodes that carry certain properties (e.g. location, edges connected, some observed properties of the place where the node is created, etc.). I could store this to a text file, using some xml or csv kind of formatting. Then I could manually measure that file size too, and add those two file sizes up.

Although that solution would work, it is not very elegant. And it involves manual checking of the files sizes (maybe I could write some bash script for this?). Is there any way to quantify the actual memory usage of the mappings in a more elegant manner (e.g. online instead of using an offline export), for example by quantifying the memory used by a certain topic, parameter or node? For example, how could I check the size of the map that is served in the /map topic?

Any tips on how to automatically check file sizes using bash (in case of file exports) are also welcome...

Many thanks in advance!

Cheers, Koen

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-03-25 00:08:12 -0600

janindu gravatar image

updated 2019-03-25 00:10:05 -0600

map_server publishes map information into two topics. /map_metadata topic publishes nav_msgs/MapMetaData type message and /map topic publishes nav_msgs/OccupancyGrid type message. You can measure the map size by the size of data in Occupancy Grid message (int8 data array). Simply multiply

map_size = size(occupany_grid_msg.data)*sizeof(int8);

Essentially, the meta data size is constant with map growth (== O(1)) and you can ignore that.

You can use the same principle for the topological maps.

map_size = number_of_nodes * sizeof(node);

Size of a node you will have to calculate based on the information stored inside that node (eg : Each int8 data uses 8 bits, etc).

Both calculations can be done online after the map is generated using a custom service.

As for a bash script, you can use the command

ls -sh filename

within a script.

EDIT : Just noticed that this is a 5 year old question.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-03-19 00:52:52 -0600

Seen: 639 times

Last updated: Mar 25 '19