comparison scripts/safety-analysis.py @ 946:e5970606066f

bug fix on list filtering (cannot remove while iterating) and motion prediction keeping the same features
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 21 Jul 2017 11:25:20 -0400
parents 05d4302bf67e
children 584b9405e494
comparison
equal deleted inserted replaced
945:05d4302bf67e 946:e5970606066f
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('-n', dest = 'nObjects', help = 'number of objects to analyse', type = int) 15 parser.add_argument('-n', dest = 'nObjects', help = 'number of objects to analyse', type = int)
16 # TODO analyze only 16 # TODO analyze only
17 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', 'mp']) 17 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', 'mp'])
18 parser.add_argument('--prototypeDatabaseFilename', dest = 'prototypeDatabaseFilename', help = 'name of the database containing the prototypes') 18 parser.add_argument('--prototypeDatabaseFilename', dest = 'prototypeDatabaseFilename', help = 'name of the database containing the prototypes')
19 parser.add_argument('--no-motion-prediction', dest = 'noMotionPrediction', help = 'does not compute indicators like TTC depending on motion prediction', action = 'store_true')
19 parser.add_argument('--pet', dest = 'computePET', help = 'computes PET', action = 'store_true') 20 parser.add_argument('--pet', dest = 'computePET', help = 'computes PET', action = 'store_true')
20 parser.add_argument('--display-cp', dest = 'displayCollisionPoints', help = 'display collision points', action = 'store_true') 21 parser.add_argument('--display-cp', dest = 'displayCollisionPoints', help = 'display collision points', action = 'store_true')
21 parser.add_argument('--nthreads', dest = 'nProcesses', help = 'number of processes to run in parallel', type = int, default = 1) 22 parser.add_argument('--nthreads', dest = 'nProcesses', help = 'number of processes to run in parallel', type = int, default = 1)
22 args = parser.parse_args() 23 args = parser.parse_args()
23 24
73 # obj.setFeatures(features) 74 # obj.setFeatures(features)
74 75
75 interactions = events.createInteractions(objects) 76 interactions = events.createInteractions(objects)
76 for inter in interactions: 77 for inter in interactions:
77 inter.computeIndicators() 78 inter.computeIndicators()
78 # inter.computeCrossingsCollisions(predictionParameters, params.collisionDistance, params.predictionTimeHorizon, params.crossingZones, nProcesses = args.nProcesses, debug = True) 79 if not args.noMotionPrediction:
80 inter.computeCrossingsCollisions(predictionParameters, params.collisionDistance, params.predictionTimeHorizon, params.crossingZones, nProcesses = args.nProcesses, debug = True)
79 81
80 if args.computePET: 82 if args.computePET:
81 for inter in interactions: 83 for inter in interactions:
82 inter.computePET(params.collisionDistance) 84 inter.computePET(params.collisionDistance)
83 85