diff scripts/safety-analysis.py @ 939:a2f3f3ca241e

work in progress
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 17 Jul 2017 17:56:52 -0400
parents 063d1267585d
children b1e8453c207c
line wrap: on
line diff
--- a/scripts/safety-analysis.py	Mon Jul 17 16:11:18 2017 -0400
+++ b/scripts/safety-analysis.py	Mon Jul 17 17:56:52 2017 -0400
@@ -14,7 +14,8 @@
 parser.add_argument('--cfg', dest = 'configFilename', help = 'name of the configuration file', required = True)
 parser.add_argument('-n', dest = 'nObjects', help = 'number of objects to analyse', type = int)
 # TODO analyze only 
-parser.add_argument('--prediction-method', dest = 'predictionMethod', help = 'prediction method (constant velocity (cvd: vector computation (approximate); cve: equation solving; cv: discrete time (approximate)), normal adaptation, point set prediction)', choices = ['cvd', 'cve', 'cv', 'na', 'ps'])
+parser.add_argument('--prediction-method', dest = 'predictionMethod', help = 'prediction method (constant velocity (cvd: vector computation (approximate); cve: equation solving; cv: discrete time (approximate)), normal adaptation, point set prediction)', choices = ['cvd', 'cve', 'cv', 'na', 'ps', 'proto'])
+parser.add_argument('--cfg', dest = 'prototypeDatabaseFilename', help = 'name of the database containing the prototypes')
 parser.add_argument('--pet', dest = 'computePET', help = 'computes PET', action = 'store_true')
 parser.add_argument('--display-cp', dest = 'displayCollisionPoints', help = 'display collision points', action = 'store_true')
 parser.add_argument('--nthreads', dest = 'nProcesses', help = 'number of processes to run in parallel', type = int, default = 1)
@@ -47,6 +48,10 @@
                                                                            params.useFeaturesForPrediction)
 elif predictionMethod == 'ps':
     predictionParameters = prediction.PointSetPredictionParameters(params.maxPredictedSpeed)
+elif predictionMethod == 'proto':
+    prototypes = storage.loadPrototypesFromSqlite(args.prototypeDatabaseFilename)
+    for p in prototypes:
+        p.getMovingObject().getPositions().computeCumulativeDistances()
 # no else required, since parameters is required as argument
 
 # evasiveActionPredictionParameters = prediction.EvasiveActionPredictionParameters(params.maxPredictedSpeed,