Skip to content

Commit

Permalink
add: colour attribute for speed cameras, remove: unneccessary timeste…
Browse files Browse the repository at this point in the history
…ps attributes for emission detection and stress detection, docs: updated all files to reflect changes in attributes
  • Loading branch information
vijay-jaisankar committed Jul 7, 2022
1 parent 40ac871 commit 31f901a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion docs/emission_junction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# Initialiasing the object
ej = trafficinterventions.EmissionJunction.EmissionJunction(
maxTimeSteps=1000, # Number of time steps, could be overridden by the system
pathCFG="map.sumocfg", # .sumocfg file path
outPath="Outputs/", # Output path for screenshots
pathNET="osm.net.xml", # .net.xml file path
Expand Down
3 changes: 2 additions & 1 deletion docs/speed_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
pathCFG="map.sumocfg", # Input file path
outPath="Outputs/", # Output file path (for screenshots)
summaryFilePath="summary.txt", # File which contains the appropriate positions - populated after the simulation
numLocs=5 # Number of locations you wish to retrieve
numLocs=5, # Number of locations you wish to retrieve
colour=(255,0,0) # Colour of the speed camera points
)

# Run the simulation and get outputs
Expand Down
1 change: 0 additions & 1 deletion docs/stress_junction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# Initialiasing the object
sj = trafficinterventions.StressJunction.StressJunction(
maxTimeSteps=1000, # Number of time steps, could be overridden by the system
weightsArray=[1,1,1,1,1], # Weights for the parameters - in the order of [haltingNumber, CO2Emissions, StepOccupancy, vehicleLength, waitingTime]
pathCFG="map.sumocfg", # .sumocfg file path
outPath="Outputs/", # Output path for screenshots
Expand Down
3 changes: 1 addition & 2 deletions src/trafficinterventions/EmissionJunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EmissionJunction:
"""
@Method: Initialising variables and config
"""
def __init__(self, maxTimeSteps, pathCFG, outPath, pathNET, pathSummaryFile, numLocs, initialPoiLocation = (5064.74,3568.48)):
def __init__(self, pathCFG, outPath, pathNET, pathSummaryFile, numLocs, initialPoiLocation = (5064.74,3568.48)):

# Check for Bash Shortcut
if "SUMO_HOME" in os.environ:
Expand All @@ -25,7 +25,6 @@ def __init__(self, maxTimeSteps, pathCFG, outPath, pathNET, pathSummaryFile, num
sys.exit("Please populate $SUMO_HOME in your .bashrc file.")

# Assign all variables
self.maxTimeSteps = maxTimeSteps
self.pathCFG = pathCFG
self.outPath = outPath
self.pathNET = pathNET
Expand Down
5 changes: 3 additions & 2 deletions src/trafficinterventions/SpeedCamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class SpeedCamera:
"""
@Method: Initialing variables and config
"""
def __init__(self, maxTimeSteps, nearestNeighbourDisallow, gridArray, pathCFG, outPath, summaryFilePath, numLocs):
def __init__(self, maxTimeSteps, nearestNeighbourDisallow, gridArray, pathCFG, outPath, summaryFilePath, numLocs, colour):

# Check for Bash Shortcut
if "SUMO_HOME" in os.environ:
Expand All @@ -139,6 +139,7 @@ def __init__(self, maxTimeSteps, nearestNeighbourDisallow, gridArray, pathCFG, o
self.outPath = outPath
self.summaryFilePath = summaryFilePath
self.numLocs = numLocs
self.colour = colour

# Option Parser
optParser = optparse.OptionParser()
Expand Down Expand Up @@ -217,7 +218,7 @@ def loop(self):
except Exception as e:
print(e)
self.previousPOI = []
traci.poi.add(poiID=nid, x = positionsList[i][0], y = positionsList[i][1], layer = 202.0, color = (255,0,0))
traci.poi.add(poiID=nid, x = positionsList[i][0], y = positionsList[i][1], layer = 202.0, color = self.colour)
traci.gui.toggleSelection(nid, objType='poi')
self.previousPOI.append(nid)

Expand Down
3 changes: 1 addition & 2 deletions src/trafficinterventions/StressJunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class StressJunction:
"""
@Method: Initialising variables and config
"""
def __init__(self, maxTimeSteps, weightsArray, pathCFG, outPath, pathNET, pathSummaryFile, numLocs, initialPoiLocation = (5064.74,3568.48)):
def __init__(self, weightsArray, pathCFG, outPath, pathNET, pathSummaryFile, numLocs, initialPoiLocation = (5064.74,3568.48)):

# Check for Bash Shortcut
if "SUMO_HOME" in os.environ:
Expand All @@ -80,7 +80,6 @@ def __init__(self, maxTimeSteps, weightsArray, pathCFG, outPath, pathNET, pathSu
sys.exit("Please populate $SUMO_HOME in your .bashrc file.")

# Assign all variables
self.maxTimeSteps = maxTimeSteps
self.weightsArray = weightsArray
self.pathCFG = pathCFG
self.outPath = outPath
Expand Down

0 comments on commit 31f901a

Please sign in to comment.