eive-tmtc/eive_tmtc/tmtc/obj_prompt.py
2023-04-06 19:08:04 +02:00

59 lines
1.6 KiB
Python

from eive_tmtc.config.object_ids import (
ACS_SUBSYSTEM_ID,
ACS_CONTROLLER,
IMTQ_HANDLER_ID,
GPS_0_HEALTH_DEV,
GPS_1_HEALTH_DEV,
GYRO_0_ADIS_HANDLER_ID,
GYRO_1_L3G_HANDLER_ID,
ACS_BOARD_ASS_ID,
RW_ASSEMBLY,
SUS_BOARD_ASS_ID,
MGM_0_LIS3_HANDLER_ID,
MGM_1_RM3100_HANDLER_ID,
SUS_0_N_LOC_XFYFZM_PT_XF,
SUS_6_R_LOC_XFYBZM_PT_XF,
RW1_ID,
RW2_ID,
)
SUBSYSTEM_DICT = {
0: "acs",
1: "tcs",
2: "com",
}
ACS_OBJ_DICT = {
0: ("Subsystem", ACS_SUBSYSTEM_ID),
1: ("SUS Assembly", SUS_BOARD_ASS_ID),
2: ("ACS Board Assembly", ACS_BOARD_ASS_ID),
3: ("RW Assembly", RW_ASSEMBLY),
4: ("iMTQ MGT", IMTQ_HANDLER_ID),
5: ("GYR 0 ADIS", GYRO_0_ADIS_HANDLER_ID),
6: ("GYR 1 L3G", GYRO_1_L3G_HANDLER_ID),
7: ("MGM 0 LIS3", MGM_0_LIS3_HANDLER_ID),
8: ("MGM 1 RM3100", MGM_1_RM3100_HANDLER_ID),
9: ("GPS 0 Health Device", GPS_0_HEALTH_DEV),
10: ("SUS 0", SUS_0_N_LOC_XFYFZM_PT_XF),
11: ("SUS 6", SUS_6_R_LOC_XFYBZM_PT_XF),
12: ("RW 1", RW1_ID),
13: ("RW 2", RW2_ID),
}
def prompt_object() -> bytes:
for k, v in SUBSYSTEM_DICT.items():
print(f"{k}: {v}")
subsystem_key = int(input("Please specify target subsystem by key: "))
subsystem = SUBSYSTEM_DICT[subsystem_key]
if subsystem is None:
raise ValueError("invalid key")
if subsystem == "acs":
for k, v in ACS_OBJ_DICT.items():
print(f"{k}: {v[0]}")
obj_key = int(input("Please specify target object by key: "))
acs_obj = ACS_OBJ_DICT[obj_key]
if acs_obj is None:
raise ValueError("invalid key")
return acs_obj[1]