Mercurial Hosting > traffic-intelligence
comparison python/extrapolation.py @ 243:e0988a8ace0c
started adapting and moving to other modules Mohamed's work
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 16 Jul 2012 04:57:35 -0400 |
parents | d2b68111f87e |
children | 5027c174ab90 |
comparison
equal
deleted
inserted
replaced
242:942455aff829 | 243:e0988a8ace0c |
---|---|
1 ########## | 1 #! /usr/bin/env python |
2 # Extrapolation Hypothesis | 2 '''Library for moving object extrapolation hypotheses''' |
3 ########## | |
4 | 3 |
5 import sys | 4 import sys |
6 | 5 |
7 sys.path.append("G:/0-phdstart/Code/traffic-intelligence1/python") | |
8 | |
9 import moving | 6 import moving |
10 | 7 |
11 #Default values | 8 # Default values: to remove because we cannot tweak that from a script where the value may be different |
12 FPS= 25 # No. of frame per second (FPS) | 9 FPS= 25 # No. of frame per second (FPS) |
13 vLimit= 25/FPS #assume limit speed is 90km/hr = 25 m/sec | 10 vLimit= 25/FPS #assume limit speed is 90km/hr = 25 m/sec |
14 deltaT= FPS*5 # extrapolatation time Horizon = 5 second | 11 deltaT= FPS*5 # extrapolatation time Horizon = 5 second |
15 | 12 |
16 def ExtrapolationPosition (movingObject1, instant,deltaT): | |
17 ''' extrapolation hypothesis: constant velocity''' | |
18 return movingObject1.getPositionAtInstant(instant) + movingObject1.getVelocityAtInstant(instant). multiply(deltaT) | |
19 | |
20 def motion (position, velocity, acceleration): | 13 def motion (position, velocity, acceleration): |
21 ''' extrapolation hypothesis: constant acceleration''' | 14 ''' extrapolation hypothesis: constant acceleration''' |
22 from math import atan2,cos,sin | 15 from math import atan2,cos,sin |
23 vInit= velocity | 16 vInit= velocity |
24 vInitial= velocity.norm2() | 17 vInitial= velocity.norm2() |