diff trafficintelligence/tests/events.txt @ 1269:ca70a79688ae

adding a speed threshold to avoid computing TTC at very low speeds
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 05 Jun 2024 10:12:43 -0400
parents ad60e5adf084
children 9f1711a85c56
line wrap: on
line diff
--- a/trafficintelligence/tests/events.txt	Fri May 31 16:52:51 2024 -0400
+++ b/trafficintelligence/tests/events.txt	Wed Jun 05 10:12:43 2024 -0400
@@ -52,6 +52,22 @@
 >>> inter.getIndicator(Interaction.indicatorNames[1])[6] # doctest:+ELLIPSIS
 3.1415...
 
+# test low speed
+>>> inter = Interaction(roadUser1 = o1, roadUser2 = o2)
+>>> inter.computeIndicators()
+>>> predictionParams = ConstantPredictionParameters()
+>>> inter.computeCrossingsCollisions(predictionParams, 0.1, 10, speedThreshold = 1.)
+>>> inter.getIndicator("Time to Collision") is None
+True
+
+# 0 speed users
+>>> inter = Interaction(roadUser1 = MovingObject.generate(1, Point(-5.,0.), Point(0.,0.), TimeInterval(0,10)), roadUser2 = MovingObject.generate(2, Point(0.,-5.), Point(0.,0.), TimeInterval(0,10)))
+>>> inter.computeIndicators()
+>>> predictionParams = ConstantPredictionParameters()
+>>> inter.computeCrossingsCollisions(predictionParams, 0.1, 10)
+>>> inter.getIndicator("Time to Collision") is None
+True
+
 # test categorize
 >>> from collections import Counter
 >>> from numpy import pi