add some more imtq cmds

This commit is contained in:
2023-03-02 14:41:23 +01:00
parent d2bc142b50
commit e5eb2e479c
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.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}]"