Something went wrong on our end
Forked from an inaccessible project.
-
Robin.Mueller authoredRobin.Mueller authored
OBSW_TmService3.py 3.74 KiB
# -*- coding: utf-8 -*-
"""
Program: OBSW_TmService3.py
Date: 30.12.2019
Description: Deserialize Housekeeping TM
Author: R. Mueller
"""
from tm.OBSW_PusTm import PUSTelemetry
import struct
class Service3TM(PUSTelemetry):
def __init__(self, byteArray):
super().__init__(byteArray)
self.sid = struct.unpack('>I', self.byteArrayData[0:4])[0]
self.hkHeader = []
self.hkContent = []
self.printPacketInfo("Housekeeping Packet")
if self.getSubservice() == 25:
self.paramLength = len(self.byteArrayData) - 4
# TODO: This can be automated by using the MIB parser pool names and pool datatypes
if self.sid == 0x1f00 or self.sid == 0x2f00:
self.hkHeader = ["Fix Mode", "SV in Fix", "GNSS Week", "Time of Week", "Latitude", "Longitude",
"Mean Sea Altitude", "Position X", "Position Y", "Position Z",
"Velocity X", "Velocity Y", "Velocity Z"]
self.fixMode = self.byteArrayData[4]
self.svInFix = self.byteArrayData[5]
self.gnssWeek = struct.unpack('>H', self.byteArrayData[5:7])[0]
self.timeOfWeek = struct.unpack('>I', self.byteArrayData[7:11])[0]
self.latitude = struct.unpack('>I', self.byteArrayData[11:15])[0]
self.longitude = struct.unpack('>I', self.byteArrayData[15:19])[0]
self.msa = struct.unpack('>I', self.byteArrayData[19:23])[0]
self.positionX = struct.unpack('>d', self.byteArrayData[23:31])[0]
self.positionY = struct.unpack('>d', self.byteArrayData[31:39])[0]
self.positionZ = struct.unpack('>d', self.byteArrayData[39:47])[0]
self.vx = struct.unpack('>d', self.byteArrayData[47:55])[0]
self.vy = struct.unpack('>d', self.byteArrayData[55:63])[0]
self.vz = struct.unpack('>d', self.byteArrayData[63:71])[0]
self.hkContent.append(self.fixMode)
self.hkContent.append(self.svInFix)
self.hkContent.append(self.gnssWeek)
self.hkContent.append(self.timeOfWeek)
self.hkContent.append(self.latitude)
self.hkContent.append(self.longitude)
self.hkContent.append(self.msa)
self.hkContent.append(self.positionX)
self.hkContent.append(self.positionY)
self.hkContent.append(self.positionZ)
self.hkContent.append(self.vx)
self.hkContent.append(self.vy)
self.hkContent.append(self.vz)
elif self.sid == 0x4300:
self.hkHeader = ["Bool", "UINT8", "UINT16", "UINT32", "FLOAT1", "FLOAT2"]
self.testBool = self.byteArrayData[4]
self.hkContent.append(self.testBool)
self.testUint8 = self.byteArrayData[5]
self.hkContent.append(self.testUint8)
self.testUint16 = (self.byteArrayData[6] << 8) | self.byteArrayData[7]
self.hkContent.append(self.testUint16)
self.testUint32 = struct.unpack('>I', self.byteArrayData[8:12])[0]
self.hkContent.append(self.testUint32)
self.floatVector1 = struct.unpack('>f', self.byteArrayData[12:16])[0]
self.hkContent.append(self.floatVector1)
self.floatVector2 = struct.unpack('>f', self.byteArrayData[16:20])[0]
self.hkContent.append(self.floatVector2)
def printTelemetryHeader(self, array):
super().printTelemetryHeader(array)
array.append(hex(self.sid))
array.append(int(self.paramLength))
return
def printTelemetryColumnHeaders(self, array):
super().printTelemetryColumnHeaders(array)
array.append("SID")
array.append("HK Data Size")
return