fzi-forschungszentrum-informatik / Lanelet2

Map handling framework for automated driving
BSD 3-Clause "New" or "Revised" License
793 stars 325 forks source link

Retrieve 3D position information stored in Points #184

Closed ajay1606 closed 3 years ago

ajay1606 commented 3 years ago

Hello, As i understand, Points are composed of ID, 3D coordinates and attributes, and are the only elements that store actual position information. The ID must be unique. The other basic elements are directly or indirectly composed of points.

Am trying to fetch information stored in Points Datastructure Lanelet using the following function; Using lanelet_map_ptr_->laneletLayer.search(lanelet::BoundingBox2d(search_point, search_point2)); am able to get point ids as like below

 Lanelet Left :[id: 17391879 point ids: 17383600, 17391881]
 Lanelet Right :[id: 17391978 point ids: 17383604, 17383602]

Further, how can I get lat&lon information stored in the points with ids? Could anyone please suggest.

Regards, Ajay

poggenhans commented 3 years ago

as already disussed in #183, everything in lanelet2 is in a metric coordinates. Our examples should cover how to get the local x/y coordinates of points within a lanelet.

If you want lat/lon coordinates, you have to transform these points into GPSPoints using the projection. That is covered in the examples too.

ajay1606 commented 3 years ago

@poggenhans Thanks so much for your response. Here, the problem is not about the local_x/local_y or lat/long. Instead am trying to retrieve position information (local_x/local_y, lat/long) in the laneletLayer. Here with Step by Step code and my question regarding the position retriving!

//Get nearest lanelet
std::vector<std::pair<double, lanelet::Lanelet>> nearest_lanelets = lanelet::geometry::findNearest(lanelet_map_ptr_->laneletLayer, search_point, 4);

//Iterating each lanelet in nearest_lanelet and get attributes associated with each lanelet.
for (const auto & lanelet : nearest_lanelets) 

Each lanelet contains following :

Using lanelet.second.leftBound() able to get following id:

Lanelet Left :[id: 189972683 point ids: 189968497, 189972685, 189972686, 189972687, 189972688, 189972689, 189972690, 189972691, 189969770]
 Lanelet Right :[id: 189972693 point ids: 189968503, 189972695, 189972696, 189972697, 189972698, 189972699, 189972700, 189972701, 189972702, 189969774]

So my question is here, How to get position data associated with the point ids. Is there any function or code, where i can access this point ids to get position ?

For example: Accessing id of lanelet leftbound string could be done like this ; Lanelet Left :[id: 189972683 point ids: 189968497, 189972685, 189972686, 189972687, 189972688, 189972689, 189972690, 189972691, 189969770] lanelet.leftBound().id() returns 189972683 lanelet.leftBound().id().front() returns 189968497 (first node of the line string)

SO my question here is, How can i access to other Point Id's returned bylanelet.leftBound() and how i can get access to position data associated with each of the Points ids.

Your help much appreciated.

Kind Regards, AJay