(routes_xml_filename)
| 71 | |
| 72 | |
| 73 | def 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 | |
| 105 | def get_single_route(routes_xml_filename, route_id): |
nothing calls this directly
no outgoing calls
no test coverage detected