Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/tests/prediction.txt @ 1030:aafbc0bab925
moved method around to avoid cross-dependencies
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 19 Jun 2018 10:04:52 -0400 |
parents | cc5cb04b04b0 |
children | a095d4fbb2ea |
comparison
equal
deleted
inserted
replaced
1029:c6cf75a2ed08 | 1030:aafbc0bab925 |
---|---|
1 >>> from prediction import * | 1 >>> from trafficintelligence.prediction import * |
2 >>> import moving, storage, utils | 2 >>> from trafficintelligence import moving, storage, utils |
3 >>> from numpy import absolute, array | 3 >>> from numpy import absolute, array, max |
4 | 4 |
5 >>> et = PredictedTrajectoryConstant(moving.Point(0,0), moving.Point(1,0)) | 5 >>> et = PredictedTrajectoryConstant(moving.Point(0,0), moving.Point(1,0)) |
6 >>> et.predictPosition(4) # doctest:+ELLIPSIS | 6 >>> et.predictPosition(4) # doctest:+ELLIPSIS |
7 (4.0...,0.0...) | 7 (4.0...,0.0...) |
8 >>> et.predictPosition(1) # doctest:+ELLIPSIS | 8 >>> et.predictPosition(1) # doctest:+ELLIPSIS |
19 >>> import random | 19 >>> import random |
20 >>> acceleration = lambda: random.uniform(-0.5,0.5) | 20 >>> acceleration = lambda: random.uniform(-0.5,0.5) |
21 >>> steering = lambda: random.uniform(-0.1,0.1) | 21 >>> steering = lambda: random.uniform(-0.1,0.1) |
22 >>> et = PredictedTrajectoryRandomControl(moving.Point(0,0),moving.Point(1,1), acceleration, steering, maxSpeed = 2) | 22 >>> et = PredictedTrajectoryRandomControl(moving.Point(0,0),moving.Point(1,1), acceleration, steering, maxSpeed = 2) |
23 >>> p = et.predictPosition(500) | 23 >>> p = et.predictPosition(500) |
24 >>> from numpy import max | |
25 >>> max(et.getPredictedSpeeds()) <= 2. | 24 >>> max(et.getPredictedSpeeds()) <= 2. |
26 True | 25 True |
27 | 26 |
28 >>> p = moving.Point(3,4) | 27 >>> p = moving.Point(3,4) |
29 >>> sp = SafetyPoint(p, 0.1, 0) | 28 >>> sp = SafetyPoint(p, 0.1, 0) |