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

Function get_single_route

roach/utils/config_utils.py:105–128  ·  view source on GitHub ↗
(routes_xml_filename, route_id)

Source from the content-addressed store, hash-verified

103
104
105def get_single_route(routes_xml_filename, route_id):
106 tree = ET.parse(routes_xml_filename)
107 route = tree.find(f'.//route[@id="{route_id}"]')
108
109 route_dict = {}
110 for actor_type in ['ego_vehicle', 'scenario_actor']:
111 route_dict[actor_type+'s'] = {}
112 for actor in route.iter(actor_type):
113 actor_id = actor.attrib['id']
114
115 waypoint_list = [] # the list of waypoints that can be found on this route for this actor
116 for waypoint in actor.iter('waypoint'):
117 location = carla.Location(
118 x=float(waypoint.attrib['x']),
119 y=float(waypoint.attrib['y']),
120 z=float(waypoint.attrib['z']))
121 rotation = carla.Rotation(
122 roll=float(waypoint.attrib['roll']),
123 pitch=float(waypoint.attrib['pitch']),
124 yaw=float(waypoint.attrib['yaw']))
125 waypoint_list.append(carla.Transform(location, rotation))
126
127 route_dict[actor_type+'s'][actor_id] = waypoint_list
128 return route_dict
129
130
131def to_camel_case(snake_str, init_capital=False):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected