HK Parsing and TC PROC Tests #76
@ -36,14 +36,14 @@ TMP_1075_2_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x05])
|
||||
SYRLINKS_HANDLER_ID = bytes([0x44, 0x53, 0x00, 0xA3])
|
||||
|
||||
# ACS Object IDs
|
||||
MGM_0_HANDLER_ID = bytes([0x44, 0x12, 0x00, 0x06])
|
||||
MGM_1_HANDLER_ID = bytes([0x44, 0x12, 0x01, 0x07])
|
||||
MGM_2_HANDLER_ID = bytes([0x44, 0x12, 0x02, 0x08])
|
||||
MGM_3_HANDLER_ID = bytes([0x44, 0x12, 0x03, 0x09])
|
||||
GYRO_0_HANDLER_ID = bytes([0x44, 0x12, 0x00, 0x10])
|
||||
GYRO_1_HANDLER_ID = bytes([0x44, 0x12, 0x01, 0x11])
|
||||
GYRO_2_HANDLER_ID = bytes([0x44, 0x12, 0x02, 0x12])
|
||||
GYRO_3_HANDLER_ID = bytes([0x44, 0x12, 0x03, 0x13])
|
||||
MGM_0_LIS3_HANDLER_ID = bytes([0x44, 0x12, 0x00, 0x06])
|
||||
MGM_1_RM3100_HANDLER_ID = bytes([0x44, 0x12, 0x01, 0x07])
|
||||
MGM_2_LIS3_HANDLER_ID = bytes([0x44, 0x12, 0x02, 0x08])
|
||||
MGM_3_RM3100_HANDLER_ID = bytes([0x44, 0x12, 0x03, 0x09])
|
||||
GYRO_0_ADIS_HANDLER_ID = bytes([0x44, 0x12, 0x00, 0x10])
|
||||
GYRO_1_L3G_HANDLER_ID = bytes([0x44, 0x12, 0x01, 0x11])
|
||||
GYRO_2_ADIS_HANDLER_ID = bytes([0x44, 0x12, 0x02, 0x12])
|
||||
GYRO_3_L3G_HANDLER_ID = bytes([0x44, 0x12, 0x03, 0x13])
|
||||
GPS_HANDLER_0_ID = bytes([0x44, 0x13, 0x00, 0x45])
|
||||
GPS_HANDLER_1_ID = bytes([0x44, 0x13, 0x01, 0x46])
|
||||
RW1_ID = bytes([0x44, 0x12, 0x00, 0x47])
|
||||
|
10
pus_tc/devs/gyros.py
Normal file
10
pus_tc/devs/gyros.py
Normal file
@ -0,0 +1,10 @@
|
||||
import enum
|
||||
|
||||
|
||||
class AdisGyroSetIds(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
CFG_HK = 1
|
||||
|
||||
|
||||
class L3gGyroSetIds(enum.IntEnum):
|
||||
CORE_HK = 0
|
9
pus_tc/devs/mgms.py
Normal file
9
pus_tc/devs/mgms.py
Normal file
@ -0,0 +1,9 @@
|
||||
import enum
|
||||
|
||||
|
||||
class MgmLis3SetIds(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
|
||||
|
||||
class MgmRm3100SetIds(enum.IntEnum):
|
||||
CORE_HK = 0
|
@ -1,8 +1,75 @@
|
||||
import struct
|
||||
|
||||
from pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.utility import ObjectId
|
||||
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
from pus_tc.devs.gyros import L3gGyroSetIds, AdisGyroSetIds
|
||||
import config.object_ids as obj_ids
|
||||
|
||||
|
||||
def handle_gyros_hk_data(
|
||||
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
):
|
||||
pass
|
||||
if object_id.as_bytes in [
|
||||
obj_ids.GYRO_0_ADIS_HANDLER_ID,
|
||||
obj_ids.GYRO_2_ADIS_HANDLER_ID,
|
||||
]:
|
||||
handle_adis_gyro_hk(
|
||||
object_id=object_id, printer=printer, set_id=set_id, hk_data=hk_data
|
||||
)
|
||||
elif object_id.as_bytes in [
|
||||
obj_ids.GYRO_1_L3G_HANDLER_ID,
|
||||
obj_ids.GYRO_3_L3G_HANDLER_ID,
|
||||
]:
|
||||
handle_l3g_gyro_hk(
|
||||
object_id=object_id, printer=printer, set_id=set_id, hk_data=hk_data
|
||||
)
|
||||
|
||||
|
||||
def handle_adis_gyro_hk(
|
||||
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
):
|
||||
if set_id == AdisGyroSetIds.CORE_HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = "!ddddddf"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(angVelocX, angVelocY, angVelocZ, accelX, accelY, accelZ, temp) = struct.unpack(
|
||||
fmt_str, hk_data[0 : 0 + inc_len]
|
||||
)
|
||||
pw.dlog(f"Received ADIS1650X Gyro HK data from object {object_id}")
|
||||
pw.dlog(
|
||||
f"Angular Velocities (degrees per second): X {angVelocX} | "
|
||||
f"Y {angVelocY} | Z {angVelocZ}"
|
||||
)
|
||||
pw.dlog(f"Acceleration (m/s^2): X {accelX} | Y {accelY} | Z {accelZ}")
|
||||
pw.dlog(f"Temperature {temp} C")
|
||||
if set_id == AdisGyroSetIds.CFG_HK:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = "!HBHH"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(diag_stat_reg, filter_setting, msc_ctrl_reg, dec_rate_reg) = struct.unpack(
|
||||
fmt_str, hk_data[0 : 0 + inc_len]
|
||||
)
|
||||
pw.dlog(f"Diagnostic Status Register {diag_stat_reg:#018b}")
|
||||
pw.dlog(f"Filter Settings {filter_setting:#010b}")
|
||||
pw.dlog(f"Miscellaneous Control Register {msc_ctrl_reg:#018b}")
|
||||
pw.dlog(f"Decimation Rate {dec_rate_reg:#06x}")
|
||||
|
||||
|
||||
def handle_l3g_gyro_hk(
|
||||
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||
):
|
||||
if set_id == L3gGyroSetIds:
|
||||
pw = PrintWrapper(printer)
|
||||
fmt_str = "!ffff"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(angVelocX, angVelocY, angVelocZ, temp) = struct.unpack(
|
||||
fmt_str, hk_data[0 : 0 + inc_len]
|
||||
)
|
||||
pw.dlog(f"Received L3GD20H Gyro HK data from object {object_id}")
|
||||
pw.dlog(
|
||||
f"Angular Velocities (degrees per second): X {angVelocX} | "
|
||||
f"Y {angVelocY} | Z {angVelocZ}"
|
||||
)
|
||||
pw.dlog(f"Temperature {temp} C")
|
||||
|
@ -103,19 +103,19 @@ def handle_regular_hk_print(
|
||||
if objb == obj_ids.P60_DOCK_HANDLER:
|
||||
handle_p60_hk_data(printer=printer, set_id=set_id, hk_data=hk_data)
|
||||
if objb in [
|
||||
obj_ids.GYRO_0_HANDLER_ID,
|
||||
obj_ids.GYRO_1_HANDLER_ID,
|
||||
obj_ids.GYRO_2_HANDLER_ID,
|
||||
obj_ids.GYRO_3_HANDLER_ID,
|
||||
obj_ids.GYRO_0_ADIS_HANDLER_ID,
|
||||
obj_ids.GYRO_1_L3G_HANDLER_ID,
|
||||
obj_ids.GYRO_2_ADIS_HANDLER_ID,
|
||||
obj_ids.GYRO_3_L3G_HANDLER_ID,
|
||||
]:
|
||||
handle_gyros_hk_data(
|
||||
object_id=object_id, hk_data=hk_data, printer=printer, set_id=set_id
|
||||
)
|
||||
if objb in [
|
||||
obj_ids.MGM_0_HANDLER_ID,
|
||||
obj_ids.MGM_1_HANDLER_ID,
|
||||
obj_ids.MGM_2_HANDLER_ID,
|
||||
obj_ids.MGM_3_HANDLER_ID,
|
||||
obj_ids.MGM_0_LIS3_HANDLER_ID,
|
||||
obj_ids.MGM_1_RM3100_HANDLER_ID,
|
||||
obj_ids.MGM_2_LIS3_HANDLER_ID,
|
||||
obj_ids.MGM_3_RM3100_HANDLER_ID,
|
||||
]:
|
||||
handle_mgm_hk_data(
|
||||
object_id=object_id, hk_data=hk_data, printer=printer, set_id=set_id
|
||||
|
Loading…
Reference in New Issue
Block a user