MCPcopy Create free account
hub / github.com/PJLab-ADG/OASim / Model

Class Model

limsim/simModel/egoTracking/model.py:31–626  ·  view source on GitHub ↗

egoID: id of ego car; netFile: network files, e.g. `example.net.xml`; rouFile: route files, e.g. `example.rou.xml`. if you have vehicle-type file as an input, define this parameter as `examplevTypes.rou.xml,example.rou.xml`; obseFile

Source from the content-addressed store, hash-verified

29
30
31class Model():
32 '''
33 egoID: id of ego car;
34 netFile: network files, e.g. `example.net.xml`;
35 rouFile: route files, e.g. `example.rou.xml`. if you have
36 vehicle-type file as an input, define this parameter as
37 `examplevTypes.rou.xml,example.rou.xml`;
38 obseFile: obstacle files, e.g. `example.obs.xml`;
39 dataBase: the name of the database, e.g. `example.db`. if it is not
40 specified, it will be named with the current timestamp.
41 SUMOGUI: boolean variable, used to determine whether to display the SUMO
42 graphical interface;
43 simNote: the simulation note information, which can be any information you
44 wish to record. For example, the version of your trajectory
45 planning algorithm, or the user name of this simulation.
46 '''
47
48 def __init__(self,
49 egoID: str,
50 netFile: str,
51 rouFile: str,
52 ctf: CoordTF,
53 widget: QGraphicsView,
54 obsFile: str = None,
55 dataBase: str = None,
56 SUMOGUI: int = 0,
57 simNote: str = None,
58 carla_cosim: bool = False) -> None:
59 print('[green bold]Model initialized at {}.[/green bold]'.format(
60 datetime.now().strftime('%H:%M:%S.%f')[:-3]))
61 self.netFile = netFile
62 self.rouFile = rouFile
63 self.obsFile = obsFile
64 self.SUMOGUI = SUMOGUI
65 self.sim_mode: str = 'RealTime'
66 self.timeStep = 0
67 # tpStart marks whether the trajectory planning is started,
68 # when the ego car appears in the network, tpStart turns into 1.
69 self.tpStart = 0
70 # tpEnd marks whether the trajectory planning is end,
71 # when the ego car leaves the network, tpEnd turns into 1.
72 self.tpEnd = 0
73 # need carla cosimulation
74 self.carla_cosim = carla_cosim
75
76 self.ego = egoCar(egoID)
77
78 if dataBase:
79 self.dataBase = dataBase
80 else:
81 self.dataBase = datetime.strftime(
82 datetime.now(), '%Y-%m-%d_%H-%M-%S') + '_egoTracking' + '.db'
83
84 self.createDatabase()
85 self.simDescriptionCommit(simNote)
86 self.dataQue = Queue()
87 self.createTimer()
88

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected