add some more imtq cmds

This commit is contained in:
Robin Müller 2023-03-02 14:41:23 +01:00
parent d2bc142b50
commit e5eb2e479c
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
5 changed files with 109 additions and 33 deletions

View File

@ -27,9 +27,7 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
from tmtccmd.tc.pus_20_fsfw_param import ( from tmtccmd.tc.pus_20_fsfw_param import create_load_param_cmd
create_load_param_cmd
)
from tmtccmd.pus.s20_fsfw_param_defs import ( from tmtccmd.pus.s20_fsfw_param_defs import (
create_scalar_u8_parameter, create_scalar_u8_parameter,
@ -67,10 +65,12 @@ class Submode(enum.IntEnum):
PTG_TARGET_GS = 15 PTG_TARGET_GS = 15
PTG_INERTIAL = 16 PTG_INERTIAL = 16
class ActionId(enum.IntEnum): class ActionId(enum.IntEnum):
SOLAR_ARRAY_DEPLOYMENT_SUCCESSFUL = 0 SOLAR_ARRAY_DEPLOYMENT_SUCCESSFUL = 0
RESET_MEKF = 1 RESET_MEKF = 1
class OpCodes: class OpCodes:
OFF = ["off"] OFF = ["off"]
SAFE = ["normal_safe"] 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)) q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.PTG_TARGET))
elif op_code in OpCodes.GS: elif op_code in OpCodes.GS:
q.add_log_cmd(f"{Info.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: elif op_code in OpCodes.INERTIAL:
q.add_log_cmd(f"{Info.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: elif op_code in OpCodes.SAFE_PTG:
q.add_log_cmd(f"{Info.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: elif op_code in OpCodes.RESET_MEKF:
q.add_log_cmd(f"{Info.RESET_MEKF}") q.add_log_cmd(f"{Info.RESET_MEKF}")
q.add_pus_tc(create_action_cmd(ACS_CONTROLLER, ActionId.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: elif op_code in OpCodes.REQUEST_MEKF_HK:
q.add_log_cmd(Info.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: elif op_code in OpCodes.ENABLE_MEKF_HK:
q.add_log_cmd(Info.ENABLE_MEKF_HK) q.add_log_cmd(Info.ENABLE_MEKF_HK)
cmd_tuple = enable_periodic_hk_command_with_interval( 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): def set_acs_ctrl_param_scalar(q: DefaultPusQueueHelper):
pt = int(input("Specify parameter type to set {0: \"uint8\", 1: \"uint16\", 2: \"int32\", 3: \"float\", " pt = int(
"4: \"double\"}: ")) 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: ")) sid = int(input("Specify parameter struct ID to set: "))
pid = int(input("Specify parameter ID to set: ")) pid = int(input("Specify parameter ID to set: "))
match pt: match pt:
@ -530,7 +544,7 @@ def set_acs_ctrl_param_scalar(q: DefaultPusQueueHelper):
def set_acs_ctrl_param_vector(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: ")) sid = int(input("Specify parameter struct ID to set: "))
pid = int(input("Specify parameter ID to set: ")) pid = int(input("Specify parameter ID to set: "))
match pt: 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: ")) elms = int(input("Specify number of elements in vector to set: "))
param = [] param = []
for _ in range(elms): 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) print(param)
if input("Confirm selected parameter values (Y/N): ") == "Y": if input("Confirm selected parameter values (Y/N): ") == "Y":
q.add_pus_tc( 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: ")) elms = int(input("Specify number of elements in vector to set: "))
param = [] param = []
for _ in range(elms): 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) print(param)
if input("Confirm selected parameter values (Y/N): ") == "Y": if input("Confirm selected parameter values (Y/N): ") == "Y":
q.add_pus_tc( q.add_pus_tc(
@ -577,7 +595,7 @@ def set_acs_ctrl_param_vector(q: DefaultPusQueueHelper):
def set_acs_ctrl_param_matrix(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: ")) sid = int(input("Specify parameter struct ID to set: "))
pid = int(input("Specify parameter ID to set: ")) pid = int(input("Specify parameter ID to set: "))
match pt: match pt:
@ -588,7 +606,9 @@ def set_acs_ctrl_param_matrix(q: DefaultPusQueueHelper):
param = [] param = []
for _ in range(rows): for _ in range(rows):
for _ in range(cols): 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) param.append(row)
print(param) print(param)
if input("Confirm selected parameter values (Y/N): ") == "Y": if input("Confirm selected parameter values (Y/N): ") == "Y":
@ -612,7 +632,9 @@ def set_acs_ctrl_param_matrix(q: DefaultPusQueueHelper):
param = [] param = []
for _ in range(rows): for _ in range(rows):
for _ in range(cols): 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) param.append(row)
row = [] row = []
print(param) 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): 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", mekf_status = {
4: "COVARIANCE_INVERSION_FAILED", 10: "INITIALIZED", 11: "RUNNING"} 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") pw.dlog("Received MEKF Set")
fmt_quat = "!dddd" fmt_quat = "!dddd"
fmt_str_4 = "[{:8.3f}, {:8.3f}, {:8.3f}, {:8.3f}]" fmt_str_4 = "[{:8.3f}, {:8.3f}, {:8.3f}, {:8.3f}]"

View File

@ -95,7 +95,9 @@ def handle_gyr_cmd(q: DefaultPusQueueHelper, op_code: str):
PusTelecommand( PusTelecommand(
service=201, service=201,
subservice=Subservice.TC_SET_HEALTH, 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: else:

View File

@ -21,7 +21,11 @@ from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_3_fsfw_hk import ( from tmtccmd.tc.pus_3_fsfw_hk import (
make_sid, make_sid,
generate_one_diag_command, 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.tc.pus_200_fsfw_mode import pack_mode_data, Mode
from tmtccmd.util import ObjectIdU32 from tmtccmd.util import ObjectIdU32
@ -36,8 +40,12 @@ class OpCode:
NORMAL = "normal" NORMAL = "normal"
OFF = "off" OFF = "off"
SET_DIPOLE = "set_dipole" SET_DIPOLE = "set_dipole"
REQUEST_ENG_HK = "hk_os_eng_hk" REQUEST_ENG_HK_NO_TORQUE = "hk_os_eng_hk"
REQUEST_MGM_RAW = "hk_os_mgm_raw" 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" POS_X_SELF_TEST = "self_test_pos_x"
NEG_X_SELF_TEST = "self_test_neg_x" NEG_X_SELF_TEST = "self_test_neg_x"
POS_Y_SELF_TEST = "self_test_pos_y" POS_Y_SELF_TEST = "self_test_pos_y"
@ -84,8 +92,8 @@ def add_imtq_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCode.OFF, "Mode Off") oce.add(OpCode.OFF, "Mode Off")
oce.add(OpCode.ON, "Mode On") oce.add(OpCode.ON, "Mode On")
oce.add(OpCode.NORMAL, "Mode Normal") oce.add(OpCode.NORMAL, "Mode Normal")
oce.add(OpCode.REQUEST_ENG_HK, "Request Engineering HK One Shot") oce.add(OpCode.REQUEST_ENG_HK_NO_TORQUE, "Request Engineering HK One Shot")
oce.add(OpCode.REQUEST_MGM_RAW, "Request MGM Raw 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.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.NEG_X_SELF_TEST, "IMTQ perform neg X self test")
oce.add(OpCode.POS_Y_SELF_TEST, "IMTQ perform pos Y self test") oce.add(OpCode.POS_Y_SELF_TEST, "IMTQ perform pos Y self test")
@ -213,7 +221,41 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
command = object_id.as_bytes + ImtqActionId.get_commanded_dipole command = object_id.as_bytes + ImtqActionId.get_commanded_dipole
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) 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_log_cmd("IMTQ: Get engineering hk set")
q.add_pus_tc( q.add_pus_tc(
generate_one_diag_command( generate_one_diag_command(
@ -231,7 +273,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_log_cmd("IMTQ: Get raw MTM hk set")
q.add_pus_tc( q.add_pus_tc(
create_request_one_diag_command( create_request_one_diag_command(

View File

@ -5,7 +5,12 @@ from eive_tmtc.config.definitions import CustomServiceList
from tmtccmd.config import OpCodeEntry from tmtccmd.config import OpCodeEntry
import eive_tmtc.config.object_ids as obj_ids 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 eive_tmtc.pus_tm.defs import PrintWrapper
from tmtccmd.config.tmtc import tmtc_definitions_provider, TmtcDefinitionWrapper from tmtccmd.config.tmtc import tmtc_definitions_provider, TmtcDefinitionWrapper

View File

@ -8,13 +8,9 @@
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_20_fsfw_param import ( from tmtccmd.tc.pus_20_fsfw_param import create_load_param_cmd
create_load_param_cmd
)
from tmtccmd.pus.s20_fsfw_param_defs import ( from tmtccmd.pus.s20_fsfw_param_defs import create_scalar_u8_parameter
create_scalar_u8_parameter
)
from tmtccmd.config.tmtc import ( from tmtccmd.config.tmtc import (
tmtc_definitions_provider, tmtc_definitions_provider,
@ -46,7 +42,9 @@ class OpCode:
class Info: class Info:
PRINT_CLCW = "Will cause the OBSW to print the current CLCW to the debug console" 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" POSITIVE_WINDOW = "Change positive window parameter for AD frames"
NEGATIVE_WINDOW = "Change negative window parameter for AD frames" NEGATIVE_WINDOW = "Change negative window parameter for AD frames"