From 87473338806b5861dc1ffd6b23c642607536fc76 Mon Sep 17 00:00:00 2001 From: meggert Date: Thu, 2 Mar 2023 18:20:10 +0100 Subject: [PATCH] added all handling for raw mgm datasets --- eive_tmtc/tmtc/acs/imtq.py | 75 ++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 20 deletions(-) diff --git a/eive_tmtc/tmtc/acs/imtq.py b/eive_tmtc/tmtc/acs/imtq.py index 33bc91b..2262982 100644 --- a/eive_tmtc/tmtc/acs/imtq.py +++ b/eive_tmtc/tmtc/acs/imtq.py @@ -42,9 +42,12 @@ class OpCode: OFF = "off" SET_DIPOLE = "set_dipole" REQUEST_ENG_HK_NO_TORQUE = "hk_os_eng_hk" - REQUEST_MGM_RAW_NO_TORQUE = "hk_os_mgm_raw" + REQUEST_MGM_RAW_NO_TORQUE = "hk_os_mgm_raw_no_torque" ENABLE_MGM_RAW_NO_TORQUE = "enb_mgm_raw_no_torque" DISABLE_MGM_RAW_NO_TORQUE = "dis_mgm_raw_no_torque" + REQUEST_MGM_RAW_WITH_TORQUE = "hk_os_mgm_raw_with_torque" + ENABLE_MGM_RAW_WITH_TORQUE = "enb_mgm_raw_with_torque" + DISABLE_MGM_RAW_WITH_TORQUE = "dis_mgm_raw_with_torque" ENABLE_ENG_HK_NO_TORQUE = "enb_eng_hk_no_torque" DISABLE_ENG_HK_NO_TORQUE = "dis_eng_hk_no_torque" POS_X_SELF_TEST = "self_test_pos_x" @@ -94,7 +97,12 @@ def add_imtq_cmds(defs: TmtcDefinitionWrapper): oce.add(OpCode.ON, "Mode On") oce.add(OpCode.NORMAL, "Mode Normal") oce.add(OpCode.REQUEST_ENG_HK_NO_TORQUE, "Request Engineering HK One Shot") - oce.add(OpCode.REQUEST_MGM_RAW_NO_TORQUE, "Request MGM Raw HK One Shot") + oce.add(OpCode.REQUEST_MGM_RAW_NO_TORQUE, "Request MGM Raw Without Torque HK One Shot") + oce.add(OpCode.ENABLE_MGM_RAW_NO_TORQUE, "Enable MGM Raw Without Torque HK") + oce.add(OpCode.DISABLE_MGM_RAW_NO_TORQUE, "Disable MGM Raw Without Torque HK") + oce.add(OpCode.REQUEST_MGM_RAW_WITH_TORQUE, "Request MGM Raw With Torque HK One Shot") + oce.add(OpCode.ENABLE_MGM_RAW_WITH_TORQUE, "Enable MGM Raw With Torque HK") + oce.add(OpCode.DISABLE_MGM_RAW_WITH_TORQUE, "Disable MGM Raw With Torque HK") oce.add(OpCode.POS_X_SELF_TEST, "IMTQ perform pos X self test") oce.add(OpCode.NEG_X_SELF_TEST, "IMTQ perform neg X self test") oce.add(OpCode.POS_Y_SELF_TEST, "IMTQ perform pos Y self test") @@ -217,21 +225,11 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod ) ) - if op_code == "10": + if op_code == "10": # doesnt seem to work anymore q.add_log_cmd("IMTQ: Get commanded dipole") command = object_id.as_bytes + ImtqActionId.get_commanded_dipole q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == OpCode.ENABLE_MGM_RAW_NO_TORQUE: - q.add_log_cmd("IMTQ: Eable MGM RAW HK (No Torque)") - interval = float(input("Please enter collection interval in seconds: ")) - cmds = create_enable_periodic_hk_command_with_interval( - diag=True, - sid=make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_NO_TORQUE), - interval_seconds=interval, - ) - for cmd in cmds: - q.add_pus_tc(cmd) if op_code == OpCode.ENABLE_ENG_HK_NO_TORQUE: q.add_log_cmd("IMTQ: Enable ENG HK") interval = float(input("Please enter collection interval in seconds: ")) @@ -242,13 +240,6 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod ) for cmd in cmds: q.add_pus_tc(cmd) - if op_code == OpCode.DISABLE_MGM_RAW_NO_TORQUE: - q.add_log_cmd("IMTQ: Disable MGM RAW HK (No Torque)") - q.add_pus_tc( - create_disable_periodic_hk_command( - True, make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_NO_TORQUE) - ) - ) if op_code == OpCode.DISABLE_ENG_HK_NO_TORQUE: q.add_log_cmd("IMTQ: Disable ENG HK (No Torque)") q.add_pus_tc( @@ -284,6 +275,50 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod ) ) + if op_code == OpCode.DISABLE_MGM_RAW_NO_TORQUE: + q.add_log_cmd("IMTQ: Disable MGM RAW HK (No Torque)") + q.add_pus_tc( + create_disable_periodic_hk_command( + True, make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_NO_TORQUE) + ) + ) + if op_code == OpCode.ENABLE_MGM_RAW_NO_TORQUE: + q.add_log_cmd("IMTQ: Enable MGM RAW HK (No Torque)") + interval = float(input("Please enter collection interval in seconds: ")) + cmds = create_enable_periodic_hk_command_with_interval( + diag=True, + sid=make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_NO_TORQUE), + interval_seconds=interval, + ) + for cmd in cmds: + q.add_pus_tc(cmd) + if op_code == OpCode.REQUEST_MGM_RAW_WITH_TORQUE: + q.add_log_cmd("IMTQ: Get raw MTM hk set") + q.add_pus_tc( + create_request_one_diag_command( + sid=make_sid( + object_id=object_id.as_bytes, set_id=ImtqSetId.RAW_MTM_WITH_TORQUE_TORQUE + ) + ) + ) + if op_code == OpCode.ENABLE_MGM_RAW_WITH_TORQUE: + q.add_log_cmd("IMTQ: Enable MGM RAW HK (No Torque)") + interval = float(input("Please enter collection interval in seconds: ")) + cmds = create_enable_periodic_hk_command_with_interval( + diag=True, + sid=make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_WITH_TORQUE), + interval_seconds=interval, + ) + for cmd in cmds: + q.add_pus_tc(cmd) + if op_code == OpCode.DISABLE_MGM_RAW_WITH_TORQUE: + q.add_log_cmd("IMTQ: Disable MGM RAW HK (No Torque)") + q.add_pus_tc( + create_disable_periodic_hk_command( + True, make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_WITH_TORQUE) + ) + ) + def pack_dipole_command( object_id: bytes, x_dipole: int, y_dipole: int, z_dipole: int, duration: int