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

Is there a way to extract the edge with coordinates out of occupancy map in ROS?

asked 2021-04-06 08:54:21 -0500

KamilaMT gravatar image

I'm looking for a way in ROS Kinetic on Ubuntu 16.04 to extract a line (edge) out of a occupancy map made in OctoMap with 3D laser (lidar) data. I have precise imu and gps data. I need to obtain coordinates of the mapped edge to make a map of safe space for my vessel to navigate. I've already have the occupancy map in .bt or .ot format (octrees) from octomap_server package in ROS. Is there a way to detect a nearest occupied cells and extract coordinates in RViz?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-04-07 02:51:21 -0500

mohamed ahmed gravatar image

updated 2021-04-07 02:55:21 -0500

You can iterate over the leafs of your map and set the bounding box(which has values around your robot)

for (octomap::OcTree::leaf_bbx_iterator it = ourmap->begin_leafs_bbx(min_point, max_point);
        it != ourmap->end_leafs_bbx(); ++it)
{
  if(ourmap->isNodeOccupied(*it)) //check if node is occupied or note
   {
       it.getCoordinate();
   }
}

You can also iterate over all the map leafs not just in bounding box. I hope I understood your question in the write way. if you still have questions or doubts just ask

Note: min_point, max_point are defined as follows:

const octomap::point3d min_point(-10, -10, 0);
octomap::point3d max_point(10, 10, 10);
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-04-06 08:54:21 -0500

Seen: 220 times

Last updated: Apr 07 '21