Compare commits

...

9 Commits

Author SHA1 Message Date
2b5ad32fdd 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>
2023-01-20 11:28:31 +01:00
b3b98eb2d2 add TCS subsystem commands 2023-01-20 11:28:07 +01:00
7d068d85c8 Merge branch 'main' into acs-ctrl-fixes 2023-01-20 10:52:48 +01:00
d6c35262bf Merge pull request 'Add SUS temps handling' (#124) from mueller_add_sus_temps into main
Reviewed-on: #124
2023-01-20 10:51:40 +01:00
1317441c03 Merge branch 'main' into mueller_add_sus_temps 2023-01-20 10:51:30 +01:00
cd8fdc4865 Merge branch 'main' into acs-ctrl-fixes 2023-01-20 10:51:22 +01:00
3a60fd2d6d black 2023-01-20 10:35:30 +01:00
d77ccbf8e9 fixes fixes fixes
- improved cmd OpCodes naming
- removed normal mode without submode which gets rejected anyways
- added normal mode with submodes
- fixed bugs in sus hk handling
2023-01-20 09:44:51 +01:00
2e40e31c15 bump changelog 2023-01-18 16:31:47 +01:00
5 changed files with 112 additions and 62 deletions

View File

@@ -11,6 +11,7 @@ list yields a list of all related PRs for each release.
# [unreleased]
- Unify and move Syrlinks module, some bugfixes
- Add/Re-enable handling for SUS temp packets
# [v2.3.0] and [v2.3.1] 18.01.2023

View File

@@ -126,6 +126,7 @@ SUS_11_R_LOC_XBYMZB_PT_ZB = bytes([0x44, 0x12, 0x00, 0x43])
# System and Assembly Objects
ACS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x01])
PL_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x02])
TCS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x03])
ACS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x01])
SUS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x02])
TCS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x03])

View File

@@ -99,7 +99,7 @@ def pack_rtd_commands(
)
)
if op_code in OpCode.WRITE_CONFIG:
command = object_id.as_bytes + struct.pack('!I', CommandId.WRITE_CONFIG)
command = object_id.as_bytes + struct.pack("!I", CommandId.WRITE_CONFIG)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))

View File

@@ -41,45 +41,54 @@ class SetId(enum.IntEnum):
CTRL_VAL_DATA = 8
ACTUATOR_CMD_DATA = 9
class Submode(enum.IntEnum):
SAFE = 2
DETUMBLE = 3
IDLE = 4
class OpCodes:
OFF = ["off"]
NML = ["normal"]
SAFE = ["normal_safe"]
DTBL = ["normal_detumble"]
IDLE = ["normal_idle"]
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"]
ENABLE_RAW_MGM_HK = ["1", "mgm_raw_enable_hk"]
DISABLE_RAW_MGM_HK = ["2", "mgm_raw_disable_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"]
ENABLE_PROC_MGM_HK = ["4", "mgm_proc_enable_hk"]
DISABLE_PROC_MGM_HK = ["5", "mgm_proc_disable_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"]
ENABLE_RAW_SUS_HK = ["7", "sus_raw_enable_hk"]
DISABLE_RAW_SUS_HK = ["8", "sus_raw_disable_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"]
ENABLE_PROC_SUS_HK = ["10", "sus_proc_enable_hk"]
DISABLE_PROC_SUS_HK = ["11", "sus_proc_disable_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"]
ENABLE_RAW_GYR_HK = ["13", "gyr_raw_enable_hk"]
DISABLE_RAW_GYR_HK = ["14", "gyr_raw_disable_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"]
ENABLE_PROC_GYR_HK = ["16", "gyr_proc_enable_hk"]
DISABLE_PROC_GYR_HK = ["17", "gyr_proc_disable_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"]
ENABLE_PROC_GPS_HK = ["19", "gps_proc_enable_hk"]
DISABLE_PROC_GPS_HK = ["20", "gps_proc_disable_hk"]
REQUEST_MEKF_HK = ["21", "mekf_hk"]
ENABLE_MEKF_HK = ["22", "enable_mekf_hk"]
DISABLE_MEKF_HK = ["23", "disable_mekf_hk"]
ENABLE_MEKF_HK = ["22", "mekf_enable_hk"]
DISABLE_MEKF_HK = ["23", "mekf_disable_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"]
ENABLE_CTRL_VAL_HK = ["25", "ctrl_val_enable_hk"]
DISABLE_CTRL_VAL_HK = ["26", "ctrl_val_disable_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"]
ENABLE_ACT_CMD_HK = ["28", "act_cmd_enable_hk"]
DISABLE_ACT_CMD_HK = ["29", "act_cmd_disable_hk"]
class Info:
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"
ENABLE_RAW_MGM_HK = "Enable 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):
oce = OpCodeEntry()
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.ENABLE_RAW_MGM_HK, info=Info.ENABLE_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:
q.add_log_cmd(f"{Info.OFF}")
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.OFF, 0))
if op_code in OpCodes.NML:
q.add_log_cmd(f"{Info.NML}")
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, 0))
if op_code in OpCodes.REQUEST_RAW_MGM_HK:
elif op_code in OpCodes.SAFE:
q.add_log_cmd(f"{Info.SAFE}")
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.SAFE))
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_pus_tc(
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.MGM_RAW_SET))
@@ -320,9 +337,7 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
elif op_code in OpCodes.DISABLE_MEKF_HK:
q.add_log_cmd(Info.DISABLE_MEKF_HK)
q.add_pus_tc(
disable_periodic_hk_command(
True, make_sid(ACS_CONTROLLER, SetId.MEKF_DATA)
)
disable_periodic_hk_command(True, make_sid(ACS_CONTROLLER, SetId.MEKF_DATA))
)
elif op_code in OpCodes.REQUEST_CTRL_VAL_HK:
q.add_log_cmd(Info.REQUEST_CTRL_VAL_HK)
@@ -430,10 +445,9 @@ def handle_acs_ctrl_sus_processed_data(pw: PrintWrapper, hk_data: bytes):
pw.dlog(f"SUS {idx} CALIB: {sus_list_formatted}")
fmt_str = "!ddd"
inc_len = struct.calcsize(fmt_str)
sus_vec_tot = list(
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 = 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]
current_idx += inc_len
pw.dlog(f"SUS Vector Total: {sus_vec_tot}")
sus_vec_tot_deriv = struct.unpack(
@@ -442,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}]
current_idx += inc_len
pw.dlog(f"SUS Vector Derivative: {sus_vec_tot_deriv}")
sun_ijk_model = list(
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 = 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]
current_idx += inc_len
pw.dlog(f"SUS ijk Model: {sun_ijk_model}")
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=15)

