From 77c2c915395b4fd50d09238fe9e8308e56c19766 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Nov 2023 19:42:26 +0100 Subject: [PATCH] health and system cmds --- eive_tmtc/pus_tc/cmd_demux.py | 104 ++++++++++++++++++---------------- eive_tmtc/tmtc/health.py | 2 +- eive_tmtc/tmtc/test.py | 2 +- 3 files changed, 56 insertions(+), 52 deletions(-) diff --git a/eive_tmtc/pus_tc/cmd_demux.py b/eive_tmtc/pus_tc/cmd_demux.py index ec87f79..84d2d0f 100644 --- a/eive_tmtc/pus_tc/cmd_demux.py +++ b/eive_tmtc/pus_tc/cmd_demux.py @@ -1,74 +1,72 @@ """Hook function which packs telecommands based on service and operation code string """ import logging -from typing import cast, List +from typing import List, cast -from eive_tmtc.tmtc.acs.gyros import handle_gyr_cmd - -from eive_tmtc.tmtc.acs.acs_ctrl import pack_acs_ctrl_command -from eive_tmtc.tmtc.com.subsystem import build_com_subsystem_procedure -from eive_tmtc.tmtc.test import pack_test_command -from eive_tmtc.tmtc.acs.mgms import handle_mgm_cmd -from eive_tmtc.tmtc.power.power import pack_power_commands -from eive_tmtc.tmtc.tcs.ctrl import pack_tcs_ctrl_commands -from eive_tmtc.tmtc.tcs.rtd import pack_rtd_commands -from eive_tmtc.tmtc.payload.scex import pack_scex_cmds -from eive_tmtc.tmtc.tcs.subsystem import pack_tcs_sys_commands -from eive_tmtc.tmtc.time import pack_time_management_cmd from tmtccmd import DefaultProcedureInfo from tmtccmd.tmtc import DefaultPusQueueHelper +from tmtccmd.util import ObjectIdU32 -from eive_tmtc.tmtc.power.p60dock import pack_p60dock_cmds -from eive_tmtc.tmtc.power.pdu2 import pack_pdu2_commands -from eive_tmtc.tmtc.power.pdu1 import pack_pdu1_commands -from eive_tmtc.tmtc.power.acu import pack_acu_commands -from eive_tmtc.tmtc.acs.imtq import create_imtq_command -from eive_tmtc.tmtc.tcs.heater import pack_heater_cmds -from eive_tmtc.tmtc.acs.reaction_wheels import ( - create_single_rw_cmd, - pack_rw_ass_cmds, -) -from eive_tmtc.tmtc.com.ccsds_handler import pack_ccsds_handler_command -from eive_tmtc.tmtc.core import pack_core_commands -from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands -from eive_tmtc.tmtc.com.syrlinks_handler import pack_syrlinks_command -from eive_tmtc.tmtc.com.pdec_handler import pack_pdec_handler_commands -from eive_tmtc.tmtc.wdt import pack_wdt_commands -from eive_tmtc.tmtc.acs.acs_board import pack_acs_command +import eive_tmtc.config.object_ids as oids from eive_tmtc.config.object_ids import ( - P60_DOCK_HANDLER, - PDU_1_HANDLER_ID, - PDU_2_HANDLER_ID, ACU_HANDLER_ID, - TMP1075_HANDLER_TCS_BRD_0_ID, - TMP1075_HANDLER_TCS_BRD_1_ID, - TMP1075_HANDLER_PLPCDU_0_ID, - TMP1075_HANDLER_IF_BRD_ID, + CCSDS_HANDLER_ID, HEATER_CONTROLLER_ID, IMTQ_HANDLER_ID, + P60_DOCK_HANDLER, + PDEC_HANDLER_ID, + PDU_1_HANDLER_ID, + PDU_2_HANDLER_ID, + RAD_SENSOR_ID, RW1_ID, RW2_ID, RW3_ID, RW4_ID, - RAD_SENSOR_ID, + RW_ASSEMBLY, STAR_TRACKER_ID, - CCSDS_HANDLER_ID, - PDEC_HANDLER_ID, STR_IMG_HELPER_ID, SYRLINKS_HANDLER_ID, - RW_ASSEMBLY, + TMP1075_HANDLER_IF_BRD_ID, + TMP1075_HANDLER_PLPCDU_0_ID, + TMP1075_HANDLER_TCS_BRD_0_ID, + TMP1075_HANDLER_TCS_BRD_1_ID, get_object_ids, ) - -from eive_tmtc.tmtc.tcs.tmp1075 import pack_tmp1075_test_into +from eive_tmtc.tmtc.acs.acs_board import pack_acs_command +from eive_tmtc.tmtc.acs.acs_ctrl import pack_acs_ctrl_command from eive_tmtc.tmtc.acs.gps import pack_gps_command -from eive_tmtc.tmtc.payload.rad_sensor import create_rad_sensor_cmd -from eive_tmtc.tmtc.payload.plpcdu import pack_pl_pcdu_commands +from eive_tmtc.tmtc.acs.gyros import handle_gyr_cmd +from eive_tmtc.tmtc.acs.imtq import create_imtq_command +from eive_tmtc.tmtc.acs.mgms import handle_mgm_cmd +from eive_tmtc.tmtc.acs.reaction_wheels import ( + create_single_rw_cmd, + pack_rw_ass_cmds, +) +from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands from eive_tmtc.tmtc.acs.str_img_helper import pack_str_img_helper_command - -import eive_tmtc.config.object_ids as oids -from tmtccmd.util import ObjectIdU32 - +from eive_tmtc.tmtc.com.ccsds_handler import pack_ccsds_handler_command +from eive_tmtc.tmtc.com.pdec_handler import pack_pdec_handler_commands +from eive_tmtc.tmtc.com.subsystem import build_com_subsystem_procedure +from eive_tmtc.tmtc.com.syrlinks_handler import pack_syrlinks_command +from eive_tmtc.tmtc.core import pack_core_commands +from eive_tmtc.tmtc.health import build_health_cmds +from eive_tmtc.tmtc.payload.plpcdu import pack_pl_pcdu_commands +from eive_tmtc.tmtc.payload.rad_sensor import create_rad_sensor_cmd +from eive_tmtc.tmtc.payload.scex import pack_scex_cmds +from eive_tmtc.tmtc.power.acu import pack_acu_commands +from eive_tmtc.tmtc.power.p60dock import pack_p60dock_cmds +from eive_tmtc.tmtc.power.pdu1 import pack_pdu1_commands +from eive_tmtc.tmtc.power.pdu2 import pack_pdu2_commands +from eive_tmtc.tmtc.power.power import pack_power_commands +from eive_tmtc.tmtc.system import build_system_cmds +from eive_tmtc.tmtc.tcs.ctrl import pack_tcs_ctrl_commands +from eive_tmtc.tmtc.tcs.heater import pack_heater_cmds +from eive_tmtc.tmtc.tcs.rtd import pack_rtd_commands +from eive_tmtc.tmtc.tcs.subsystem import pack_tcs_sys_commands +from eive_tmtc.tmtc.tcs.tmp1075 import pack_tmp1075_test_into +from eive_tmtc.tmtc.test import build_test_commands +from eive_tmtc.tmtc.time import pack_time_management_cmd +from eive_tmtc.tmtc.wdt import pack_wdt_commands from eive_tmtc.utility.input_helper import InputHelper @@ -85,6 +83,12 @@ def handle_pus_procedure( # noqa C901: Complexity okay here. raise ValueError( "command path list empty. Full command path {cmd_path} might have invalid format" ) + if cmd_path_list[0] == "system": + assert len(cmd_path_list) >= 1 + return build_system_cmds(queue_helper, cmd_path_list[1]) + if cmd_path_list[0] == "health": + assert len(cmd_path_list) >= 1 + return build_health_cmds(queue_helper, cmd_path_list[1]) if cmd_path_list[0] == "eps": return handle_eps_procedure(queue_helper, cmd_path_list[1:]) if cmd_path_list[0] == "tcs": @@ -97,7 +101,7 @@ def handle_pus_procedure( # noqa C901: Complexity okay here. return handle_obdh_procedure(queue_helper, cmd_path_list[1:]) if cmd_path_list[0] == "test": assert len(cmd_path_list) >= 1 - return pack_test_command(queue_helper, cmd_path_list[1]) + return build_test_commands(queue_helper, cmd_path_list[1]) if cmd_path_list[0] == "com": return handle_com_procedure(queue_helper, cmd_path_list[1:]) logging.getLogger(__name__).warning( diff --git a/eive_tmtc/tmtc/health.py b/eive_tmtc/tmtc/health.py index 4b551b2..2ab13bd 100644 --- a/eive_tmtc/tmtc/health.py +++ b/eive_tmtc/tmtc/health.py @@ -28,7 +28,7 @@ def prompt_health() -> FsfwHealth: return FsfwHealth(health_idx) -def pack_health_cmd(q: DefaultPusQueueHelper, cmd_str: str): +def build_health_cmds(q: DefaultPusQueueHelper, cmd_str: str): if cmd_str == OpCode.SET_HEALTH: app_data = bytearray(prompt_object()) health = prompt_health() diff --git a/eive_tmtc/tmtc/test.py b/eive_tmtc/tmtc/test.py index 876713b..ffc2214 100644 --- a/eive_tmtc/tmtc/test.py +++ b/eive_tmtc/tmtc/test.py @@ -24,7 +24,7 @@ def create_test_node() -> CmdTreeNode: return node -def pack_test_command(q: DefaultPusQueueHelper, cmd_path: str): +def build_test_commands(q: DefaultPusQueueHelper, cmd_path: str): if cmd_path == OpCode.PING: q.add_log_cmd("Sending PUS TC [17,1]") q.add_pus_tc(create_service_17_ping_command())