Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
tum-cps
commonroad-sumo-interface
Commits
5f137045
Commit
5f137045
authored
May 19, 2021
by
Moritz Klischat
Browse files
unique names traci simulations
parent
ff6b02f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
sumocr/interface/sumo_simulation.py
View file @
5f137045
import
copy
import
logging
import
math
import
random
import
sys
import
time
from
collections
import
defaultdict
from
functools
import
lru_cache
from
typing
import
Dict
,
Union
...
...
@@ -40,7 +42,7 @@ __copyright__ = "TUM Cyber-Physical Systems Group"
__credits__
=
[
"ZIM Projekt ZF4086007BZ8"
]
__version__
=
"2021.1"
__maintainer__
=
"Moritz Klischat"
__email__
=
"commonroad
-i06@in.tum
.de"
__email__
=
"commonroad
@lists.lrz
.de"
__status__
=
"Released"
...
...
@@ -82,6 +84,7 @@ class SumoSimulation:
self
.
_lc_inaction
=
0
# Flag indicates that SUMO is performing a lane change for the ego
self
.
lateral_position_buffer
=
dict
()
# stores lateral position [ego_vehicle_id,float]
self
.
logger
:
logging
.
Logger
=
None
self
.
_traci_label
=
None
self
.
initialized
=
False
@
property
...
...
@@ -165,7 +168,7 @@ class SumoSimulation:
np
.
random
.
seed
(
self
.
conf
.
random_seed
)
cmd
.
extend
([
'--seed'
,
str
(
self
.
conf
.
random_seed
)])
traci
.
start
(
cmd
,
label
=
self
.
conf
.
scenario_name
)
traci
.
start
(
cmd
,
label
=
self
.
traci_label
)
# simulate until ego_time_start
self
.
__presimulation_silent
(
self
.
conf
.
presimulation_steps
)
...
...
@@ -259,6 +262,13 @@ class SumoSimulation:
self
.
_ego_vehicles
[
ego_vehicle
.
id
]
=
ego_vehicle
@
property
def
traci_label
(
self
):
"""Unique label to identify simulation"""
if
self
.
_traci_label
is
None
:
self
.
_traci_label
=
self
.
conf
.
scenario_name
+
time
.
strftime
(
"%H%M%S"
)
+
str
(
random
.
randint
(
0
,
100
))
return
self
.
_traci_label
@
property
def
ego_vehicles
(
self
)
->
Dict
[
int
,
EgoVehicle
]:
"""
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment