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

Revision history [back]

Okay, your question makes sense now you've said

I want to obtain the grid map by converting this ros_msg to mat

This is fairly straightforward but you'll need to define a couple of things first, the cell size of your gridmap needs to be set, using this and the extents of your point-cloud you can work out the size of the cv::Mat you need to create to store the map.

If you create this Mat with all pixels set to empy, then you just need to loop through each point in the cloud and which 'pixel' of the map it falls into then set that pixel to occupied.

It's worth noting that you'll need to record the location of the Mat's origin within the coordinate frame that contains the point-cloud otherwise the position of the whole map will be unknown.