Mercurial Hosting > traffic-intelligence
diff python/tests/prediction.txt @ 662:72174e66aba5
corrected bug that increased TTC by 1 frame and structure to store collision points and crossing zones
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 18 May 2015 17:17:06 +0200 |
parents | e891a41c6c75 |
children | c5191acb025f |
line wrap: on
line diff
--- a/python/tests/prediction.txt Mon May 18 13:53:25 2015 +0200 +++ b/python/tests/prediction.txt Mon May 18 17:17:06 2015 +0200 @@ -1,13 +1,13 @@ ->>> import prediction +>>> from prediction import * >>> import moving ->>> et = prediction.PredictedTrajectoryConstant(moving.Point(0,0), moving.Point(1,0)) +>>> et = PredictedTrajectoryConstant(moving.Point(0,0), moving.Point(1,0)) >>> et.predictPosition(4) # doctest:+ELLIPSIS (4.0...,0.0...) >>> et.predictPosition(1) # doctest:+ELLIPSIS (1.0...,0.0...) ->>> et = prediction.PredictedTrajectoryConstant(moving.Point(0,0), moving.Point(1,0), moving.NormAngle(0.1,0), maxSpeed = 2) +>>> et = PredictedTrajectoryConstant(moving.Point(0,0), moving.Point(1,0), moving.NormAngle(0.1,0), maxSpeed = 2) >>> et.predictPosition(10) # doctest:+ELLIPSIS (15.5...,0.0...) >>> et.predictPosition(11) # doctest:+ELLIPSIS @@ -18,13 +18,29 @@ >>> import random >>> acceleration = lambda: random.uniform(-0.5,0.5) >>> steering = lambda: random.uniform(-0.1,0.1) ->>> et = prediction.PredictedTrajectoryRandomControl(moving.Point(0,0),moving.Point(1,1), acceleration, steering, maxSpeed = 2) +>>> et = PredictedTrajectoryRandomControl(moving.Point(0,0),moving.Point(1,1), acceleration, steering, maxSpeed = 2) >>> p = et.predictPosition(500) >>> from numpy import max >>> max(et.getPredictedSpeeds()) <= 2. True >>> p = moving.Point(3,4) ->>> sp = prediction.SafetyPoint(p, 0.1, 0) +>>> sp = SafetyPoint(p, 0.1, 0) >>> print(sp) 3 4 0.1 0 + +>>> et1 = PredictedTrajectoryConstant(moving.Point(-5.,0.), moving.Point(1.,0.)) +>>> et2 = PredictedTrajectoryConstant(moving.Point(0.,-5.), moving.Point(0.,1.)) +>>> collision, t, cp1, cp2 = computeCollisionTime(et1, et2, 0.1, 10) +>>> collision +True +>>> t +5 +>>> collision, t, cp1, cp2 = computeCollisionTime(et1, et2, 0.1, 5) +>>> collision +True +>>> t +5 +>>> collision, t, cp1, cp2 = computeCollisionTime(et1, et2, 0.1, 4) +>>> collision +False