eive-tmtc/eive_tmtc/tmtc/obj_prompt.py

44 lines
1.2 KiB
Python

from eive_tmtc.config.object_ids import (
ACS_SUBSYSTEM_ID,
ACS_CONTROLLER,
IMTQ_HANDLER_ID,
GYRO_0_ADIS_HANDLER_ID,
GYRO_1_L3G_HANDLER_ID,
ACS_BOARD_ASS_ID,
RW_ASSEMBLY,
SUS_BOARD_ASS_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)
}
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]