Skip to content

Commit

Permalink
runner.py: sumo tools creates vehicle ID as a float point number
Browse files Browse the repository at this point in the history
So let's remove the float point number
  • Loading branch information
ramonfontes committed Mar 27, 2022
1 parent a2f42f1 commit d57c3d7
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions mn_wifi/sumo/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ def start(self, cars, config_file, clients, port,
x1 = vehCmds.getPosition(vehID1)[0]
y1 = vehCmds.getPosition(vehID1)[1]

if int(vehID1) < len(cars):
cars[int(vehID1)].position = x1, y1, 0
cars[int(vehID1)].set_pos_wmediumd(cars[int(vehID1)].position)

if hasattr(cars[int(vehID1)], 'sumo'):
if cars[int(vehID1)].sumo:
args = [cars[int(vehID1)].sumoargs]
cars[int(vehID1)].sumo(vehID1, vehCmds, *args)
del cars[int(vehID1)].sumo
vehID = int(vehID1.replace('.0',''))
if vehID < len(cars):
cars[vehID].position = x1, y1, 0
cars[vehID].set_pos_wmediumd(cars[vehID].position)

if hasattr(cars[vehID], 'sumo'):
if cars[vehID].sumo:
args = [cars[vehID].sumoargs]
cars[vehID].sumo(vehID, vehCmds, *args)
del cars[vehID].sumo

0 comments on commit d57c3d7

Please sign in to comment.