Esempio n. 1
0
    def run(self):
        self.gpsPath = FileReader.parseGpsLog(self.gpsLog)
        if(self.gpsPath == -1):
            return
        print self.gpsPath
        if self.coreLog == None:
            self.coreLog = self.runCamSim()
        self.pathList = FileReader.parseCoreLogs(self.coreLog, self.gpsPath[0].longitude, self.gpsPath[0].latitude)
        if(self.pathList == -1):
            return

        optimalPath = self.getOptimalPath(self.gpsPath, self.pathList)
        distances = self.calculateDistances(optimalPath)
        self.calculateMetrics(optimalPath, distances)
        FileWriter.createDataSheet(self, self.totalResult, self.twentyMinuteResults)
        FileWriter.export(self, self.gpsPath, [optimalPath])
        print "Minimum Distance"
        print min(distances)
        print "Maximum Distance"
        print max(distances)

        print 'id: ', self.scenarioID
        print 'core log file: ', self.coreLog
        print 'gps log file: ', self.gpsLog
        print 'time offset: ', self.timeOffset
        print 'maximum radius: ', self.maxRadius
        print 'number of paths: ', len(self.pathList)
Esempio n. 2
0
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))

from Coordinate import Coordinate
from Scenario import Scenario
import FileReader
import FileWriter
import time

gps_entries = FileReader.parseGpsLog('kmlPrintTestGpsFile.log')
core_entries = FileReader.parseCoreLog('kmlPrintTestCoreFile.log')

print 'Test1: valid input'
scenario = Scenario(1, 5.0, '', sys.path[0], '')
FileWriter.export(scenario, gps_entries, core_entries)
print 'kml file printed successfully\n'

print 'Test2: no core data'
scenario = Scenario(1, 5.0, '', sys.path[0], '')
FileWriter.export(scenario, gps_entries, list())
print 'kml file printed successfully\n'

print 'Test3: no GPS data'
scenario = Scenario(1, 5.0, '', sys.path[0], '')
FileWriter.export(scenario, list(), core_entries)
print 'kml file printed successfully\n'

print 'Test4: no core or GPS data'
scenario = Scenario(1, 5.0, '', sys.path[0], '')
FileWriter.export(scenario, list(), list())
print 'kml file printed successfully\n'