init
This commit is contained in:
parent
383b32141c
commit
6385a4a7db
@ -13,6 +13,7 @@ from tmtccmd.config.tmtc import (
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc.pus_20_params import pack_scalar_boolean_parameter_app_data
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
@ -41,25 +42,69 @@ class SetIds(enum.IntEnum):
|
||||
|
||||
|
||||
class OpCodes:
|
||||
REQUEST_MGM_HK = ["0", "mgm_raw_hk"]
|
||||
ENABLE_MGM_HK = ["1", "enable_raw_hk"]
|
||||
DISABLE_MGM_HK = ["1", "disable_raw_hk"]
|
||||
REQUEST_PROC_MGM_HK = ["mgm_proc_hk"]
|
||||
REQUEST_RAW_GYRO_HK = ["gyro_raw_hk"]
|
||||
REQUEST_PROC_GYRO_HK = ["gyro_proc_hk"]
|
||||
REQUEST_RAW_SUS_HK = ["sus_raw_hk"]
|
||||
REQUEST_PROC_SUS_HK = ["sus_proc_hk"]
|
||||
REQUEST_RAW_MGM_HK = ["0", "mgm_raw_hk"]
|
||||
ENABLE_RAW_MGM_HK = ["1", "enable_mgm_raw_hk"]
|
||||
DISABLE_RAW_MGM_HK = ["2", "disable_mgm_raw_hk"]
|
||||
REQUEST_PROC_MGM_HK = ["3", "mgm_proc_hk"]
|
||||
ENABLE_PROC_MGM_HK = ["4", "enable_mgm_proc_hk"]
|
||||
DISABLE_PROC_MGM_HK = ["5", "disable_mgm_proc_hk"]
|
||||
REQUEST_RAW_SUS_HK = ["6", "sus_raw_hk"]
|
||||
ENABLE_RAW_SUS_HK = ["7", "enable_sus_raw_hk"]
|
||||
DISABLE_RAW_SUS_HK = ["8", "disable_sus_raw_hk"]
|
||||
REQUEST_PROC_SUS_HK = ["9", "sus_proc_hk"]
|
||||
ENABLE_PROC_SUS_HK = ["10", "enable_sus_proc_hk"]
|
||||
DISABLE_PROC_SUS_HK = ["11", "disable_sus_proc_hk"]
|
||||
REQUEST_RAW_GYR_HK = ["12", "gyr_raw_hk"]
|
||||
ENABLE_RAW_GYR_HK = ["13", "enable_gyr_raw_hk"]
|
||||
DISABLE_RAW_GYR_HK = ["14", "disable_gyr_raw_hk"]
|
||||
REQUEST_PROC_GYR_HK = ["15", "gyr_proc_hk"]
|
||||
ENABLE_PROC_GYR_HK = ["16", "enable_gyr_proc_hk"]
|
||||
DISABLE_PROC_GYR_HK = ["17", "disable_gyr_proc_hk"]
|
||||
REQUEST_PROC_GPS_HK = ["18", "gps_proc_hk"]
|
||||
ENABLE_PROC_GPS_HK = ["19", "enable_gps_proc_hk"]
|
||||
DISABLE_PROC_GPS_HK = ["20", "disable_gps_proc_hk"]
|
||||
REQUEST_MEKF_HK = ["21", "mekf_hk"]
|
||||
ENABLE_MEKF_HK = ["22", "enable_mekf_hk"]
|
||||
DISABLE_MEKF_HK = ["23", "disable_mekf_hk"]
|
||||
REQUEST_CTRL_VAL_HK = ["24", "ctrl_val_hk"]
|
||||
ENABLE_CTRL_VAL_HK = ["25", "enable_ctrl_val_hk"]
|
||||
DISABLE_CTRL_VAL_HK = ["26", "disable_ctrl_val_hk"]
|
||||
REQUEST_ACT_CMD_HK = ["27", "act_cmd_hk"]
|
||||
ENABLE_ACT_CMD_HK = ["28", "enable act_cmd_hk"]
|
||||
DISABLE_ACT_CMD_HK = ["29", "disable act_cmd_hk"]
|
||||
|
||||
|
||||
class Info:
|
||||
REQUEST_MGM_HK = "Request MGM HK once"
|
||||
ENABLE_MGM_HK = "Enable MGM HK data generation"
|
||||
DISABLE_MGM_HK = "Disable MGM HK data generation"
|
||||
REQUEST_RAW_MGM_HK = "Request Raw MGM HK once"
|
||||
ENABLE_RAW_MGM_HK = "Enable Raw MGM HK data generation"
|
||||
DISABLE_RAW_MGM_HK = "Disable Raw MGM HK data generation"
|
||||
REQUEST_PROC_MGM_HK = "Request Processed MGM HK"
|
||||
REQUEST_RAW_GYRO_HK = "Request Raw Gyro HK"
|
||||
REQUEST_PROC_GYRO_HK = "Request Processed Gyro HK"
|
||||
ENABLE_PROC_MGM_HK = "Enable Processed MGM HK data generation"
|
||||
DISABLE_PROC_MGM_HK = "Disable Processed MGM HK data generation"
|
||||
REQUEST_RAW_SUS_HK = "Request Raw SUS HK"
|
||||
ENABLE_RAW_SUS_HK = "Enable Raw SUS HK data generation"
|
||||
DISABLE_RAW_SUS_HK = "Disable Raw SUS HK data generation"
|
||||
REQUEST_PROC_SUS_HK = "Request Processed SUS HK"
|
||||
ENABLE_PROC_SUS_HK = "Enable Processed SUS HK data generation"
|
||||
DISABLE_PROC_SUS_HK = "Disable Processed MGM HK data generation"
|
||||
REQUEST_RAW_GYR_HK = "Request Raw GYR HK"
|
||||
ENABLE_RAW_GYR_HK = "Enable Raw GYR HK data generation"
|
||||
DISABLE_RAW_GYR_HK = "Disable Raw GYR HK data generation"
|
||||
REQUEST_PROC_GYR_HK = "Request Processed GYR HK"
|
||||
ENABLE_PROC_GYR_HK = "Enable Processed GYR HK data generation"
|
||||
DISABLE_PROC_GYR_HK = "Disable Processed GYR HK data generation"
|
||||
REQUEST_PROC_GPS_HK = "Request Processed GPS HK"
|
||||
ENABLE_PROC_GPS_HK = "Enable Processed GPS HK data generation"
|
||||
DISABLE_PROC_GPS_HK = "Disable Processed GPS HK data generation"
|
||||
REQUEST_MEKF_HK = "Request MEKF HK"
|
||||
ENABLE_MEKF_HK = "Enable MEKF HK data generation"
|
||||
DISABLE_MEKF_HK = "Disable MEKF HK data generation"
|
||||
REQUEST_CTRL_VAL_HK = "Request Control Values HK"
|
||||
ENABLE_CTRL_VAL_HK = "Enable Control Values HK data generation"
|
||||
DISABLE_CTRL_VAL_HK = "Disable Control Values HK data generation"
|
||||
REQUEST_ACT_CMD_HK = "Request Actuator Commands HK"
|
||||
ENABLE_ACT_CMD_HK = "Enable Actuator Commands HK data generation"
|
||||
DISABLE_ACT_CMD_HK = "Disable Actuator Commands HK data generation"
|
||||
|
||||
|
||||
PERFORM_MGM_CALIBRATION = False
|
||||
@ -77,9 +122,36 @@ if PERFORM_MGM_CALIBRATION:
|
||||
@tmtc_definitions_provider
|
||||
def acs_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodes.REQUEST_MGM_HK, info=Info.REQUEST_MGM_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_MGM_HK, info=Info.ENABLE_MGM_HK)
|
||||
oce.add(keys=OpCodes.DISABLE_MGM_HK, info=Info.DISABLE_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.DISABLE_RAW_MGM_HK, info=Info.DISABLE_RAW_MGM_HK)
|
||||
oce.add(keys=OpCodes.REQUEST_PROC_MGM_HK, info=Info.REQUEST_PROC_MGM_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_PROC_MGM_HK, info=Info.ENABLE_PROC_MGM_HK)
|
||||
oce.add(keys=OpCodes.DISABLE_PROC_MGM_HK, info=Info.DISABLE_PROC_MGM_HK)
|
||||
oce.add(keys=OpCodes.REQUEST_RAW_SUS_HK, info=Info.REQUEST_RAW_SUS_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_RAW_SUS_HK, info=Info.ENABLE_RAW_SUS_HK)
|
||||
oce.add(keys=OpCodes.DISABLE_RAW_SUS_HK, info=Info.DISABLE_RAW_SUS_HK)
|
||||
oce.add(keys=OpCodes.REQUEST_PROC_SUS_HK, info=Info.REQUEST_PROC_SUS_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_PROC_SUS_HK, info=Info.ENABLE_PROC_SUS_HK)
|
||||
oce.add(keys=OpCodes.DISABLE_PROC_SUS_HK, info=Info.DISABLE_PROC_SUS_HK)
|
||||
oce.add(keys=OpCodes.REQUEST_RAW_GYR_HK, info=Info.REQUEST_RAW_GYR_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_RAW_GYR_HK, info=Info.ENABLE_RAW_GYR_HK)
|
||||
oce.add(keys=OpCodes.DISABLE_RAW_GYR_HK, info=Info.DISABLE_RAW_GYR_HK)
|
||||
oce.add(keys=OpCodes.REQUEST_PROC_GYR_HK, info=Info.REQUEST_PROC_GYR_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_PROC_GYR_HK, info=Info.ENABLE_PROC_GYR_HK)
|
||||
oce.add(keys=OpCodes.DISABLE_PROC_GYR_HK, info=Info.DISABLE_PROC_GYR_HK)
|
||||
oce.add(keys=OpCodes.REQUEST_PROC_GPS_HK, info=Info.REQUEST_PROC_GPS_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_PROC_GPS_HK, info=Info.ENABLE_PROC_GPS_HK)
|
||||
oce.add(keys=OpCodes.DISABLE_PROC_GPS_HK, info=Info.DISABLE_PROC_GPS_HK)
|
||||
oce.add(keys=OpCodes.REQUEST_MEKF_HK, info=Info.REQUEST_MEKF_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_MEKF_HK, info=Info.ENABLE_MEKF_HK)
|
||||
oce.add(keys=OpCodes.DISABLE_MEKF_HK, info=Info.DISABLE_MEKF_HK)
|
||||
oce.add(keys=OpCodes.REQUEST_CTRL_VAL_HK, info=Info.REQUEST_CTRL_VAL_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_CTRL_VAL_HK, info=Info.ENABLE_CTRL_VAL_HK)
|
||||
oce.add(keys=OpCodes.DISABLE_CTRL_VAL_HK, info=Info.DISABLE_CTRL_VAL_HK)
|
||||
oce.add(keys=OpCodes.REQUEST_ACT_CMD_HK, info=Info.REQUEST_ACT_CMD_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_ACT_CMD_HK, info=Info.ENABLE_ACT_CMD_HK)
|
||||
oce.add(keys=OpCodes.DISABLE_ACT_CMD_HK, info=Info.DISABLE_ACT_CMD_HK)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.ACS_CTRL.value, info="ACS Controller", op_code_entry=oce
|
||||
)
|
||||
@ -89,36 +161,144 @@ def acs_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
def pack_acs_ctrl_command(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
sid = make_sid(ACS_CONTROLLER, SetIds.MGM_RAW_SET)
|
||||
if op_code in OpCodes.REQUEST_MGM_HK:
|
||||
q.add_log_cmd(Info.REQUEST_MGM_HK)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
elif op_code in OpCodes.ENABLE_MGM_HK:
|
||||
q.add_log_cmd(Info.ENABLE_MGM_HK)
|
||||
cmd_tuple = enable_periodic_hk_command_with_interval(False, sid, 2.0)
|
||||
if op_code in OpCodes.REQUEST_RAW_MGM_HK:
|
||||
q.add_log_cmd(Info.REQUEST_RAW_MGM_HK)
|
||||
q.add_pus_tc(generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.MGM_RAW_SET)))
|
||||
elif op_code in OpCodes.ENABLE_RAW_MGM_HK:
|
||||
q.add_log_cmd(Info.ENABLE_RAW_MGM_HK)
|
||||
cmd_tuple = enable_periodic_hk_command_with_interval(False, make_sid(ACS_CONTROLLER, SetIds.MGM_RAW_SET), 2.0)
|
||||
q.add_pus_tc(cmd_tuple[0])
|
||||
q.add_pus_tc(cmd_tuple[1])
|
||||
elif op_code in OpCodes.DISABLE_MGM_HK:
|
||||
q.add_log_cmd(Info.DISABLE_MGM_HK)
|
||||
q.add_pus_tc(disable_periodic_hk_command(False, sid))
|
||||
elif op_code in OpCodes.DISABLE_RAW_MGM_HK:
|
||||
q.add_log_cmd(Info.DISABLE_RAW_MGM_HK)
|
||||
q.add_pus_tc(disable_periodic_hk_command(False, make_sid(ACS_CONTROLLER, SetIds.MGM_RAW_SET)))
|
||||
elif op_code in OpCodes.REQUEST_PROC_MGM_HK:
|
||||
q.add_log_cmd(Info.REQUEST_PROC_MGM_HK)
|
||||
q.add_pus_tc(generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.MGM_PROC_SET)))
|
||||
elif op_code in OpCodes.ENABLE_PROC_MGM_HK:
|
||||
q.add_log_cmd(Info.ENABLE_PROC_MGM_HK)
|
||||
cmd_tuple = enable_periodic_hk_command_with_interval(False, make_sid(ACS_CONTROLLER, SetIds.MGM_PROC_SET), 2.0)
|
||||
q.add_pus_tc(cmd_tuple[0])
|
||||
q.add_pus_tc(cmd_tuple[1])
|
||||
elif op_code in OpCodes.DISABLE_PROC_MGM_HK:
|
||||
q.add_log_cmd(Info.DISABLE_PROC_MGM_HK)
|
||||
q.add_pus_tc(disable_periodic_hk_command(False, make_sid(ACS_CONTROLLER, SetIds.MGM_PROC_SET)))
|
||||
elif op_code in OpCodes.REQUEST_RAW_SUS_HK:
|
||||
q.add_log_cmd(Info.REQUEST_RAW_SUS_HK)
|
||||
q.add_pus_tc(generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.SUS_RAW_SET)))
|
||||
elif op_code in OpCodes.ENABLE_RAW_SUS_HK:
|
||||
q.add_log_cmd(Info.ENABLE_RAW_SUS_HK)
|
||||
cmd_tuple = enable_periodic_hk_command_with_interval(False, make_sid(ACS_CONTROLLER, SetIds.SUS_RAW_SET), 2.0)
|
||||
q.add_pus_tc(cmd_tuple[0])
|
||||
q.add_pus_tc(cmd_tuple[1])
|
||||
elif op_code in OpCodes.DISABLE_RAW_SUS_HK:
|
||||
q.add_log_cmd(Info.DISABLE_RAW_SUS_HK)
|
||||
q.add_pus_tc(disable_periodic_hk_command(False, make_sid(ACS_CONTROLLER, SetIds.SUS_RAW_SET)))
|
||||
elif op_code in OpCodes.REQUEST_PROC_SUS_HK:
|
||||
q.add_log_cmd(Info.REQUEST_PROC_SUS_HK)
|
||||
q.add_pus_tc(generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.SUS_PROC_SET)))
|
||||
elif op_code in OpCodes.ENABLE_PROC_SUS_HK:
|
||||
q.add_log_cmd(Info.ENABLE_PROC_SUS_HK)
|
||||
cmd_tuple = enable_periodic_hk_command_with_interval(False, make_sid(ACS_CONTROLLER, SetIds.SUS_PROC_SET), 2.0)
|
||||
q.add_pus_tc(cmd_tuple[0])
|
||||
q.add_pus_tc(cmd_tuple[1])
|
||||
elif op_code in OpCodes.DISABLE_PROC_SUS_HK:
|
||||
q.add_log_cmd(Info.DISABLE_PROC_SUS_HK)
|
||||
q.add_pus_tc(disable_periodic_hk_command(False, make_sid(ACS_CONTROLLER, SetIds.SUS_PROC_SET)))
|
||||
elif op_code in OpCodes.REQUEST_RAW_GYR_HK:
|
||||
q.add_log_cmd(Info.REQUEST_RAW_GYR_HK)
|
||||
q.add_pus_tc(generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.GYR_RAW_SET)))
|
||||
elif op_code in OpCodes.ENABLE_RAW_GYR_HK:
|
||||
q.add_log_cmd(Info.ENABLE_RAW_GYR_HK)
|
||||
cmd_tuple = enable_periodic_hk_command_with_interval(False, make_sid(ACS_CONTROLLER, SetIds.GYR_RAW_SET), 2.0)
|
||||
q.add_pus_tc(cmd_tuple[0])
|
||||
q.add_pus_tc(cmd_tuple[1])
|
||||
elif op_code in OpCodes.DISABLE_RAW_GYR_HK:
|
||||
q.add_log_cmd(Info.DISABLE_RAW_GYR_HK)
|
||||
q.add_pus_tc(disable_periodic_hk_command(False, make_sid(ACS_CONTROLLER, SetIds.GYR_RAW_SET)))
|
||||
elif op_code in OpCodes.REQUEST_PROC_GYR_HK:
|
||||
q.add_log_cmd(Info.REQUEST_PROC_GYR_HK)
|
||||
q.add_pus_tc(generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.GYR_PROC_SET)))
|
||||
elif op_code in OpCodes.ENABLE_PROC_GYR_HK:
|
||||
q.add_log_cmd(Info.ENABLE_PROC_GYR_HK)
|
||||
cmd_tuple = enable_periodic_hk_command_with_interval(False, make_sid(ACS_CONTROLLER, SetIds.GYR_PROC_SET), 2.0)
|
||||
q.add_pus_tc(cmd_tuple[0])
|
||||
q.add_pus_tc(cmd_tuple[1])
|
||||
elif op_code in OpCodes.DISABLE_PROC_GYR_HK:
|
||||
q.add_log_cmd(Info.DISABLE_PROC_GYR_HK)
|
||||
q.add_pus_tc(disable_periodic_hk_command(False, make_sid(ACS_CONTROLLER, SetIds.GYR_PROC_SET)))
|
||||
elif op_code in OpCodes.REQUEST_PROC_GPS_HK:
|
||||
q.add_log_cmd(Info.REQUEST_PROC_GPS_HK)
|
||||
q.add_pus_tc(generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.GPS_PROC_SET)))
|
||||
elif op_code in OpCodes.ENABLE_PROC_GPS_HK:
|
||||
q.add_log_cmd(Info.ENABLE_PROC_GPS_HK)
|
||||
cmd_tuple = enable_periodic_hk_command_with_interval(False, make_sid(ACS_CONTROLLER, SetIds.GPS_PROC_SET), 2.0)
|
||||
q.add_pus_tc(cmd_tuple[0])
|
||||
q.add_pus_tc(cmd_tuple[1])
|
||||
elif op_code in OpCodes.DISABLE_PROC_GPS_HK:
|
||||
q.add_log_cmd(Info.DISABLE_PROC_GPS_HK)
|
||||
q.add_pus_tc(disable_periodic_hk_command(False, make_sid(ACS_CONTROLLER, SetIds.GPS_PROC_SET)))
|
||||
elif op_code in OpCodes.REQUEST_MEKF_HK:
|
||||
q.add_log_cmd(Info.REQUEST_MEKF_HK)
|
||||
q.add_pus_tc(generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.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(False, make_sid(ACS_CONTROLLER, SetIds.MEKF_DATA), 2.0)
|
||||
q.add_pus_tc(cmd_tuple[0])
|
||||
q.add_pus_tc(cmd_tuple[1])
|
||||
elif op_code in OpCodes.DISABLE_MEKF_HK:
|
||||
q.add_log_cmd(Info.DISABLE_MEKF_HK)
|
||||
q.add_pus_tc(disable_periodic_hk_command(False, make_sid(ACS_CONTROLLER, SetIds.MEKF_DATA)))
|
||||
elif op_code in OpCodes.REQUEST_CTRL_VAL_HK:
|
||||
q.add_log_cmd(Info.REQUEST_CTRL_VAL_HK)
|
||||
q.add_pus_tc(generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.CTRL_VAL_DATA)))
|
||||
elif op_code in OpCodes.ENABLE_CTRL_VAL_HK:
|
||||
q.add_log_cmd(Info.ENABLE_CTRL_VAL_HK)
|
||||
cmd_tuple = enable_periodic_hk_command_with_interval(False, make_sid(ACS_CONTROLLER, SetIds.CTRL_VAL_DATA), 2.0)
|
||||
q.add_pus_tc(cmd_tuple[0])
|
||||
q.add_pus_tc(cmd_tuple[1])
|
||||
elif op_code in OpCodes.DISABLE_CTRL_VAL_HK:
|
||||
q.add_log_cmd(Info.DISABLE_CTRL_VAL_HK)
|
||||
q.add_pus_tc(disable_periodic_hk_command(False, make_sid(ACS_CONTROLLER, SetIds.CTRL_VAL_DATA)))
|
||||
elif op_code in OpCodes.REQUEST_ACT_CMD_HK:
|
||||
q.add_log_cmd(Info.REQUEST_ACT_CMD_HK)
|
||||
q.add_pus_tc(generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.ACTUATOR_CMD_DATA)))
|
||||
elif op_code in OpCodes.ENABLE_ACT_CMD_HK:
|
||||
q.add_log_cmd(Info.ENABLE_ACT_CMD_HK)
|
||||
cmd_tuple = enable_periodic_hk_command_with_interval(False, make_sid(ACS_CONTROLLER, SetIds.ACTUATOR_CMD_DATA),
|
||||
2.0)
|
||||
q.add_pus_tc(cmd_tuple[0])
|
||||
q.add_pus_tc(cmd_tuple[1])
|
||||
elif op_code in OpCodes.DISABLE_ACT_CMD_HK:
|
||||
q.add_log_cmd(Info.DISABLE_ACT_CMD_HK)
|
||||
q.add_pus_tc(disable_periodic_hk_command(False, make_sid(ACS_CONTROLLER, SetIds.ACTUATOR_CMD_DATA)))
|
||||
else:
|
||||
LOGGER.info(f"Unknown op code {op_code}")
|
||||
|
||||
|
||||
def handle_acs_ctrl_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
if set_id == SetIds.MGM_RAW_SET:
|
||||
handle_raw_mgm_data(pw, hk_data)
|
||||
elif set_id == SetIds.MGM_PROC_SET:
|
||||
handle_mgm_data_processed(pw, hk_data)
|
||||
elif set_id == SetIds.GYR_RAW_SET:
|
||||
handle_gyr_data_raw(pw, hk_data)
|
||||
elif set_id == SetIds.GYR_PROC_SET:
|
||||
handle_gyr_data_processed(pw, hk_data)
|
||||
elif set_id == SetIds.SUS_RAW_SET:
|
||||
handle_acs_ctrl_sus_raw_data(pw, hk_data)
|
||||
elif set_id == SetIds.SUS_PROC_SET:
|
||||
handle_acs_ctrl_sus_processed_data(pw, hk_data)
|
||||
match set_id:
|
||||
case SetIds.MGM_RAW_SET:
|
||||
handle_raw_mgm_data(pw, hk_data)
|
||||
case SetIds.MGM_PROC_SET:
|
||||
handle_mgm_data_processed(pw, hk_data)
|
||||
case SetIds.SUS_RAW_SET:
|
||||
handle_acs_ctrl_sus_raw_data(pw, hk_data)
|
||||
case SetIds.SUS_PROC_SET:
|
||||
handle_acs_ctrl_sus_processed_data(pw, hk_data)
|
||||
case SetIds.GYR_RAW_SET:
|
||||
handle_gyr_data_raw(pw, hk_data)
|
||||
case SetIds.GYR_PROC_SET:
|
||||
handle_gyr_data_processed(pw, hk_data)
|
||||
case SetIds.GPS_PROC_SET:
|
||||
handle_gps_data_processed(pw, hk_data)
|
||||
case SetIds.MEKF_DATA:
|
||||
handle_mekf_data(pw, hk_data)
|
||||
case SetIds.CTRL_VAL_DATA:
|
||||
handle_ctrl_val_data(pw, hk_data)
|
||||
case SetIds.ACTUATOR_CMD_DATA:
|
||||
handle_act_cmd_data(pw, hk_data)
|
||||
|
||||
|
||||
def handle_acs_ctrl_sus_raw_data(pw: PrintWrapper, hk_data: bytes):
|
||||
@ -222,8 +402,8 @@ def handle_raw_mgm_data(pw: PrintWrapper, hk_data: bytes):
|
||||
"ACS Board MGM 1 RM3100",
|
||||
"ACS Board MGM 2 LIS3MDL",
|
||||
"ACS Board MGM 3 RM3100",
|
||||
"IMTQ Actuation Status:",
|
||||
"IMTQ MGM:",
|
||||
"IMTQ Actuation Status:",
|
||||
]
|
||||
for entry in zip(print_str_list, formatted_list):
|
||||
pw.dlog(f"{entry[0].ljust(28)}: {entry[1]}")
|
||||
@ -269,7 +449,7 @@ def handle_mgm_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||
|
||||
|
||||
def handle_gyr_data_raw(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog("Received Gyro Raw Set with rotation rates in deg per second")
|
||||
pw.dlog("Received GYR Raw Set with rotation rates in deg per second")
|
||||
float_fmt = "!fff"
|
||||
double_fmt = "!ddd"
|
||||
inc_len_flt = struct.calcsize(float_fmt)
|
||||
@ -294,18 +474,18 @@ def handle_gyr_data_raw(pw: PrintWrapper, hk_data: bytes):
|
||||
f"{val:8.3f}" for val in struct.unpack(float_fmt, hk_data[:inc_len_flt])
|
||||
]
|
||||
current_idx += inc_len_flt
|
||||
pw.dlog(f"Gyro 0 ADIS: {gyr_0_adis}")
|
||||
pw.dlog(f"Gyro 1 L3: {gyr_1_l3}")
|
||||
pw.dlog(f"Gyro 2 ADIS: {gyr_2_adis}")
|
||||
pw.dlog(f"Gyro 3 L3: {gyr_3_l3}")
|
||||
pw.dlog(f"GYR 0 ADIS: {gyr_0_adis}")
|
||||
pw.dlog(f"GYR 1 L3: {gyr_1_l3}")
|
||||
pw.dlog(f"GYR 2 ADIS: {gyr_2_adis}")
|
||||
pw.dlog(f"GYR 3 L3: {gyr_3_l3}")
|
||||
pw.printer.print_validity_buffer(hk_data[current_idx:], 4)
|
||||
|
||||
|
||||
GYRO_NAMES = ["Gyro 0 ADIS", "Gyro 1 L3", "Gyro 2 ADIS", "Gyro 3 L3"]
|
||||
GYR_NAMES = ["GYR 0 ADIS", "GYR 1 L3", "GYR 2 ADIS", "GYR 3 L3"]
|
||||
|
||||
|
||||
def handle_gyr_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog("Received Gyro Processed Set with rotation rates in deg per second")
|
||||
pw.dlog("Received GYR Processed Set with rotation rates in deg per second")
|
||||
fmt_str = "!ddd"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
current_idx = 0
|
||||
@ -316,16 +496,97 @@ def handle_gyr_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||
fmt_str, hk_data[current_idx : current_idx + inc_len]
|
||||
)
|
||||
]
|
||||
pw.dlog(f"{GYRO_NAMES[i]}: {gyr_vec}")
|
||||
pw.dlog(f"{GYR_NAMES[i]}: {gyr_vec}")
|
||||
current_idx += inc_len
|
||||
gyr_vec_tot = [
|
||||
f"{val:8.3f}"
|
||||
for val in struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
]
|
||||
pw.dlog(f"Gyro Vec Total: {gyr_vec_tot}")
|
||||
pw.dlog(f"GYR Vec Total: {gyr_vec_tot}")
|
||||
current_idx += inc_len
|
||||
|
||||
|
||||
def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog("Received GPS Processed Set")
|
||||
fmt_scalar = "!d"
|
||||
fmt_vec = "!ddd"
|
||||
inc_len_scalar = struct.calcsize(fmt_scalar)
|
||||
inc_len_vec = struct.calcsize(fmt_vec)
|
||||
if len(hk_data) < 2 * inc_len_scalar + inc_len_vec:
|
||||
pw.dlog("Received HK set too small")
|
||||
return
|
||||
current_idx = 0
|
||||
lat = [f"{val:8.3f}" for val in struct.unpack(fmt_scalar, hk_data[current_idx : current_idx + inc_len_scalar])]
|
||||
current_idx += inc_len_scalar
|
||||
long = [f"{val:8.3f}" for val in struct.unpack(fmt_scalar, hk_data[current_idx: current_idx + inc_len_scalar])]
|
||||
current_idx += inc_len_scalar
|
||||
velo = [f"{val:8.3f}" for val in struct.unpack(fmt_vec, hk_data[current_idx: current_idx + inc_len_vec])]
|
||||
pw.dlog(f"GPS Latitude: {lat} [rad]")
|
||||
pw.dlog(f"GPS Longitude: {long} [rad]")
|
||||
pw.dlog(f"GPS Velocity: {velo} [m/s]")
|
||||
|
||||
def handle_mekf_data(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog("Received MEKF Set")
|
||||
fmt_quat = "!dddd"
|
||||
fmt_vec = "!ddd"
|
||||
inc_len_quat = struct.calcsize(fmt_quat)
|
||||
inc_len_vec = struct.calcsize(fmt_vec)
|
||||
if len(hk_data) < inc_len_quat + inc_len_vec:
|
||||
pw.dlog("Received HK set too small")
|
||||
return
|
||||
current_idx = 0
|
||||
quat = [f"{val:8.3f}" for val in struct.unpack(fmt_quat, hk_data[current_idx : current_idx + inc_len_quat])]
|
||||
current_idx += inc_len_quat
|
||||
rate = [f"{val:8.3f}" for val in struct.unpack(fmt_vec, hk_data[current_idx : current_idx + inc_len_vec])]
|
||||
pw.dlog(f"MEKF Quaternion: {quat}")
|
||||
pw.dlog(f"MEKF Rotational Rate: {rate}")
|
||||
|
||||
|
||||
def handle_ctrl_val_data(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog("Received CTRL Values Set")
|
||||
fmt_quat = "!dddd"
|
||||
fmt_scalar = "!d"
|
||||
inc_len_quat = struct.calcsize(fmt_quat)
|
||||
inc_len_scalar = struct.calcsize(fmt_scalar)
|
||||
if len(hk_data) < 2 * inc_len_quat + inc_len_scalar:
|
||||
pw.dlog("Received HK set too small")
|
||||
return
|
||||
current_idx = 0
|
||||
tgt_quat = [f"{val:8.3f}" for val in struct.unpack(fmt_quat, hk_data[current_idx : current_idx + inc_len_quat])]
|
||||
current_idx += inc_len_quat
|
||||
err_quat = [f"{val:8.3f}" for val in struct.unpack(fmt_quat, hk_data[current_idx : current_idx + inc_len_quat])]
|
||||
current_idx += inc_len_quat
|
||||
err_ang = [f"{val:8.3f}" for val in struct.unpack(fmt_scalar, hk_data[current_idx : current_idx + inc_len_scalar])]
|
||||
pw.dlog(f"Control Values Target Quaternion: {tgt_quat}")
|
||||
pw.dlog(f"Control Values Error Quaternion: {err_quat}")
|
||||
pw.dlog(f"Control Values Error Angle: {err_ang} [rad]")
|
||||
|
||||
|
||||
def handle_act_cmd_data(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog("Received Actuator Command Values Set")
|
||||
fmt_vec4_double = "!dddd"
|
||||
fmt_vec4_int32 = "!iiii"
|
||||
fmt_vec3_int16 = "!hhh"
|
||||
inc_len_vec4_double = struct.calcsize(fmt_vec4_double)
|
||||
inc_len_vec4_int32 = struct.calcsize(fmt_vec4_int32)
|
||||
inc_len_vec3_int16 = struct.calcsize(fmt_vec3_int16)
|
||||
if len(hk_data) < inc_len_vec4_double + inc_len_vec4_int32 + inc_len_vec3_int16:
|
||||
pw.dlog("Received HK set too small")
|
||||
return
|
||||
current_idx = 0
|
||||
rw_tgt_torque = [f"{val:8.3f}" for val in struct.unpack(fmt_vec4_double, hk_data[current_idx : current_idx +
|
||||
inc_len_vec4_double])]
|
||||
current_idx += inc_len_vec4_double
|
||||
rw_tgt_speed = [f"{val:d}" for val in struct.unpack(fmt_vec4_int32, hk_data[current_idx : current_idx +
|
||||
inc_len_vec4_int32])]
|
||||
current_idx += inc_len_vec4_int32
|
||||
mtq_tgt_dipole = [f"{val:d}" for val in struct.unpack(fmt_vec3_int16, hk_data[current_idx : current_idx +
|
||||
inc_len_vec3_int16])]
|
||||
pw.dlog(f"Actuator Commands RW Target Torque: {rw_tgt_torque}")
|
||||
pw.dlog(f"Actuator Commands RW Target Speed: {rw_tgt_speed}")
|
||||
pw.dlog(f"Actuator Commands MTQ Target Dipole: {mtq_tgt_dipole}")
|
||||
|
||||
|
||||
def perform_mgm_calibration(pw: PrintWrapper, mgm_tuple: Tuple):
|
||||
global CALIBR_SOCKET, CALIBRATION_ADDR
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user