Mercurial Hosting > traffic-intelligence
comparison python/events.py @ 881:8ba82b371eea
work on storing PET
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 14 Mar 2017 17:48:40 -0400 |
parents | 0e875a7f5759 |
children | 4749b71aa7fb |
comparison
equal
deleted
inserted
replaced
880:000555430b28 | 881:8ba82b371eea |
---|---|
61 'Velocity Angle', | 61 'Velocity Angle', |
62 'Speed Differential', | 62 'Speed Differential', |
63 'Collision Probability', | 63 'Collision Probability', |
64 'Time to Collision', # 7 | 64 'Time to Collision', # 7 |
65 'Probability of Successful Evasive Action', | 65 'Probability of Successful Evasive Action', |
66 'predicted Post Encroachment Time'] | 66 'predicted Post Encroachment Time', |
67 'Post Encroachment Time'] | |
67 | 68 |
68 indicatorNameToIndices = utils.inverseEnumeration(indicatorNames) | 69 indicatorNameToIndices = utils.inverseEnumeration(indicatorNames) |
69 | 70 |
70 indicatorShortNames = ['CCDP', | 71 indicatorShortNames = ['CCDP', |
71 'CCA', | 72 'CCA', |
74 'VA', | 75 'VA', |
75 'SD', | 76 'SD', |
76 'PoC', | 77 'PoC', |
77 'TTC', | 78 'TTC', |
78 'P(SEA)', | 79 'P(SEA)', |
79 'pPET'] | 80 'pPET', |
81 'PET'] | |
80 | 82 |
81 indicatorUnits = ['', | 83 indicatorUnits = ['', |
82 'rad', | 84 'rad', |
83 'm', | 85 'm', |
84 'm', | 86 'm', |
85 'rad', | 87 'rad', |
86 'm/s', | 88 'm/s', |
87 '', | 89 '', |
88 's', | 90 's', |
89 '', | 91 '', |
90 ''] | 92 's', |
93 's'] | |
91 | 94 |
92 timeIndicators = ['Time to Collision', 'predicted Post Encroachment Time'] | 95 timeIndicators = ['Time to Collision', 'predicted Post Encroachment Time'] |
93 | 96 |
94 def __init__(self, num = None, timeInterval = None, roaduserNum1 = None, roaduserNum2 = None, roadUser1 = None, roadUser2 = None, categoryNum = None): | 97 def __init__(self, num = None, timeInterval = None, roaduserNum1 = None, roaduserNum2 = None, roadUser1 = None, roadUser2 = None, categoryNum = None): |
95 moving.STObject.__init__(self, num, timeInterval) | 98 moving.STObject.__init__(self, num, timeInterval) |
233 self.addIndicator(indicators.SeverityIndicator(Interaction.indicatorNames[9], pPETs, mostSevereIsMax=False)) | 236 self.addIndicator(indicators.SeverityIndicator(Interaction.indicatorNames[9], pPETs, mostSevereIsMax=False)) |
234 # TODO add probability of collision, and probability of successful evasive action | 237 # TODO add probability of collision, and probability of successful evasive action |
235 | 238 |
236 def computePET(self, collisionDistanceThreshold): | 239 def computePET(self, collisionDistanceThreshold): |
237 # TODO add crossing zone | 240 # TODO add crossing zone |
238 self.pet = moving.MovingObject.computePET(self.roadUser1, self.roadUser2, collisionDistanceThreshold) | 241 pet = moving.MovingObject.computePET(self.roadUser1, self.roadUser2, collisionDistanceThreshold) |
242 if pet is not None: # TODO get crossing zone and time | |
243 self.addIndicator(indicators.SeverityIndicator(Interaction.indicatorNames[10], {0: pet}, mostSevereIsMax = False | |
239 | 244 |
240 def setCollision(self, collision): | 245 def setCollision(self, collision): |
241 '''indicates if it is a collision: argument should be boolean''' | 246 '''indicates if it is a collision: argument should be boolean''' |
242 self.collision = collision | 247 self.collision = collision |
243 | 248 |