示例#1
0
def globalFormater(df):
    packetTypes = df["packetId"]
    packets = df["packet"]
    packetIDs = df["pkt_id"]
    sessionIDs = df["sessionUID"]
    motionArr = []
    sessionArr = []
    lapDataArr = []
    eventArr = []
    participantsArr = []
    carSetupsArr = []
    carTelemetryArr = []
    carStatusArr = []
    finalClassificationArr = []
    lobbyInfoArr = []

    for i in range(len(packetTypes)):
        packetType = packetTypes[i]
        packetIDrelation = packetIDs[i]
        packetSessionRelation = sessionIDs[i]
        packet = unpackUDPpacket(packets[i])
        formatted_info = localFormat(packet, packetType)

        if packetType == 0:
            motionArr.append(formatted_info.arr)
        elif packetType == 1:
            sessionArr.append(formatted_info.arr)
        elif packetType == 2:
            lapDataArr.append(formatted_info.arr)
        elif packetType == 3:
            eventArr.append(formatted_info.arr)
        elif packetType == 4:
            participantsArr.append(formatted_info.arr)
        elif packetType == 5:
            carSetupsArr.append(formatted_info.arr)
        elif packetType == 6:
            carTelemetryArr.append(formatted_info.arr)
        elif packetType == 7:
            carStatusArr.append(formatted_info.arr)
        elif packetType == 8:
            finalClassificationArr.append(formatted_info.arr)
        elif packetType == 9:
            lobbyInfoArr.append(formatted_info.arr)

    motionDF = pd.DataFrame(motionArr)
    sessionDF = pd.DataFrame(sessionArr)
    lapDataDF = pd.DataFrame(lapDataArr)
    eventDF = pd.DataFrame(eventArr)
    participantsDF = pd.DataFrame(participantsArr)
    carSetupsDF = pd.DataFrame(carSetupsArr)
    carTelemetryDF = pd.DataFrame(carTelemetryArr)
    carStatusDF = pd.DataFrame(carStatusArr)
    finalClassificationDF = pd.DataFrame(finalClassificationArr)
    lobbyInfoDF = pd.DataFrame(lobbyInfoArr)

    motionDF, sessionDF, lapDataDF, eventDF, carSetupsDF, carTelemetryDF, carStatusDF = addColumnNames(
        motionDF, sessionDF, lapDataDF, eventDF, carSetupsDF, carTelemetryDF,
        carStatusDF)

    return motionDF, sessionDF, lapDataDF, eventDF, carSetupsDF, carTelemetryDF, carStatusDF
示例#2
0
 def status(self):
     self.statusData.append(localFormat(self.packet, self.type).arr)
示例#3
0
 def telemetry(self):
     self.telemetryData.append(localFormat(self.packet, self.type).arr)
示例#4
0
 def setup(self):
     self.setupData.append(localFormat(self.packet, self.type).arr)
示例#5
0
 def lap(self):
     self.lapData.append(localFormat(self.packet, self.type).arr)
示例#6
0
 def session(self):
     self.sessionData.append(localFormat(self.packet, self.type).arr)
示例#7
0
 def motion(self):
     self.motionData.append(localFormat(self.packet, self.type).arr)