localPos: position of the local area, e.g. (1003.34, 998.63); radius: radius of the local are, e.g. 50; 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 th
| 18 | |
| 19 | |
| 20 | class Model: |
| 21 | ''' |
| 22 | localPos: position of the local area, e.g. (1003.34, 998.63); |
| 23 | radius: radius of the local are, e.g. 50; |
| 24 | netFile: network files, e.g. `example.net.xml`; |
| 25 | rouFile: route files, e.g. `example.rou.xml`. if you have |
| 26 | vehicle-type file as an input, define this parameter as |
| 27 | `examplevTypes.rou.xml,example.rou.xml`; |
| 28 | obseFile: obstacle files, e.g. `example.obs.xml`; |
| 29 | dataBase: the name of the database, e.g. `example.db`. if it is not |
| 30 | specified, it will be named with the current timestamp. |
| 31 | SUMOGUI: boolean variable, used to determine whether to display the SUMO |
| 32 | graphical interface; |
| 33 | simNote: the simulation note information, which can be any information you |
| 34 | wish to record. For example, the version of your trajectory |
| 35 | planning algorithm, or the user name of this simulation. |
| 36 | ''' |
| 37 | |
| 38 | def __init__(self, |
| 39 | localPos: tuple[float], |
| 40 | radius: float, |
| 41 | netFile: str, |
| 42 | rouFile: str, |
| 43 | obsFile: str = None, |
| 44 | dataBase: str = None, |
| 45 | SUMOGUI: bool = 1, |
| 46 | simNote: str = None |
| 47 | ) -> None: |
| 48 | self.netFile = netFile |
| 49 | self.rouFile = rouFile |
| 50 | self.obsFile = obsFile |
| 51 | self.SUMOGUI = SUMOGUI |
| 52 | self.sim_mode: str = 'RealTime' |
| 53 | self.timeStep = 0 |
| 54 | |
| 55 | self.dv = DummyVehicle(localPos[0], localPos[1], radius) |
| 56 | |
| 57 | if dataBase: |
| 58 | self.dataBase = dataBase |
| 59 | else: |
| 60 | self.dataBase = datetime.strftime( |
| 61 | datetime.now(), '%Y-%m-%d_%H-%M-%S' |
| 62 | ) + '_fixedScene' + '.db' |
| 63 | |
| 64 | self.createDatabase() |
| 65 | self.simDescriptionCommit(simNote) |
| 66 | self.dataQue = Queue() |
| 67 | self.createTimer() |
| 68 | |
| 69 | self.nb = NetworkBuild(self.dataBase, netFile, obsFile) |
| 70 | self.nb.getData() |
| 71 | self.nb.buildTopology() |
| 72 | self.ls = LocalScene(self.nb, self.dv) |
| 73 | |
| 74 | self.allvTypes = None |
| 75 | |
| 76 | self.gui = GUI('real-time-local') |
| 77 |
no outgoing calls
no test coverage detected