comparison python/traffic_engineering.py @ 302:9d88a4d97473

corrected bug in compute-homography
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 18 Mar 2013 23:37:45 -0400
parents f65b828e5521
children 539e2b4cfaa3
comparison
equal deleted inserted replaced
301:27f06d28036d 302:9d88a4d97473
1 #! /usr/bin/env python 1 #! /usr/bin/env python
2 ''' Traffic Engineering Tools and Examples''' 2 ''' Traffic Engineering Tools and Examples'''
3 3
4 from math import ceil 4 from math import ceil
5 5
6 import prediction
7
6 __metaclass__ = type 8 __metaclass__ = type
7 9
8 10
9 ######################### 11 #########################
10 # Simulation 12 # Simulation
11 ######################### 13 #########################
12 14
13 class Vehicle: 15 class Vehicle:
14 'Generic vehicle class 16 '''Generic vehicle class
15 1D coordinates for now' 17 1D coordinates for now'''
16 class PredictedTrajectory1D(prediction.PredictedTrajectory): 18 class PredictedTrajectory1D(prediction.PredictedTrajectory):
17 def __init__(self, initialPosition, initialSpeed, control, maxSpeed = None): 19 def __init__(self, initialPosition, initialSpeed, control, maxSpeed = None):
18 self.control = control 20 self.control = control
19 self.maxSpeed = maxSpeed 21 self.maxSpeed = maxSpeed
20 self.probability = None 22 self.probability = None
157 self.types = types 159 self.types = types
158 self.proportions = proportions 160 self.proportions = proportions
159 self.equivalents = equivalents 161 self.equivalents = equivalents
160 self.nLanes = nLanes # unused 162 self.nLanes = nLanes # unused
161 else: 163 else:
164 print('Proportions do not sum to 1')
162 pass 165 pass
163 166
164 def getPCUVolume(self): 167 def getPCUVolume(self):
165 '''Returns the passenger-car equivalent for the input volume''' 168 '''Returns the passenger-car equivalent for the input volume'''
166 v = 0 169 v = 0