comparison scripts/safety-analysis.py @ 533:e37f38274d4f

fixed compiling issue with size()
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sun, 29 Jun 2014 14:27:18 -0400
parents 000bddf84ad0
children 95276d310972
comparison
equal deleted inserted replaced
532:018653d1db3c 533:e37f38274d4f
1 #! /usr/bin/env python 1 #! /usr/bin/env python
2 2
3 import utils, storage, prediction, events, moving 3 import storage, prediction, events, moving
4 4
5 import sys, argparse, random 5 import sys, argparse, random
6 6
7 import matplotlib.pyplot as plt 7 import matplotlib.pyplot as plt
8 import numpy as np 8 import numpy as np
14 parser.add_argument('--cfg', dest = 'configFilename', help = 'name of the configuration file', required = True) 14 parser.add_argument('--cfg', dest = 'configFilename', help = 'name of the configuration file', required = True)
15 parser.add_argument('--prediction-method', dest = 'predictionMethod', help = 'prediction method (constant velocity (vector computation), constant velocity, normal adaptation, point set prediction)', choices = ['cvd', 'cv', 'na', 'ps']) 15 parser.add_argument('--prediction-method', dest = 'predictionMethod', help = 'prediction method (constant velocity (vector computation), constant velocity, normal adaptation, point set prediction)', choices = ['cvd', 'cv', 'na', 'ps'])
16 parser.add_argument('--display-cp', dest = 'displayCollisionPoints', help = 'display collision points', action = 'store_true') 16 parser.add_argument('--display-cp', dest = 'displayCollisionPoints', help = 'display collision points', action = 'store_true')
17 args = parser.parse_args() 17 args = parser.parse_args()
18 18
19 params = utils.TrackingParameters() 19 params = storage.TrackingParameters()
20 params.loadConfigFile(args.configFilename) 20 params.loadConfigFile(args.configFilename)
21 21
22 # parameters for prediction methods 22 # parameters for prediction methods
23 if args.predictionMethod: 23 if args.predictionMethod:
24 predictionMethod = args.predictionMethod 24 predictionMethod = args.predictionMethod
26 predictionMethod = params.predictionMethod 26 predictionMethod = params.predictionMethod
27 27
28 accelerationDistribution = lambda: random.triangular(-params.maxNormalAcceleration, params.maxNormalAcceleration, 0.) 28 accelerationDistribution = lambda: random.triangular(-params.maxNormalAcceleration, params.maxNormalAcceleration, 0.)
29 steeringDistribution = lambda: random.triangular(-params.maxNormalSteering, params.maxNormalSteering, 0.) 29 steeringDistribution = lambda: random.triangular(-params.maxNormalSteering, params.maxNormalSteering, 0.)
30 30
31 if predictionMethod == 'cvd': 31 if predictionMethod == 'cvd': # TODO add cve: constant velocity exact (Sohail's)
32 predictionParameters = prediction.CVDirectPredictionParameters() 32 predictionParameters = prediction.CVDirectPredictionParameters()
33 elif predictionMethod == 'cv': 33 elif predictionMethod == 'cv':
34 predictionParameters = prediction.ConstantPredictionParameters(params.maxPredictedSpeed) 34 predictionParameters = prediction.ConstantPredictionParameters(params.maxPredictedSpeed)
35 elif predictionMethod == 'na': 35 elif predictionMethod == 'na':
36 predictionParameters = prediction.NormalAdaptationPredictionParameters(params.maxPredictedSpeed, 36 predictionParameters = prediction.NormalAdaptationPredictionParameters(params.maxPredictedSpeed,