Open asafDahan opened 1 year ago
You can retrieve the lane connector from the map-api with the provided id. The lane connector object should contain localization information, e.g. in the polygon.
Best Daniel
Thanks for your quick reply. Do you have any idea, why is the following code retrieves only Nones as the LaneConnectors?
log_db_files = discover_log_dbs(NUPLAN_DB_FILES)
scenario_type_token_map = get_scenario_type_token_map(log_db_files)
log_db_file, token = scenario_type_token_map['on_traffic_light_intersection'][0]
scenario = get_default_scenario_from_token(NUPLAN_DATA_ROOT, log_db_file, token, NUPLAN_MAPS_ROOT, NUPLAN_MAP_VERSION)
for iter in range(scenario.get_number_of_iterations()):
tl_status_at_iter = list(scenario.get_traffic_light_status_at_iteration(iteration=iter))
for tl_status in tl_status_at_iter:
a = scenario.map_api.get_map_object(tl_status.lane_connector_id, SemanticMapLayer.LANE_CONNECTOR)
if a is not None:
print(a)
That's strange. As far as I can tell, your code should work. Maybe the id requires casting to str()
before using it with the map-api, as done here in the IDM planner.
That worked! Thank you very much :)!
I was following https://github.com/motional/nuplan-devkit/issues/71#issuecomment-1171226958 way of thought to receive the traffic light location.
But on the last phase, when trying to check which of the traffic lights indicated using the stopline has the relevant lane connector, I see that I cannot load a traffic element object because scenario.map_api.get_available_map_objects() does not contain SemanticMapLayer.Traffic_light. Is there another way to get the information of the traffic light based on it's ID?
I'ml wish to retrieve the following values: https://github.com/motional/nuplan-devkit/issues/71#issuecomment-1173888000
Exploring the code I see that Traffic light status contains the TrafficLightStatusType, lane_connector_id and timestamp:
Is there anywhere in the map a localization information of traffic lights (World/Ego vehicle coordinates)?
Thanks in advance