ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

2D occupancy grid of a Gazebo world

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

kdenver gravatar image

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

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

2 Answers

Sort by ยป oldest newest most voted

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

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 2021-12-11 07:48:19 -0600

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


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

Seen: 185 times

Last updated: Dec 11 '21