MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / parse_routes_file

Function parse_routes_file

roach/utils/config_utils.py:73–102  ·  view source on GitHub ↗
(routes_xml_filename)

Source from the content-addressed store, hash-verified

71
72
73def parse_routes_file(routes_xml_filename):
74 route_descriptions_dict = {}
75 tree = ET.parse(routes_xml_filename)
76
77 for route in tree.iter("route"):
78
79 route_id = int(route.attrib['id'])
80
81 route_descriptions_dict[route_id] = {}
82
83 for actor_type in ['ego_vehicle', 'scenario_actor']:
84 route_descriptions_dict[route_id][actor_type+'s'] = {}
85 for actor in route.iter(actor_type):
86 actor_id = actor.attrib['id']
87
88 waypoint_list = [] # the list of waypoints that can be found on this route for this actor
89 for waypoint in actor.iter('waypoint'):
90 location = carla.Location(
91 x=float(waypoint.attrib['x']),
92 y=float(waypoint.attrib['y']),
93 z=float(waypoint.attrib['z']))
94 rotation = carla.Rotation(
95 roll=float(waypoint.attrib['roll']),
96 pitch=float(waypoint.attrib['pitch']),
97 yaw=float(waypoint.attrib['yaw']))
98 waypoint_list.append(carla.Transform(location, rotation))
99
100 route_descriptions_dict[route_id][actor_type+'s'][actor_id] = waypoint_list
101
102 return route_descriptions_dict
103
104
105def get_single_route(routes_xml_filename, route_id):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected