unpack and use packet DT
This commit is contained in:
parent
f0c14e21e4
commit
d45c6bce97
@ -1,4 +1,5 @@
|
|||||||
"""HK Handling for EIVE OBSW"""
|
"""HK Handling for EIVE OBSW"""
|
||||||
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
# from pus_tm.tcp_server_objects import TCP_SEVER_SENSOR_TEMPERATURES
|
# from pus_tm.tcp_server_objects import TCP_SEVER_SENSOR_TEMPERATURES
|
||||||
@ -12,6 +13,7 @@ from eive_tmtc.tmtc.payload.ploc_supervisor import handle_supv_hk_data
|
|||||||
from eive_tmtc.tmtc.acs.reaction_wheels import handle_rw_hk_data
|
from eive_tmtc.tmtc.acs.reaction_wheels import handle_rw_hk_data
|
||||||
from eive_tmtc.tmtc.com.syrlinks_handler import handle_syrlinks_hk_data
|
from eive_tmtc.tmtc.com.syrlinks_handler import handle_syrlinks_hk_data
|
||||||
from eive_tmtc.tmtc.tcs import handle_thermal_controller_hk_data
|
from eive_tmtc.tmtc.tcs import handle_thermal_controller_hk_data
|
||||||
|
from spacepackets.ecss import PusTelemetry
|
||||||
from tmtccmd.tm.pus_3_fsfw_hk import (
|
from tmtccmd.tm.pus_3_fsfw_hk import (
|
||||||
Service3Base,
|
Service3Base,
|
||||||
HkContentType,
|
HkContentType,
|
||||||
@ -71,6 +73,7 @@ def handle_hk_packet(
|
|||||||
printer=printer,
|
printer=printer,
|
||||||
object_id=named_obj_id,
|
object_id=named_obj_id,
|
||||||
hk_packet=tm_packet,
|
hk_packet=tm_packet,
|
||||||
|
tm=tm_packet.pus_tm,
|
||||||
hk_data=hk_data,
|
hk_data=hk_data,
|
||||||
)
|
)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
@ -85,10 +88,12 @@ def handle_regular_hk_print(
|
|||||||
printer: FsfwTmTcPrinter,
|
printer: FsfwTmTcPrinter,
|
||||||
object_id: ObjectIdU32,
|
object_id: ObjectIdU32,
|
||||||
hk_packet: Service3Base,
|
hk_packet: Service3Base,
|
||||||
|
tm: PusTelemetry,
|
||||||
hk_data: bytes,
|
hk_data: bytes,
|
||||||
):
|
):
|
||||||
objb = object_id.as_bytes
|
objb = object_id.as_bytes
|
||||||
set_id = hk_packet.set_id
|
set_id = hk_packet.set_id
|
||||||
|
packet_dt = tm.time_provider.as_date_time()
|
||||||
"""This function is called when a Service 3 Housekeeping packet is received."""
|
"""This function is called when a Service 3 Housekeeping packet is received."""
|
||||||
if objb in [obj_ids.RW1_ID, obj_ids.RW2_ID, obj_ids.RW3_ID, obj_ids.RW4_ID]:
|
if objb in [obj_ids.RW1_ID, obj_ids.RW2_ID, obj_ids.RW3_ID, obj_ids.RW4_ID]:
|
||||||
return handle_rw_hk_data(printer, object_id, set_id, hk_data)
|
return handle_rw_hk_data(printer, object_id, set_id, hk_data)
|
||||||
@ -170,7 +175,9 @@ def handle_regular_hk_print(
|
|||||||
elif objb == obj_ids.PLOC_SUPV_ID:
|
elif objb == obj_ids.PLOC_SUPV_ID:
|
||||||
return handle_supv_hk_data(set_id=set_id, hk_data=hk_data, printer=printer)
|
return handle_supv_hk_data(set_id=set_id, hk_data=hk_data, printer=printer)
|
||||||
elif objb == obj_ids.ACS_CONTROLLER:
|
elif objb == obj_ids.ACS_CONTROLLER:
|
||||||
return handle_acs_ctrl_hk_data(printer, set_id, hk_data)
|
return handle_acs_ctrl_hk_data(
|
||||||
|
printer=printer, set_id=set_id, hk_data=hk_data, packet_time=packet_dt
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
f"Service 3 TM: Parsing for object {object_id} and set ID {set_id} "
|
f"Service 3 TM: Parsing for object {object_id} and set ID {set_id} "
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import datetime
|
||||||
import enum
|
import enum
|
||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
@ -44,6 +45,9 @@ from tmtccmd.pus.s20_fsfw_param_defs import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class SetId(enum.IntEnum):
|
class SetId(enum.IntEnum):
|
||||||
MGM_RAW_SET = 0
|
MGM_RAW_SET = 0
|
||||||
MGM_PROC_SET = 1
|
MGM_PROC_SET = 1
|
||||||
@ -655,8 +659,14 @@ def set_acs_ctrl_param_matrix(q: DefaultPusQueueHelper):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def handle_acs_ctrl_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
def handle_acs_ctrl_hk_data(
|
||||||
|
printer: FsfwTmTcPrinter,
|
||||||
|
set_id: int,
|
||||||
|
hk_data: bytes,
|
||||||
|
packet_time: datetime.datetime,
|
||||||
|
):
|
||||||
pw = PrintWrapper(printer)
|
pw = PrintWrapper(printer)
|
||||||
|
pw.ilog(_LOGGER, f"Received ACS CTRL HK with packet time {packet_time}")
|
||||||
match set_id:
|
match set_id:
|
||||||
case SetId.MGM_RAW_SET:
|
case SetId.MGM_RAW_SET:
|
||||||
handle_raw_mgm_data(pw, hk_data)
|
handle_raw_mgm_data(pw, hk_data)
|
||||||
@ -985,17 +995,18 @@ def handle_mekf_data(pw: PrintWrapper, hk_data: bytes):
|
|||||||
current_idx = 0
|
current_idx = 0
|
||||||
quat = struct.unpack(fmt_quat, hk_data[current_idx : current_idx + inc_len_quat])
|
quat = struct.unpack(fmt_quat, hk_data[current_idx : current_idx + inc_len_quat])
|
||||||
current_idx += inc_len_quat
|
current_idx += inc_len_quat
|
||||||
rate = (
|
rates = [
|
||||||
struct.unpack(fmt_vec, hk_data[current_idx : current_idx + inc_len_vec])
|
rate * 180 / math.pi
|
||||||
* 180
|
for rate in struct.unpack(
|
||||||
/ math.pi
|
fmt_vec, hk_data[current_idx : current_idx + inc_len_vec]
|
||||||
)
|
)
|
||||||
|
]
|
||||||
current_idx += inc_len_vec
|
current_idx += inc_len_vec
|
||||||
status = struct.unpack(fmt_sts, hk_data[current_idx : current_idx + inc_len_sts])[0]
|
status = struct.unpack(fmt_sts, hk_data[current_idx : current_idx + inc_len_sts])[0]
|
||||||
current_idx += inc_len_sts
|
current_idx += inc_len_sts
|
||||||
pw.dlog(f"{'MEKF Status'.ljust(25)}: {mekf_status[status]}")
|
pw.dlog(f"{'MEKF Status'.ljust(25)}: {mekf_status[status]}")
|
||||||
pw.dlog(f"{'MEKF Quaternion'.ljust(25)}: {fmt_str_4.format(*quat)}")
|
pw.dlog(f"{'MEKF Quaternion'.ljust(25)}: {fmt_str_4.format(*quat)}")
|
||||||
pw.dlog(f"{'MEKF Rotational Rate'.ljust(25)}: {fmt_str_3.format(*rate)}")
|
pw.dlog(f"{'MEKF Rotational Rate'.ljust(25)}: {fmt_str_3.format(*rates)}")
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=3)
|
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=3)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user