[SUMO co-simulation] Fixed computing not allowed routes (#3129)
* Fixed bug computing not allowed routes * Removed trailing spaces Co-authored-by: bernat <bernatx@gmail.com>
This commit is contained in:
parent
245cd0abe9
commit
aeb30d6b5a
|
@ -1,6 +1,7 @@
|
||||||
## Latest
|
## Latest
|
||||||
|
|
||||||
* Upgraded to AD RSS v4.0.1 supporting unstructured scenes and pedestrians, and fixed spdlog to v1.7.0
|
* Fixed a bug in `spawn_npc_sumo` script computing not allowed routes for a given vehicle class
|
||||||
|
* Upgraded to AD RSS v4.0.1 supporting unstructured scenes and pedestrians
|
||||||
* Fixed a bug where `get_traffic_light` would always return `None`
|
* Fixed a bug where `get_traffic_light` would always return `None`
|
||||||
* Changed frozen behavior for traffic lights. It now affects to all traffic lights at the same time
|
* Changed frozen behavior for traffic lights. It now affects to all traffic lights at the same time
|
||||||
* Added API function `freeze_all_traffic_lights` and `reset_group`
|
* Added API function `freeze_all_traffic_lights` and `reset_group`
|
||||||
|
|
|
@ -161,8 +161,11 @@ def main(args):
|
||||||
sumo_edges = sumo_net.getEdges()
|
sumo_edges = sumo_net.getEdges()
|
||||||
|
|
||||||
for i in range(args.number_of_vehicles):
|
for i in range(args.number_of_vehicles):
|
||||||
edge = random.choice(sumo_edges)
|
|
||||||
type_id = random.choice(blueprints)
|
type_id = random.choice(blueprints)
|
||||||
|
vclass = vtypes[type_id]['vClass']
|
||||||
|
|
||||||
|
allowed_edges = [e for e in sumo_edges if e.allows(vclass)]
|
||||||
|
edge = random.choice(allowed_edges)
|
||||||
|
|
||||||
traci.route.add('route_{}'.format(i), [edge.getID()])
|
traci.route.add('route_{}'.format(i), [edge.getID()])
|
||||||
traci.vehicle.add('sumo_{}'.format(i), 'route_{}'.format(i), typeID=type_id)
|
traci.vehicle.add('sumo_{}'.format(i), 'route_{}'.format(i), typeID=type_id)
|
||||||
|
|
Loading…
Reference in New Issue