added blob stats set for STR
All checks were successful
EIVE/-/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2024-02-29 12:07:03 +01:00
parent 588d7a8079
commit 68ea889d0f
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -9,6 +9,7 @@ import datetime
import enum
import logging
import struct
from typing import List, Tuple
from eive_tmtc.pus_tm.defs import PrintWrapper
from eive_tmtc.utility.input_helper import InputHelper
@ -183,6 +184,7 @@ class SetId(enum.IntEnum):
BLOBS = 92
CENTROID = 93
CENTROIDS = 94
BLOB_STATS = 102
class DataSetRequest(enum.IntEnum):
@ -876,6 +878,8 @@ def handle_str_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper):
handle_centroids_set(hk_data, pw)
elif set_id == SetId.CONTRAST:
handle_contrast_set(hk_data, pw)
elif set_id == SetId.BLOB_STATS:
handle_blob_stats_set(hk_data, pw)
else:
_LOGGER.warning(f"HK parsing for Star Tracker set ID {set_id} unimplemented")
@ -1178,6 +1182,35 @@ def handle_contrast_set(hk_data: bytes, pw: PrintWrapper):
handle_histo_or_contrast_set("Contrast", hk_data, pw)
def handle_blob_stats_set(hk_data: bytes, pw: PrintWrapper):
pw.dlog("Received Blob Stats Set")
if len(hk_data) < 65:
raise ValueError(
f"Matched BlobStats set with length {len(hk_data)} too short. Expected 65 bytes."
)
current_idx = unpack_time_hk(hk_data, 0, pw)
def fill_list(current_idx: int) -> Tuple[List[int], int]:
list_to_fill = []
for _ in range(16):
list_to_fill.append(hk_data[current_idx])
current_idx += 1
return list_to_fill, current_idx
noise_list, current_idx = fill_list(current_idx)
threshold_list, current_idx = fill_list(current_idx)
lvalid_list, current_idx = fill_list(current_idx)
oflow_list, current_idx = fill_list(current_idx)
pw.dlog("Index | Noise | Threshold | LValid | Oflow")
for i in range(16):
pw.dlog(
"{:<3} {:<3} {:<3} {:<3} {:<3}".format(
i, noise_list[i], threshold_list[i], lvalid_list[i], oflow_list[i]
)
)
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=4)
def handle_star_tracker_action_replies(
action_id: int, pw: PrintWrapper, custom_data: bytes
):