diff --git a/eive_tmtc/tmtc/acs/acs_ctrl.py b/eive_tmtc/tmtc/acs/acs_ctrl.py index 9df6fcf..a97a3e8 100644 --- a/eive_tmtc/tmtc/acs/acs_ctrl.py +++ b/eive_tmtc/tmtc/acs/acs_ctrl.py @@ -27,9 +27,7 @@ from tmtccmd.tc.pus_3_fsfw_hk import ( from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter -from tmtccmd.tc.pus_20_fsfw_param import ( - create_load_param_cmd -) +from tmtccmd.tc.pus_20_fsfw_param import create_load_param_cmd from tmtccmd.pus.s20_fsfw_param_defs import ( create_scalar_u8_parameter, @@ -67,10 +65,12 @@ class Submode(enum.IntEnum): PTG_TARGET_GS = 15 PTG_INERTIAL = 16 + class ActionId(enum.IntEnum): SOLAR_ARRAY_DEPLOYMENT_SUCCESSFUL = 0 RESET_MEKF = 1 + class OpCodes: OFF = ["off"] SAFE = ["normal_safe"] @@ -250,13 +250,21 @@ def pack_acs_ctrl_command(p: ServiceProviderParams): q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.PTG_TARGET)) elif op_code in OpCodes.GS: q.add_log_cmd(f"{Info.GS}") - q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.PTG_TARGET_GS)) + q.add_pus_tc( + pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.PTG_TARGET_GS) + ) elif op_code in OpCodes.INERTIAL: q.add_log_cmd(f"{Info.INERTIAL}") - q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.PTG_INERTIAL)) + q.add_pus_tc( + pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.PTG_INERTIAL) + ) elif op_code in OpCodes.SAFE_PTG: q.add_log_cmd(f"{Info.SAFE_PTG}") - q.add_pus_tc(create_action_cmd(ACS_CONTROLLER, ActionId.SOLAR_ARRAY_DEPLOYMENT_SUCCESSFUL)) + q.add_pus_tc( + create_action_cmd( + ACS_CONTROLLER, ActionId.SOLAR_ARRAY_DEPLOYMENT_SUCCESSFUL + ) + ) elif op_code in OpCodes.RESET_MEKF: q.add_log_cmd(f"{Info.RESET_MEKF}") q.add_pus_tc(create_action_cmd(ACS_CONTROLLER, ActionId.RESET_MEKF)) @@ -406,7 +414,9 @@ def pack_acs_ctrl_command(p: ServiceProviderParams): ) elif op_code in OpCodes.REQUEST_MEKF_HK: q.add_log_cmd(Info.REQUEST_MEKF_HK) - q.add_pus_tc(create_request_one_diag_command(make_sid(ACS_CONTROLLER, SetId.MEKF_DATA))) + q.add_pus_tc( + create_request_one_diag_command(make_sid(ACS_CONTROLLER, SetId.MEKF_DATA)) + ) elif op_code in OpCodes.ENABLE_MEKF_HK: q.add_log_cmd(Info.ENABLE_MEKF_HK) cmd_tuple = enable_periodic_hk_command_with_interval( @@ -462,8 +472,12 @@ def pack_acs_ctrl_command(p: ServiceProviderParams): def set_acs_ctrl_param_scalar(q: DefaultPusQueueHelper): - pt = int(input("Specify parameter type to set {0: \"uint8\", 1: \"uint16\", 2: \"int32\", 3: \"float\", " - "4: \"double\"}: ")) + pt = int( + input( + 'Specify parameter type to set {0: "uint8", 1: "uint16", 2: "int32", 3: "float", ' + '4: "double"}: ' + ) + ) sid = int(input("Specify parameter struct ID to set: ")) pid = int(input("Specify parameter ID to set: ")) match pt: @@ -530,7 +544,7 @@ def set_acs_ctrl_param_scalar(q: DefaultPusQueueHelper): def set_acs_ctrl_param_vector(q: DefaultPusQueueHelper): - pt = int(input("Specify parameter type to set {0: \"float\", 1: \"double\"}: ")) + pt = int(input('Specify parameter type to set {0: "float", 1: "double"}: ')) sid = int(input("Specify parameter struct ID to set: ")) pid = int(input("Specify parameter ID to set: ")) match pt: @@ -538,7 +552,9 @@ def set_acs_ctrl_param_vector(q: DefaultPusQueueHelper): elms = int(input("Specify number of elements in vector to set: ")) param = [] for _ in range(elms): - param.append(float(input("Specify parameter vector entry value to set: "))) + param.append( + float(input("Specify parameter vector entry value to set: ")) + ) print(param) if input("Confirm selected parameter values (Y/N): ") == "Y": q.add_pus_tc( @@ -558,7 +574,9 @@ def set_acs_ctrl_param_vector(q: DefaultPusQueueHelper): elms = int(input("Specify number of elements in vector to set: ")) param = [] for _ in range(elms): - param.append(float(input("Specify parameter vector entry value to set: "))) + param.append( + float(input("Specify parameter vector entry value to set: ")) + ) print(param) if input("Confirm selected parameter values (Y/N): ") == "Y": q.add_pus_tc( @@ -577,7 +595,7 @@ def set_acs_ctrl_param_vector(q: DefaultPusQueueHelper): def set_acs_ctrl_param_matrix(q: DefaultPusQueueHelper): - pt = int(input("Specify parameter type to set {0: \"float\", 1: \"double\"}: ")) + pt = int(input('Specify parameter type to set {0: "float", 1: "double"}: ')) sid = int(input("Specify parameter struct ID to set: ")) pid = int(input("Specify parameter ID to set: ")) match pt: @@ -588,7 +606,9 @@ def set_acs_ctrl_param_matrix(q: DefaultPusQueueHelper): param = [] for _ in range(rows): for _ in range(cols): - row.append(float(input("Specify parameter vector entry value to set: "))) + row.append( + float(input("Specify parameter vector entry value to set: ")) + ) param.append(row) print(param) if input("Confirm selected parameter values (Y/N): ") == "Y": @@ -612,7 +632,9 @@ def set_acs_ctrl_param_matrix(q: DefaultPusQueueHelper): param = [] for _ in range(rows): for _ in range(cols): - row.append(float(input("Specify parameter vector entry value to set: "))) + row.append( + float(input("Specify parameter vector entry value to set: ")) + ) param.append(row) row = [] print(param) @@ -930,8 +952,15 @@ def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes): def handle_mekf_data(pw: PrintWrapper, hk_data: bytes): - mekf_status = {0 : "UNINITIALIZED", 1: "NO_GYR_DATA", 2: "NO_MODEL_VECTORS", 3: "NO_SUS_MGM_STR_DATA", - 4: "COVARIANCE_INVERSION_FAILED", 10: "INITIALIZED", 11: "RUNNING"} + mekf_status = { + 0: "UNINITIALIZED", + 1: "NO_GYR_DATA", + 2: "NO_MODEL_VECTORS", + 3: "NO_SUS_MGM_STR_DATA", + 4: "COVARIANCE_INVERSION_FAILED", + 10: "INITIALIZED", + 11: "RUNNING", + } pw.dlog("Received MEKF Set") fmt_quat = "!dddd" fmt_str_4 = "[{:8.3f}, {:8.3f}, {:8.3f}, {:8.3f}]" diff --git a/eive_tmtc/tmtc/acs/gyros.py b/eive_tmtc/tmtc/acs/gyros.py index 3e21a59..a5823d7 100644 --- a/eive_tmtc/tmtc/acs/gyros.py +++ b/eive_tmtc/tmtc/acs/gyros.py @@ -95,7 +95,9 @@ def handle_gyr_cmd(q: DefaultPusQueueHelper, op_code: str): PusTelecommand( service=201, subservice=Subservice.TC_SET_HEALTH, - app_data=pack_set_health_cmd_data(object_id=gyr_obj_id, health=FsfwHealth.FAULTY) + app_data=pack_set_health_cmd_data( + object_id=gyr_obj_id, health=FsfwHealth.FAULTY + ), ) ) else: diff --git a/eive_tmtc/tmtc/acs/imtq.py b/eive_tmtc/tmtc/acs/imtq.py index 2853789..33bc91b 100644 --- a/eive_tmtc/tmtc/acs/imtq.py +++ b/eive_tmtc/tmtc/acs/imtq.py @@ -22,7 +22,11 @@ from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_3_fsfw_hk import ( make_sid, generate_one_diag_command, - generate_one_hk_command, create_request_one_diag_command, + generate_one_hk_command, + create_request_one_diag_command, + create_enable_periodic_hk_command, + create_disable_periodic_hk_command, + create_enable_periodic_hk_command_with_interval, ) from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode from tmtccmd.util import ObjectIdU32 @@ -37,8 +41,12 @@ class OpCode: NORMAL = "normal" OFF = "off" SET_DIPOLE = "set_dipole" - REQUEST_ENG_HK = "hk_os_eng_hk" - REQUEST_MGM_RAW = "hk_os_mgm_raw" + REQUEST_ENG_HK_NO_TORQUE = "hk_os_eng_hk" + REQUEST_MGM_RAW_NO_TORQUE = "hk_os_mgm_raw" + ENABLE_MGM_RAW_NO_TORQUE = "enb_mgm_raw_no_torque" + DISABLE_MGM_RAW_NO_TORQUE = "dis_mgm_raw_no_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" NEG_X_SELF_TEST = "self_test_neg_x" POS_Y_SELF_TEST = "self_test_pos_y" @@ -85,8 +93,8 @@ def add_imtq_cmds(defs: TmtcDefinitionWrapper): oce.add(OpCode.OFF, "Mode Off") oce.add(OpCode.ON, "Mode On") oce.add(OpCode.NORMAL, "Mode Normal") - oce.add(OpCode.REQUEST_ENG_HK, "Request Engineering HK One Shot") - oce.add(OpCode.REQUEST_MGM_RAW, "Request MGM Raw HK One Shot") + 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.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") @@ -214,7 +222,41 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod 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.REQUEST_ENG_HK: + 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: ")) + cmds = create_enable_periodic_hk_command_with_interval( + diag=True, + sid=make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_NO_TORQUE), + interval_seconds=interval, + ) + 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( + create_disable_periodic_hk_command( + True, make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_NO_TORQUE) + ) + ) + if op_code == OpCode.REQUEST_ENG_HK_NO_TORQUE: q.add_log_cmd("IMTQ: Get engineering hk set") q.add_pus_tc( generate_one_diag_command( @@ -232,7 +274,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod ) ) - if op_code == OpCode.REQUEST_MGM_RAW: + if op_code == OpCode.REQUEST_MGM_RAW_NO_TORQUE: q.add_log_cmd("IMTQ: Get raw MTM hk set") q.add_pus_tc( create_request_one_diag_command( diff --git a/eive_tmtc/tmtc/acs/mgms.py b/eive_tmtc/tmtc/acs/mgms.py index 5d7ecc2..9d11555 100644 --- a/eive_tmtc/tmtc/acs/mgms.py +++ b/eive_tmtc/tmtc/acs/mgms.py @@ -5,7 +5,12 @@ from eive_tmtc.config.definitions import CustomServiceList from tmtccmd.config import OpCodeEntry import eive_tmtc.config.object_ids as obj_ids -from eive_tmtc.config.object_ids import MGM_0_LIS3_HANDLER_ID, MGM_1_RM3100_HANDLER_ID, MGM_2_LIS3_HANDLER_ID, MGM_3_RM3100_HANDLER_ID +from eive_tmtc.config.object_ids import ( + MGM_0_LIS3_HANDLER_ID, + MGM_1_RM3100_HANDLER_ID, + MGM_2_LIS3_HANDLER_ID, + MGM_3_RM3100_HANDLER_ID, +) from eive_tmtc.pus_tm.defs import PrintWrapper from tmtccmd.config.tmtc import tmtc_definitions_provider, TmtcDefinitionWrapper diff --git a/eive_tmtc/tmtc/com/pdec_handler.py b/eive_tmtc/tmtc/com/pdec_handler.py index 508a5da..fbe10c8 100644 --- a/eive_tmtc/tmtc/com/pdec_handler.py +++ b/eive_tmtc/tmtc/com/pdec_handler.py @@ -8,13 +8,9 @@ from spacepackets.ecss.tc import PusTelecommand from tmtccmd.tc import DefaultPusQueueHelper -from tmtccmd.tc.pus_20_fsfw_param import ( - create_load_param_cmd -) +from tmtccmd.tc.pus_20_fsfw_param import create_load_param_cmd -from tmtccmd.pus.s20_fsfw_param_defs import ( - create_scalar_u8_parameter -) +from tmtccmd.pus.s20_fsfw_param_defs import create_scalar_u8_parameter from tmtccmd.config.tmtc import ( tmtc_definitions_provider, @@ -46,7 +42,9 @@ class OpCode: class Info: PRINT_CLCW = "Will cause the OBSW to print the current CLCW to the debug console" - PRINT_MON_REG = "Will cause the OBSW to print the PDEC monitor register to the console" + PRINT_MON_REG = ( + "Will cause the OBSW to print the PDEC monitor register to the console" + ) POSITIVE_WINDOW = "Change positive window parameter for AD frames" NEGATIVE_WINDOW = "Change negative window parameter for AD frames"