added command to set matrix parameter
This commit is contained in:
parent
6a30f6d0ac
commit
736bc23fc5
@ -39,6 +39,8 @@ from tmtccmd.pus.s20_fsfw_param_defs import (
|
||||
create_scalar_double_parameter,
|
||||
create_vector_float_parameter,
|
||||
create_vector_double_parameter,
|
||||
create_matrix_float_parameter,
|
||||
create_matrix_double_parameter,
|
||||
)
|
||||
|
||||
|
||||
@ -82,6 +84,7 @@ class OpCodes:
|
||||
RESET_MEKF = ["reset_mekf"]
|
||||
SET_PARAMETER_SCALAR = ["set_scalar_param"]
|
||||
SET_PARAMETER_VECTOR = ["set_vector_param"]
|
||||
SET_PARAMETER_MATRIX = ["set_matrix_param"]
|
||||
REQUEST_RAW_MGM_HK = ["0", "mgm_raw_hk"]
|
||||
ENABLE_RAW_MGM_HK = ["1", "mgm_raw_enable_hk"]
|
||||
DISABLE_RAW_MGM_HK = ["2", "mgm_raw_disable_hk"]
|
||||
@ -187,6 +190,7 @@ def acs_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
oce.add(keys=OpCodes.RESET_MEKF, info=Info.RESET_MEKF)
|
||||
oce.add(keys=OpCodes.SET_PARAMETER_SCALAR, info=Info.SET_PARAMETER_SCALAR)
|
||||
oce.add(keys=OpCodes.SET_PARAMETER_VECTOR, info=Info.SET_PARAMETER_VECTOR)
|
||||
oce.add(keys=OpCodes.SET_PARAMETER_MATRIX, info=Info.SET_PARAMETER_MATRIX)
|
||||
oce.add(keys=OpCodes.REQUEST_RAW_MGM_HK, info=Info.REQUEST_RAW_MGM_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_RAW_MGM_HK, info=Info.ENABLE_RAW_MGM_HK)
|
||||
oce.add(keys=OpCodes.DISABLE_RAW_MGM_HK, info=Info.DISABLE_RAW_MGM_HK)
|
||||
@ -262,6 +266,9 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
|
||||
elif op_code in OpCodes.SET_PARAMETER_VECTOR:
|
||||
q.add_log_cmd(f"{Info.SET_PARAMETER_VECTOR}")
|
||||
set_acs_ctrl_param_vector(q)
|
||||
elif op_code in OpCodes.SET_PARAMETER_MATRIX:
|
||||
q.add_log_cmd(f"{Info.SET_PARAMETER_MATRIX}")
|
||||
set_acs_ctrl_param_matrix(q)
|
||||
elif op_code in OpCodes.REQUEST_RAW_MGM_HK:
|
||||
q.add_log_cmd(Info.REQUEST_RAW_MGM_HK)
|
||||
q.add_pus_tc(
|
||||
@ -528,12 +535,12 @@ def set_acs_ctrl_param_vector(q: DefaultPusQueueHelper):
|
||||
pid = int(input("Specify parameter ID to set: "))
|
||||
match pt:
|
||||
case 0:
|
||||
nr = int(input("Specify number of elements in vector to set: "))
|
||||
elms = int(input("Specify number of elements in vector to set: "))
|
||||
param = []
|
||||
for _ in range(nr):
|
||||
for _ in range(elms):
|
||||
param.append(float(input("Specify parameter vector entry value to set: ")))
|
||||
print(param)
|
||||
if bool(input("Confirm selected parameter values (Y/N): ")):
|
||||
if input("Confirm selected parameter values (Y/N): ") == "Y":
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_vector_float_parameter(
|
||||
@ -548,12 +555,12 @@ def set_acs_ctrl_param_vector(q: DefaultPusQueueHelper):
|
||||
print("Aborting")
|
||||
return
|
||||
case 1:
|
||||
nr = int(input("Specify number of elements in vector to set: "))
|
||||
elms = int(input("Specify number of elements in vector to set: "))
|
||||
param = []
|
||||
for _ in range(nr):
|
||||
for _ in range(elms):
|
||||
param.append(float(input("Specify parameter vector entry value to set: ")))
|
||||
print(param)
|
||||
if bool(input("Confirm selected parameter values (Y/N): ")):
|
||||
if input("Confirm selected parameter values (Y/N): ") == "Y":
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_vector_double_parameter(
|
||||
@ -569,6 +576,62 @@ def set_acs_ctrl_param_vector(q: DefaultPusQueueHelper):
|
||||
return
|
||||
|
||||
|
||||
def set_acs_ctrl_param_matrix(q: DefaultPusQueueHelper):
|
||||
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:
|
||||
case 0:
|
||||
rows = int(input("Specify number of rows in matrix to set: "))
|
||||
cols = int(input("Specify number of columns in matrix to set: "))
|
||||
row = []
|
||||
param = []
|
||||
for _ in range(rows):
|
||||
for _ in range(cols):
|
||||
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":
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_matrix_float_parameter(
|
||||
object_id=ACS_CONTROLLER,
|
||||
domain_id=sid,
|
||||
unique_id=pid,
|
||||
parameters=param,
|
||||
).pack()
|
||||
)
|
||||
)
|
||||
else:
|
||||
print("Aborting")
|
||||
return
|
||||
case 1:
|
||||
rows = int(input("Specify number of rows in matrix to set: "))
|
||||
cols = int(input("Specify number of columns in matrix to set: "))
|
||||
row = []
|
||||
param = []
|
||||
for _ in range(rows):
|
||||
for _ in range(cols):
|
||||
row.append(float(input("Specify parameter vector entry value to set: ")))
|
||||
param.append(row)
|
||||
row = []
|
||||
print(param)
|
||||
if input("Confirm selected parameter values (Y/N): ") == "Y":
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_matrix_double_parameter(
|
||||
object_id=ACS_CONTROLLER,
|
||||
domain_id=sid,
|
||||
unique_id=pid,
|
||||
parameters=param,
|
||||
).pack()
|
||||
)
|
||||
)
|
||||
else:
|
||||
print("Aborting")
|
||||
return
|
||||
|
||||
|
||||
def handle_acs_ctrl_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
match set_id:
|
||||
|
Loading…
Reference in New Issue
Block a user