Mercurial Hosting > traffic-intelligence
diff scripts/safety-analysis.py @ 348:c64a4f889b97
added safety analysis options to feature tracking (with default values for backward compatibility)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 26 Jun 2013 18:40:31 -0400 |
parents | 14a2405f54f8 |
children | 7e9ad2d9d79c |
line wrap: on
line diff
--- a/scripts/safety-analysis.py Wed Jun 26 17:28:45 2013 -0400 +++ b/scripts/safety-analysis.py Wed Jun 26 18:40:31 2013 -0400 @@ -9,9 +9,10 @@ parser = argparse.ArgumentParser(description='The program processes indicators for all pairs of road users in the scene') parser.add_argument('configFilename', help = 'name of the configuration file') -# parser.add_argument('-c', help = 'name of the configuration file') # +#parser.add_argument('--maxspeed', dest = 'maxSpeed', help = 'maximum speed when predicting future motion (km/h)', default = 50, type = int) +#parser.add_argument('--time-horizon', dest = 'maxSpeed', help = 'maximum speed when predicting future motion (km/h)', default = 50, type = int) args = parser.parse_args() -print(args) + # TODO work on the way to indicate an interaction definition # if False: # test if there is a configuration file? @@ -19,13 +20,12 @@ params.loadConfigFile(args.configFilename) # configuration parameters # TODO from command line -frameRate = 15 # frame per second -maxSpeed = 90/3.6/frameRate # speed limit 50 km/h for urban envt, 90km/hr = 25 m/sec for highways -timeHorizon= frameRate*5 # prediction time Horizon = 1.5 s (reaction time) (5 second) +maxSpeed = args.maxSpeed/3.6/params.videoFrameRate # speed limit 50 km/h for urban envt, 90km/hr = 25 m/sec for highways +timeHorizon= params.videoFrameRate*5 # prediction time Horizon = 1.5 s (reaction time) (5 second) collisionDistanceThreshold= 1.8 # m -computeCZ = True +computeCZ = False -display = False +# display = False # parameters for prediction methods constantVelocityPredictionParameters = prediction.ConstantPredictionParameters(maxSpeed) @@ -53,17 +53,17 @@ interactions = events.createInteractions(objects) for inter in interactions: inter.computeIndicators() - # inter.computeCrossingsCollisions(constantVelocityPredictionParameters, collisionDistanceThreshold, timeHorizon, computeCZ) + inter.computeCrossingsCollisions(constantVelocityPredictionParameters, collisionDistanceThreshold, timeHorizon, computeCZ) storage.saveIndicators(params.databaseFilename, interactions) -if display: - plt.figure() - plt.axis('equal') - for inter in interactions[:2]: - for collisionPoints in inter.collisionPoints.values(): - for cp in collisionPoints: - plot([cp.x], [cp.y], 'x') +# if display: +# plt.figure() +# plt.axis('equal') +# for inter in interactions[:2]: +# for collisionPoints in inter.collisionPoints.values(): +# for cp in collisionPoints: +# plot([cp.x], [cp.y], 'x') # for the demo, output automatically a map # possibility to process longitudinal coords only