Mercurial > hg > nsaunier > traffic-intelligence
comparison python/prediction.py @ 470:a84b9ba9631f
small progress
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Tue, 11 Mar 2014 23:50:15 -0400 |
| parents | 08b67c9baca2 |
| children | 6464e4f0cc26 |
comparison
equal
deleted
inserted
replaced
| 467:08b67c9baca2 | 470:a84b9ba9631f |
|---|---|
| 63 self.prototypeTrajectory = prototypeTrajectory | 63 self.prototypeTrajectory = prototypeTrajectory |
| 64 self.constantSpeed = constantSpeed | 64 self.constantSpeed = constantSpeed |
| 65 self.probability = probability | 65 self.probability = probability |
| 66 self.predictedPositions = {0: initialPosition} | 66 self.predictedPositions = {0: initialPosition} |
| 67 self.predictedSpeedOrientations = {0: moving.NormAngle.fromPoint(initialVelocity)} | 67 self.predictedSpeedOrientations = {0: moving.NormAngle.fromPoint(initialVelocity)} |
| 68 | |
| 69 def predictPosition(self, nTimeSteps): | |
| 70 if nTimeSteps > 0 and not nTimeSteps in self.predictedPositions.keys(): | |
| 71 if constantSpeed: | |
| 72 # calculate cumulative distance | |
| 73 pass | |
| 74 else: # see c++ code, calculate ratio | |
| 75 pass | |
| 76 return self.predictedPositions[nTimeSteps] | |
| 68 | 77 |
| 69 class PredictedTrajectoryRandomControl(PredictedTrajectory): | 78 class PredictedTrajectoryRandomControl(PredictedTrajectory): |
| 70 '''Random vehicle control: suitable for normal adaptation''' | 79 '''Random vehicle control: suitable for normal adaptation''' |
| 71 def __init__(self, initialPosition, initialVelocity, accelerationDistribution, steeringDistribution, probability = 1., maxSpeed = None): | 80 def __init__(self, initialPosition, initialVelocity, accelerationDistribution, steeringDistribution, probability = 1., maxSpeed = None): |
| 72 '''Constructor | 81 '''Constructor |