View File

@@ -15,25 +15,39 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
)
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
from eive_tmtc.config.object_ids import TCS_BOARD_ASS_ID, TCS_CONTROLLER
from eive_tmtc.config.object_ids import (
TCS_BOARD_ASS_ID,
TCS_CONTROLLER,
TCS_SUBSYSTEM_ID,
)
from tmtccmd.util import ObjectIdU32
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
class OpCode:
TCS_BOARD_ASS_NORMAL = ["0", "normal"]
TCS_BOARD_ASS_OFF = ["1", "off"]
class OpCodeAssy:
TCS_BOARD_ASS_NORMAL = ["nml"]
TCS_BOARD_ASS_OFF = ["off"]
class OpCodeSys:
OFF = ["off"]
NML = ["nml"]
REQUEST_PRIMARY_TEMP_SET = ["temp"]
REQUEST_DEVICE_TEMP_SET = ["temp_devs"]
REQUEST_DEVICE_SUS_SET = ["temp_sus"]
class Info:
class InfoSys:
OFF = "Switch TCS subsystem OFF"
NML = "Switch TCS subsystem NORMAL (nominal)"
REQUEST_PRIMARY_TEMP_SET = "Request HK set of primary sensor temperatures"
REQUEST_DEVICE_TEMP_SET = (
"Request HK set of device sensor (not dedicated sensors) temperatures"
)
REQUEST_DEVICE_SUS_SET = "Request HK set of the SUS temperatures"
class InfoAssy:
TCS_BOARD_ASS_NORMAL = "Switching TCS board assembly on"
TCS_BOARD_ASS_OFF = "Switching TCS board assembly off"
@@ -48,57 +62,79 @@ class SetId(enum.IntEnum):
def add_tcs_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(
keys=OpCode.TCS_BOARD_ASS_NORMAL,
info=Info.TCS_BOARD_ASS_NORMAL,
keys=OpCodeAssy.TCS_BOARD_ASS_NORMAL,
info=InfoAssy.TCS_BOARD_ASS_NORMAL,
)
oce.add(
keys=OpCode.TCS_BOARD_ASS_OFF,
info=Info.TCS_BOARD_ASS_OFF,
keys=OpCodeAssy.TCS_BOARD_ASS_OFF,
info=InfoAssy.TCS_BOARD_ASS_OFF,
)
oce.add(keys=OpCode.REQUEST_PRIMARY_TEMP_SET, info=Info.REQUEST_PRIMARY_TEMP_SET)
oce.add(keys=OpCode.REQUEST_DEVICE_TEMP_SET, info=Info.REQUEST_DEVICE_TEMP_SET)
oce.add(keys=OpCode.REQUEST_DEVICE_SUS_SET, info=Info.REQUEST_DEVICE_SUS_SET)
defs.add_service(
name=CustomServiceList.TCS.value,
name=CustomServiceList.TCS_ASS.value,
info="TCS Board Assembly",
op_code_entry=oce,
)
oce = OpCodeEntry()
oce.add(keys=OpCodeSys.OFF, info=InfoSys.OFF)
oce.add(keys=OpCodeSys.NML, info=InfoSys.NML)
oce.add(
keys=OpCodeSys.REQUEST_PRIMARY_TEMP_SET, info=InfoSys.REQUEST_PRIMARY_TEMP_SET
)
oce.add(
keys=OpCodeSys.REQUEST_DEVICE_TEMP_SET, info=InfoSys.REQUEST_DEVICE_TEMP_SET
)
oce.add(keys=OpCodeSys.REQUEST_DEVICE_SUS_SET, info=InfoSys.REQUEST_DEVICE_SUS_SET)
defs.add_service(
name=CustomServiceList.TCS,
info="TCS Board",
op_code_entry=oce,
)
def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
if op_code in OpCode.REQUEST_PRIMARY_TEMP_SET:
if op_code in OpCodeSys.REQUEST_PRIMARY_TEMP_SET:
sensor_set_sid = make_sid(TCS_CONTROLLER, SetId.PRIMARY_SENSORS)
q.add_log_cmd(Info.REQUEST_PRIMARY_TEMP_SET)
q.add_log_cmd(InfoSys.REQUEST_PRIMARY_TEMP_SET)
q.add_pus_tc(generate_one_hk_command(sensor_set_sid))
if op_code in OpCode.REQUEST_DEVICE_TEMP_SET:
q.add_log_cmd(Info.REQUEST_DEVICE_TEMP_SET)
if op_code in OpCodeSys.REQUEST_DEVICE_TEMP_SET:
q.add_log_cmd(InfoSys.REQUEST_DEVICE_TEMP_SET)
q.add_pus_tc(
generate_one_hk_command(make_sid(TCS_CONTROLLER, SetId.DEVICE_SENSORS))
)
if op_code in OpCode.REQUEST_DEVICE_SUS_SET:
q.add_log_cmd(Info.REQUEST_DEVICE_SUS_SET)
if op_code in OpCodeSys.REQUEST_DEVICE_SUS_SET:
q.add_log_cmd(InfoSys.REQUEST_DEVICE_SUS_SET)
q.add_pus_tc(
generate_one_hk_command(make_sid(TCS_CONTROLLER, SetId.SUS_TEMP_SENSORS))
)
if op_code in OpCodeSys.OFF:
q.add_log_cmd(InfoSys.OFF)
q.add_pus_tc(
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.OFF, 0, q, InfoSys.OFF)
)
if op_code in OpCodeSys.NML:
q.add_log_cmd(InfoSys.NML)
q.add_pus_tc(
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.NORMAL, 0, q, InfoSys.OFF)
)
pack_tcs_ass_cmds(q, op_code)
def pack_tcs_ass_cmds(q: DefaultPusQueueHelper, op_code: str):
if op_code in OpCode.TCS_BOARD_ASS_NORMAL:
if op_code in OpCodeAssy.TCS_BOARD_ASS_NORMAL:
pack_mode_cmd_with_info(
object_id=TCS_BOARD_ASS_ID,
mode=Mode.NORMAL,
submode=0,
q=q,
info=Info.TCS_BOARD_ASS_NORMAL,
info=InfoAssy.TCS_BOARD_ASS_NORMAL,
)
if op_code in OpCode.TCS_BOARD_ASS_OFF:
if op_code in OpCodeAssy.TCS_BOARD_ASS_OFF:
pack_mode_cmd_with_info(
object_id=TCS_BOARD_ASS_ID,
mode=Mode.OFF,
submode=0,
q=q,
info=Info.TCS_BOARD_ASS_OFF,
info=InfoAssy.TCS_BOARD_ASS_OFF,
)