Added action command to ACS Ctrl to restore MEKF automatic recovery #171

Merged
muellerr merged 3 commits from acs-ctrl-new-act-cmd into main 2023-03-16 11:44:20 +01:00
4 changed files with 31 additions and 9 deletions
Showing only changes of commit 298ecba373 - Show all commits

View File

@ -10,6 +10,10 @@ list yields a list of all related PRs for each release.
# [unreleased]
## Added
- Add a little bit of first time stamp extraction for HK packet handling.
# [v2.19.1] 2023-03-14
## Added

View File

@ -1,4 +1,5 @@
"""HK Handling for EIVE OBSW"""
import datetime
import logging
# 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.com.syrlinks_handler import handle_syrlinks_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 (
Service3Base,
HkContentType,
@ -71,6 +73,7 @@ def handle_hk_packet(
printer=printer,
object_id=named_obj_id,
hk_packet=tm_packet,
tm=tm_packet.pus_tm,
hk_data=hk_data,
)
except ValueError as e:
@ -85,10 +88,12 @@ def handle_regular_hk_print(
printer: FsfwTmTcPrinter,
object_id: ObjectIdU32,
hk_packet: Service3Base,
tm: PusTelemetry,
hk_data: bytes,
):
objb = object_id.as_bytes
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."""
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)
@ -170,7 +175,9 @@ def handle_regular_hk_print(
elif objb == obj_ids.PLOC_SUPV_ID:
return handle_supv_hk_data(set_id=set_id, hk_data=hk_data, printer=printer)
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:
_LOGGER.info(
f"Service 3 TM: Parsing for object {object_id} and set ID {set_id} "

View File

@ -1,3 +1,4 @@
import datetime
import enum
import logging
import socket
@ -44,6 +45,9 @@ from tmtccmd.pus.s20_fsfw_param_defs import (
)
_LOGGER = logging.getLogger(__name__)
class SetId(enum.IntEnum):
MGM_RAW_SET = 0
MGM_PROC_SET = 1
@ -662,8 +666,14 @@ def set_acs_ctrl_param_matrix(q: DefaultPusQueueHelper):
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.ilog(_LOGGER, f"Received ACS CTRL HK with packet time {packet_time}")
match set_id:
case SetId.MGM_RAW_SET:
handle_raw_mgm_data(pw, hk_data)
@ -992,17 +1002,18 @@ def handle_mekf_data(pw: PrintWrapper, hk_data: bytes):
current_idx = 0
quat = struct.unpack(fmt_quat, hk_data[current_idx : current_idx + inc_len_quat])
current_idx += inc_len_quat
rate = (
struct.unpack(fmt_vec, hk_data[current_idx : current_idx + inc_len_vec])
* 180
/ math.pi
rates = [
rate * 180 / math.pi
for rate in struct.unpack(
fmt_vec, hk_data[current_idx : 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]
current_idx += inc_len_sts
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 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)

View File

@ -39,7 +39,7 @@ class Tmp1075ActionId(enum.IntEnum):
START_ADC_CONV = 2
class SetId:
class SetId(enum.IntEnum):
TEMPERATURE = 1