Merge pull request 'fixes fixes fixes' (#126) from acs-ctrl-fixes into main
Reviewed-on: #126 Reviewed-by: Robin Müller <muellerr@irs.uni-stuttgart.de>
This commit is contained in:
commit
2b5ad32fdd
@ -41,45 +41,54 @@ class SetId(enum.IntEnum):
|
|||||||
CTRL_VAL_DATA = 8
|
CTRL_VAL_DATA = 8
|
||||||
ACTUATOR_CMD_DATA = 9
|
ACTUATOR_CMD_DATA = 9
|
||||||
|
|
||||||
|
class Submode(enum.IntEnum):
|
||||||
|
SAFE = 2
|
||||||
|
DETUMBLE = 3
|
||||||
|
IDLE = 4
|
||||||
|
|
||||||
|
|
||||||
class OpCodes:
|
class OpCodes:
|
||||||
OFF = ["off"]
|
OFF = ["off"]
|
||||||
NML = ["normal"]
|
SAFE = ["normal_safe"]
|
||||||
|
DTBL = ["normal_detumble"]
|
||||||
|
IDLE = ["normal_idle"]
|
||||||
REQUEST_RAW_MGM_HK = ["0", "mgm_raw_hk"]
|
REQUEST_RAW_MGM_HK = ["0", "mgm_raw_hk"]
|
||||||
ENABLE_RAW_MGM_HK = ["1", "enable_mgm_raw_hk"]
|
ENABLE_RAW_MGM_HK = ["1", "mgm_raw_enable_hk"]
|
||||||
DISABLE_RAW_MGM_HK = ["2", "disable_mgm_raw_hk"]
|
DISABLE_RAW_MGM_HK = ["2", "mgm_raw_disable_hk"]
|
||||||
REQUEST_PROC_MGM_HK = ["3", "mgm_proc_hk"]
|
REQUEST_PROC_MGM_HK = ["3", "mgm_proc_hk"]
|
||||||
ENABLE_PROC_MGM_HK = ["4", "enable_mgm_proc_hk"]
|
ENABLE_PROC_MGM_HK = ["4", "mgm_proc_enable_hk"]
|
||||||
DISABLE_PROC_MGM_HK = ["5", "disable_mgm_proc_hk"]
|
DISABLE_PROC_MGM_HK = ["5", "mgm_proc_disable_hk"]
|
||||||
REQUEST_RAW_SUS_HK = ["6", "sus_raw_hk"]
|
REQUEST_RAW_SUS_HK = ["6", "sus_raw_hk"]
|
||||||
ENABLE_RAW_SUS_HK = ["7", "enable_sus_raw_hk"]
|
ENABLE_RAW_SUS_HK = ["7", "sus_raw_enable_hk"]
|
||||||
DISABLE_RAW_SUS_HK = ["8", "disable_sus_raw_hk"]
|
DISABLE_RAW_SUS_HK = ["8", "sus_raw_disable_hk"]
|
||||||
REQUEST_PROC_SUS_HK = ["9", "sus_proc_hk"]
|
REQUEST_PROC_SUS_HK = ["9", "sus_proc_hk"]
|
||||||
ENABLE_PROC_SUS_HK = ["10", "enable_sus_proc_hk"]
|
ENABLE_PROC_SUS_HK = ["10", "sus_proc_enable_hk"]
|
||||||
DISABLE_PROC_SUS_HK = ["11", "disable_sus_proc_hk"]
|
DISABLE_PROC_SUS_HK = ["11", "sus_proc_disable_hk"]
|
||||||
REQUEST_RAW_GYR_HK = ["12", "gyr_raw_hk"]
|
REQUEST_RAW_GYR_HK = ["12", "gyr_raw_hk"]
|
||||||
ENABLE_RAW_GYR_HK = ["13", "enable_gyr_raw_hk"]
|
ENABLE_RAW_GYR_HK = ["13", "gyr_raw_enable_hk"]
|
||||||
DISABLE_RAW_GYR_HK = ["14", "disable_gyr_raw_hk"]
|
DISABLE_RAW_GYR_HK = ["14", "gyr_raw_disable_hk"]
|
||||||
REQUEST_PROC_GYR_HK = ["15", "gyr_proc_hk"]
|
REQUEST_PROC_GYR_HK = ["15", "gyr_proc_hk"]
|
||||||
ENABLE_PROC_GYR_HK = ["16", "enable_gyr_proc_hk"]
|
ENABLE_PROC_GYR_HK = ["16", "gyr_proc_enable_hk"]
|
||||||
DISABLE_PROC_GYR_HK = ["17", "disable_gyr_proc_hk"]
|
DISABLE_PROC_GYR_HK = ["17", "gyr_proc_disable_hk"]
|
||||||
REQUEST_PROC_GPS_HK = ["18", "gps_proc_hk"]
|
REQUEST_PROC_GPS_HK = ["18", "gps_proc_hk"]
|
||||||
ENABLE_PROC_GPS_HK = ["19", "enable_gps_proc_hk"]
|
ENABLE_PROC_GPS_HK = ["19", "gps_proc_enable_hk"]
|
||||||
DISABLE_PROC_GPS_HK = ["20", "disable_gps_proc_hk"]
|
DISABLE_PROC_GPS_HK = ["20", "gps_proc_disable_hk"]
|
||||||
REQUEST_MEKF_HK = ["21", "mekf_hk"]
|
REQUEST_MEKF_HK = ["21", "mekf_hk"]
|
||||||
ENABLE_MEKF_HK = ["22", "enable_mekf_hk"]
|
ENABLE_MEKF_HK = ["22", "mekf_enable_hk"]
|
||||||
DISABLE_MEKF_HK = ["23", "disable_mekf_hk"]
|
DISABLE_MEKF_HK = ["23", "mekf_disable_hk"]
|
||||||
REQUEST_CTRL_VAL_HK = ["24", "ctrl_val_hk"]
|
REQUEST_CTRL_VAL_HK = ["24", "ctrl_val_hk"]
|
||||||
ENABLE_CTRL_VAL_HK = ["25", "enable_ctrl_val_hk"]
|
ENABLE_CTRL_VAL_HK = ["25", "ctrl_val_enable_hk"]
|
||||||
DISABLE_CTRL_VAL_HK = ["26", "disable_ctrl_val_hk"]
|
DISABLE_CTRL_VAL_HK = ["26", "ctrl_val_disable_hk"]
|
||||||
REQUEST_ACT_CMD_HK = ["27", "act_cmd_hk"]
|
REQUEST_ACT_CMD_HK = ["27", "act_cmd_hk"]
|
||||||
ENABLE_ACT_CMD_HK = ["28", "enable act_cmd_hk"]
|
ENABLE_ACT_CMD_HK = ["28", "act_cmd_enable_hk"]
|
||||||
DISABLE_ACT_CMD_HK = ["29", "disable act_cmd_hk"]
|
DISABLE_ACT_CMD_HK = ["29", "act_cmd_disable_hk"]
|
||||||
|
|
||||||
|
|
||||||
class Info:
|
class Info:
|
||||||
OFF = "Switch ACS CTRL off"
|
OFF = "Switch ACS CTRL off"
|
||||||
NML = "Switch ACS CTRL normal"
|
SAFE = "Switch ACS CTRL normal safe"
|
||||||
|
DTBL = "Switch ACS CTRL normal detumble"
|
||||||
|
IDLE = "Switch ACS CTRL normal idle"
|
||||||
REQUEST_RAW_MGM_HK = "Request Raw MGM HK once"
|
REQUEST_RAW_MGM_HK = "Request Raw MGM HK once"
|
||||||
ENABLE_RAW_MGM_HK = "Enable Raw MGM HK data generation"
|
ENABLE_RAW_MGM_HK = "Enable Raw MGM HK data generation"
|
||||||
DISABLE_RAW_MGM_HK = "Disable Raw MGM HK data generation"
|
DISABLE_RAW_MGM_HK = "Disable Raw MGM HK data generation"
|
||||||
@ -128,7 +137,9 @@ if PERFORM_MGM_CALIBRATION:
|
|||||||
def acs_cmd_defs(defs: TmtcDefinitionWrapper):
|
def acs_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||||
oce = OpCodeEntry()
|
oce = OpCodeEntry()
|
||||||
oce.add(keys=OpCodes.OFF, info=Info.OFF)
|
oce.add(keys=OpCodes.OFF, info=Info.OFF)
|
||||||
oce.add(keys=OpCodes.NML, info=Info.NML)
|
oce.add(keys=OpCodes.SAFE, info=Info.SAFE)
|
||||||
|
oce.add(keys=OpCodes.DTBL, info=Info.DTBL)
|
||||||
|
oce.add(keys=OpCodes.IDLE, info=Info.IDLE)
|
||||||
oce.add(keys=OpCodes.REQUEST_RAW_MGM_HK, info=Info.REQUEST_RAW_MGM_HK)
|
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.ENABLE_RAW_MGM_HK, info=Info.ENABLE_RAW_MGM_HK)
|
||||||
oce.add(keys=OpCodes.DISABLE_RAW_MGM_HK, info=Info.DISABLE_RAW_MGM_HK)
|
oce.add(keys=OpCodes.DISABLE_RAW_MGM_HK, info=Info.DISABLE_RAW_MGM_HK)
|
||||||
@ -171,10 +182,16 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
|
|||||||
if op_code in OpCodes.OFF:
|
if op_code in OpCodes.OFF:
|
||||||
q.add_log_cmd(f"{Info.OFF}")
|
q.add_log_cmd(f"{Info.OFF}")
|
||||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.OFF, 0))
|
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.OFF, 0))
|
||||||
if op_code in OpCodes.NML:
|
elif op_code in OpCodes.SAFE:
|
||||||
q.add_log_cmd(f"{Info.NML}")
|
q.add_log_cmd(f"{Info.SAFE}")
|
||||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, 0))
|
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.SAFE))
|
||||||
if op_code in OpCodes.REQUEST_RAW_MGM_HK:
|
elif op_code in OpCodes.DTBL:
|
||||||
|
q.add_log_cmd(f"{Info.DTBL}")
|
||||||
|
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.DTBL))
|
||||||
|
elif op_code in OpCodes.IDLE:
|
||||||
|
q.add_log_cmd(f"{Info.IDLE}")
|
||||||
|
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.IDLE))
|
||||||
|
elif op_code in OpCodes.REQUEST_RAW_MGM_HK:
|
||||||
q.add_log_cmd(Info.REQUEST_RAW_MGM_HK)
|
q.add_log_cmd(Info.REQUEST_RAW_MGM_HK)
|
||||||
q.add_pus_tc(
|
q.add_pus_tc(
|
||||||
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.MGM_RAW_SET))
|
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.MGM_RAW_SET))
|
||||||
@ -428,10 +445,9 @@ def handle_acs_ctrl_sus_processed_data(pw: PrintWrapper, hk_data: bytes):
|
|||||||
pw.dlog(f"SUS {idx} CALIB: {sus_list_formatted}")
|
pw.dlog(f"SUS {idx} CALIB: {sus_list_formatted}")
|
||||||
fmt_str = "!ddd"
|
fmt_str = "!ddd"
|
||||||
inc_len = struct.calcsize(fmt_str)
|
inc_len = struct.calcsize(fmt_str)
|
||||||
sus_vec_tot = list(
|
sus_vec_tot = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||||
struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
|
||||||
)
|
sus_vec_tot = [f"{val:8.3f}" for val in sus_vec_tot]
|
||||||
sus_vec_tot = [f"{val:8.3f}" for val in {sus_vec_tot}]
|
|
||||||
current_idx += inc_len
|
current_idx += inc_len
|
||||||
pw.dlog(f"SUS Vector Total: {sus_vec_tot}")
|
pw.dlog(f"SUS Vector Total: {sus_vec_tot}")
|
||||||
sus_vec_tot_deriv = struct.unpack(
|
sus_vec_tot_deriv = struct.unpack(
|
||||||
@ -440,10 +456,8 @@ def handle_acs_ctrl_sus_processed_data(pw: PrintWrapper, hk_data: bytes):
|
|||||||
sus_vec_tot_deriv = [f"{val:8.3f}" for val in {sus_vec_tot_deriv}]
|
sus_vec_tot_deriv = [f"{val:8.3f}" for val in {sus_vec_tot_deriv}]
|
||||||
current_idx += inc_len
|
current_idx += inc_len
|
||||||
pw.dlog(f"SUS Vector Derivative: {sus_vec_tot_deriv}")
|
pw.dlog(f"SUS Vector Derivative: {sus_vec_tot_deriv}")
|
||||||
sun_ijk_model = list(
|
sun_ijk_model = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||||
struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
sun_ijk_model = [f"{val:8.3f}" for val in sun_ijk_model]
|
||||||
)
|
|
||||||
sun_ijk_model = [f"{val:8.3f}" for val in {sun_ijk_model}]
|
|
||||||
current_idx += inc_len
|
current_idx += inc_len
|
||||||
pw.dlog(f"SUS ijk Model: {sun_ijk_model}")
|
pw.dlog(f"SUS ijk Model: {sun_ijk_model}")
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=15)
|
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=15)
|
||||||
|
Loading…
Reference in New Issue
Block a user