Ask Your Question

How can I get nearest occupied point from map?

asked 2013-01-07 20:09:38 -0500

Alexandr Buyval gravatar image


I am trying to write simple node of particle filter for Gazebo model of robot with diff drive and sonar sensors. I use map_server node to load map. I need method (or node) to get nearest occupied point from map to defined direction. It means, I would like model of sonar sensor on map. Is there such possibility in ROS?

Best Regards, Alex

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-02-08 14:49:28 -0500

HammyG gravatar image

You will have to create your own node that subscribes to the map (OccupancyGrid) from the map_server, on topic /map. Once you have that you can find out which cells in the map are occupied.

edit flag offensive delete link more


The hector_map_server package from the hector_slam stack contains a node, that advertises a service to retrieve the distance to the nearest obstacle, given a source frame_id and point to specify the direction. You can use it directly or take it as an example.

Johannes Meyer gravatar image Johannes Meyer  ( 2013-02-08 22:32:28 -0500 )edit

Awesome! That will come in handy for me.

HammyG gravatar image HammyG  ( 2013-02-09 03:35:33 -0500 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2013-01-07 20:09:38 -0500

Seen: 259 times

Last updated: Feb 08 '13