Mercurial > hg > nsaunier > traffic-intelligence
comparison trafficintelligence/events.py @ 1157:173b7926734e
clarifying categorize method
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 21 Oct 2020 10:38:30 -0400 |
| parents | 658f87232536 |
| children | b968c33f8c2f |
comparison
equal
deleted
inserted
replaced
| 1156:f7fbe624fff7 | 1157:173b7926734e |
|---|---|
| 222 minDistances[instant] = moving.MovingObject.minDistance(self.roadUser1, self.roadUser2, instant) | 222 minDistances[instant] = moving.MovingObject.minDistance(self.roadUser1, self.roadUser2, instant) |
| 223 self.addIndicator(indicators.SeverityIndicator(Interaction.indicatorNames[3], minDistances, mostSevereIsMax = False)) | 223 self.addIndicator(indicators.SeverityIndicator(Interaction.indicatorNames[3], minDistances, mostSevereIsMax = False)) |
| 224 | 224 |
| 225 def categorize(self, velocityAngleTolerance, parallelAngleTolerance, headonCollisionCourseAngleTolerance = None): | 225 def categorize(self, velocityAngleTolerance, parallelAngleTolerance, headonCollisionCourseAngleTolerance = None): |
| 226 '''Computes the interaction category by instant | 226 '''Computes the interaction category by instant |
| 227 velocityAngleTolerance and parallelAngleTolerance in radian | 227 all 3 angle arguments in radian |
| 228 velocityAngleTolerance: indicates the angle threshold for rear and head on (180-velocityAngleTolerance), as well as the maximum collision course angle for head on | 228 velocityAngleTolerance: indicates the angle threshold for rear and head on (180-velocityAngleTolerance), as well as the maximum collision course angle for head on (if headonCollisionCourseAngleTolerance is None) |
| 229 velocityAngleTolerance: indicates the angle between velocity vector (average for parallel) and position vector''' | 229 parallelAngleTolerance: indicates the angle between velocity vector (average for parallel) and position vector |
| 230 | |
| 231 an instant may not be categorized if it matches the side definition (angle) | |
| 232 but the distance is growing (at least one user is probably past the point of trajectory crossing)''' | |
| 230 parallelAngleToleranceCosine = np.cos(parallelAngleTolerance) | 233 parallelAngleToleranceCosine = np.cos(parallelAngleTolerance) |
| 231 if headonCollisionCourseAngleTolerance is None: | 234 if headonCollisionCourseAngleTolerance is None: |
| 232 headonCollisionCourseAngleTolerance = velocityAngleTolerance | 235 headonCollisionCourseAngleTolerance = velocityAngleTolerance |
| 233 | 236 |
| 234 self.categories = {} | 237 self.categories = {} |
