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

2D occupancy grid of a Gazebo world

asked 2021-12-09 17:38:06 -0500

kdenver gravatar image

updated 2022-03-03 09:38:14 -0500

lucasw gravatar image

I am trying to visualize a 2D occupancy grid in rviz for a gazebo world, with extracting and publishing each feature seperatley. For example for an empty gazebo world with just a box and a cylinder , i want to publish both the box and cylinder as OccupancyGrid messages using separate publishers.

The issue i'm running into is getting the data for each model , is the only way to do this by parsing the world file and manually getting the dimensions ? Does anyone know if there is a way to convert a gazebo world into a 2D occupancy grid ?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2021-12-10 13:51:46 -0500

duck-development gravatar image

The problem is that gazebo is a 3d wold. You need to define a scan hight to get the Occupancy Grid. You may try the Plugin

It does what you need.

edit flag offensive delete link more

answered 2023-08-07 10:28:28 -0500

KtGunn gravatar image

Look for 'pgm_map_creator' on github. That might be what you are looking for.

edit flag offensive delete link more

answered 2021-12-11 07:48:19 -0500

Mike Scheutzow gravatar image

You can iterate through gazebo's list of objects in its world. This question on may help:

Figuring out how your costmap plane intersects/slices each object is an interesting geometry problem. There are various simplifications you could use. After a quick glance, it looks like the plugin mentioned by @duck-development uses gazebo's collision detect system + brute force to figure this out. I guess that works, but it's not very elegant.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2021-12-09 17:38:06 -0500

Seen: 733 times

Last updated: Dec 11 '21