Esempio n. 1
0
def addTrust(trust_report):
    if trust_report is None:
        return
    globals.lock.acquire()
    trust_report['predicted'] = isPredictedReport(trust_report)
    segments = filterSegmentsByHeadcode(trust_report)
    segments = filterPotentialSegments(segments, trust_report)
    segments = filterByGeniusAllocations(segments, trust_report)

    segments = chooseBestSegment(segments, trust_report)
    foundStop = getBestStop(segments, trust_report, True)
    if not foundStop:
        if not findEmptySegment(segments, trust_report):
            globals.createNewSegment(trust_report)
    globals.lock.release()
    interpolating.interpolate(trust_report['headcode'])
Esempio n. 2
0
def addGPS(gps_report):
    if gps_report is None:
        return
    globals.lock.acquire()
    segment = findClosestSegment(globals.segments, gps_report)
    if segment is None:
        globals.createNewSegment(gps_report)
    elif not checkNonMatchingTrust(segment, gps_report):
        segment = findClosestGPSSegment(globals.segments, gps_report)
        if segment is None:
            globals.createNewSegment(gps_report)
        else:
            segment.matching.append({
                'gps': gps_report,
                'trust': None,
                'dist_error': None
            })
            socket_io.emitSegment('update', segment)
    globals.lock.release()