Mercurial Hosting > traffic-intelligence
comparison python/tests/prediction.txt @ 271:bbd9c09e6869
changed the names to prediction methods and predicted trajectories
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 09 Aug 2012 15:18:20 -0400 |
parents | python/tests/extrapolation.txt@dc1faa7287bd |
children | e56c34c1ebac |
comparison
equal
deleted
inserted
replaced
270:05c9b0cb8202 | 271:bbd9c09e6869 |
---|---|
1 >>> import prediction | |
2 >>> import moving | |
3 | |
4 >>> et = prediction.PredictedTrajectoryConstant(moving.Point(0,0), moving.Point(1,0)) | |
5 >>> et.predictPosition(4) # doctest:+ELLIPSIS | |
6 (4.0...,0.0...) | |
7 >>> et.predictPosition(1) # doctest:+ELLIPSIS | |
8 (1.0...,0.0...) | |
9 | |
10 >>> et = prediction.PredictedTrajectoryConstant(moving.Point(0,0), moving.Point(1,0), moving.NormAngle(0.1,0), maxSpeed = 2) | |
11 >>> et.predictPosition(10) # doctest:+ELLIPSIS | |
12 (15.5...,0.0...) | |
13 >>> et.predictPosition(11) # doctest:+ELLIPSIS | |
14 (17.5...,0.0...) | |
15 >>> et.predictPosition(12) # doctest:+ELLIPSIS | |
16 (19.5...,0.0...) | |
17 | |
18 >>> import random | |
19 >>> acceleration = lambda: random.uniform(-0.5,0.5) | |
20 >>> steering = lambda: random.uniform(-0.1,0.1) | |
21 >>> et = prediction.PredictedTrajectoryNormalAdaptation(moving.Point(0,0),moving.Point(1,1), acceleration, steering, maxSpeed = 2) | |
22 >>> p = et.predictPosition(500) | |
23 >>> from numpy import max | |
24 >>> max(et.getPredictedSpeeds()) <= 2. | |
25 True |