Mercurial Hosting > traffic-intelligence
comparison python/tests/extrapolation.txt @ 256:dc1faa7287bd
added the normal adaptation class
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 24 Jul 2012 01:37:21 -0400 |
parents | 13ec22bec5d4 |
children |
comparison
equal
deleted
inserted
replaced
255:13ec22bec5d4 | 256:dc1faa7287bd |
---|---|
4 >>> et = extrapolation.ExtrapolatedTrajectoryConstant(moving.Point(0,0), moving.Point(1,0)) | 4 >>> et = extrapolation.ExtrapolatedTrajectoryConstant(moving.Point(0,0), moving.Point(1,0)) |
5 >>> et.predictPosition(4) # doctest:+ELLIPSIS | 5 >>> et.predictPosition(4) # doctest:+ELLIPSIS |
6 (0.0...,4.0...) | 6 (0.0...,4.0...) |
7 >>> et.predictPosition(1) # doctest:+ELLIPSIS | 7 >>> et.predictPosition(1) # doctest:+ELLIPSIS |
8 (0.0...,1.0...) | 8 (0.0...,1.0...) |
9 | |
10 >>> et = extrapolation.ExtrapolatedTrajectoryConstant(moving.Point(0,0), moving.Point(1,0), moving.NormAngle(0.1,0), maxSpeed = 2) | |
11 >>> et.predictPosition(10) # doctest:+ELLIPSIS | |
12 (0.0...,15.5...) | |
13 >>> et.predictPosition(11) # doctest:+ELLIPSIS | |
14 (0.0...,17.5...) | |
15 >>> et.predictPosition(12) # doctest:+ELLIPSIS | |
16 (0.0...,19.5...) | |
17 | |
18 >>> import random | |
19 >>> acceleration = lambda: random.uniform(-0.5,0.5) | |
20 >>> steering = lambda: random.uniform(-0.1,0.1) | |
21 >>> et = extrapolation.ExtrapolatedTrajectoryNormalAdaptation(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 |