class_docstr: This class provides a very high level route plan.
class_docstr_tok: ["This","class","provides","a","very","high","level","route","plan","."]
docstr: This function retrieves topology from the server as a list of
  road segments as pairs of waypoint objects, and processes the
  topology into a list of dictionary objects with the following attributes
  
  - entry (carla.Waypoint): waypoint of entry point of road segment
  - entryxyz (tuple): (x,y,z) of entry point of road segment
  - exit (carla.Waypoint): waypoint of exit point of road segment
  - exitxyz (tuple): (x,y,z) of exit point of road segment
  - path (list of carla.Waypoint):  list of waypoints between entry to exit, separated by the resolution
docstr_tok: ["This","function","retrieves","topology","from","the","server","as","a","list","of","road","segments","as","pairs","of","waypoint","objects",",","and","processes","the","topology","into","a","list","of","dictionary","objects","with","the","following","attributes","-","entry","(","carla.Waypoint",")",":","waypoint","of","entry","point","of","road","segment","-","entryxyz","(","tuple",")",":","(","x",",","y",",","z",")","of","entry","point","of","road","segment","-","exit","(","carla.Waypoint",")",":","waypoint","of","exit","point","of","road","segment","-","exitxyz","(","tuple",")",":","(","x",",","y",",","z",")","of","exit","point","of","road","segment","-","path","(","list","of","carla.Waypoint",")",":","list","of","waypoints","between","entry","to","exit",",","separated","by","the","resolution"]
code: def _build_topology(self):
      """
      This function retrieves topology from the server as a list of
      road segments as pairs of waypoint objects, and processes the
      topology into a list of dictionary objects with the following attributes
  
      - entry (carla.Waypoint): waypoint of entry point of road segment
      - entryxyz (tuple): (x,y,z) of entry point of road segment
      - exit (carla.Waypoint): waypoint of exit point of road segment
      - exitxyz (tuple): (x,y,z) of exit point of road segment
      - path (list of carla.Waypoint):  list of waypoints between entry to exit, separated by the resolution
      """
      self._topology = []
      # Retrieving waypoints to construct a detailed topology
      for segment in self._wmap.get_topology():
          wp1, wp2 = segment[0], segment[1]
          l1, l2 = wp1.transform.location, wp2.transform.location
          # Rounding off to avoid floating point imprecision
          x1, y1, z1, x2, y2, z2 = np.round(
              [l1.x, l1.y, l1.z, l2.x, l2.y, l2.z], 0
          )
          wp1.transform.location, wp2.transform.location = l1, l2
          seg_dict = dict()
          seg_dict["entry"], seg_dict["exit"] = wp1, wp2
          seg_dict["entryxyz"], seg_dict["exitxyz"] = (x1, y1, z1), (
              x2,
              y2,
              z2,
          )
          seg_dict["path"] = []
          endloc = wp2.transform.location
          if (
              wp1.transform.location.distance(endloc)
              > self._sampling_resolution
          ):
              w = wp1.next(self._sampling_resolution)[0]
              while (
                  w.transform.location.distance(endloc)
                  > self._sampling_resolution
              ):
                  seg_dict["path"].append(w)
                  next_ws = w.next(self._sampling_resolution)
                  if len(next_ws) == 0:
                      break
                  w = next_ws[0]
          else:
              next_wps = wp1.next(self._sampling_resolution)
              if len(next_wps) == 0:
                  continue
              seg_dict["path"].append(next_wps[0])
          self._topology.append(seg_dict)
  
file_path: carla/PythonAPI/carla/agents/navigation/global_route_planner.py
imports: import math
  import numpy
  import networkx
  import carla
  from agents.navigation.local_planner import RoadOption
  from agents.tools.misc import vector
label_desc: Use image node_id 3 for calling the GlobalRoutePlanner obj's underlying member method code with example usage: obj._build_topology() without return types