eive-tmtc/eive_tmtc/config/object_ids.py
2023-10-09 11:10:20 +02:00

184 lines
6.9 KiB
Python

"""
@brief This file transfers control of the object IDs to the user.
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
it to your needs.
"""
import logging
import os.path
from typing import Dict
from eive_tmtc import EIVE_TMTC_ROOT
from tmtccmd.util.obj_id import ObjectIdU32
from tmtccmd.fsfw import parse_fsfw_objects_csv
DEFAULT_OBJECTS_CSV_PATH = EIVE_TMTC_ROOT / "config/objects.csv"
__OBJECT_ID_DICT = None
# Core Object IDs
SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x41, 0x00, 0xA2])
INTERNAL_ERROR_REPORTER_ID = bytes([0x53, 0x04, 0x00, 0x00])
# Power Object IDs
PCDU_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0xA1])
P60_DOCK_HANDLER = bytes([0x44, 0x25, 0x00, 0x00])
PDU_1_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x01])
PDU_2_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x02])
ACU_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x03])
BPX_HANDLER_ID = bytes([0x44, 0x26, 0x00, 0x00])
SCEX_HANDLER_ID = bytes([0x44, 0x33, 0x00, 0x32])
# Thermal Object IDs
THERMAL_CONTROLLER_ID = bytes([0x43, 0x40, 0x00, 0x01])
HEATER_CONTROLLER_ID = bytes([0x44, 0x41, 0x00, 0xA4])
TMP1075_HANDLER_TCS_BRD_0_ID = bytes([0x44, 0x42, 0x00, 0x04])
TMP1075_HANDLER_TCS_BRD_1_ID = bytes([0x44, 0x42, 0x00, 0x05])
TMP1075_HANDLER_PLPCDU_0_ID = bytes([0x44, 0x42, 0x00, 0x06])
TMP1075_HANDLER_PLPCDU_1_ID = bytes([0x44, 0x42, 0x00, 0x07])
TMP1075_HANDLER_IF_BRD_ID = bytes([0x44, 0x42, 0x00, 0x08])
# Communication Object IDs
SYRLINKS_HANDLER_ID = bytes([0x44, 0x53, 0x00, 0xA3])
# ACS Object IDs
MGM_0_LIS3_HANDLER_ID = bytes([0x44, 0x12, 0x00, 0x06])
MGM_1_RM3100_HANDLER_ID = bytes([0x44, 0x12, 0x01, 0x07])
MGM_2_LIS3_HANDLER_ID = bytes([0x44, 0x12, 0x02, 0x08])
MGM_3_RM3100_HANDLER_ID = bytes([0x44, 0x12, 0x03, 0x09])
GYRO_0_ADIS_HANDLER_ID = bytes([0x44, 0x12, 0x00, 0x10])
GYRO_1_L3G_HANDLER_ID = bytes([0x44, 0x12, 0x01, 0x11])
GYRO_2_ADIS_HANDLER_ID = bytes([0x44, 0x12, 0x02, 0x12])
GYRO_3_L3G_HANDLER_ID = bytes([0x44, 0x12, 0x03, 0x13])
GPS_CONTROLLER = bytes([0x44, 0x13, 0x00, 0x45])
GPS_0_HEALTH_DEV = bytes([0x44, 0x13, 0x00, 0x46])
GPS_1_HEALTH_DEV = bytes([0x44, 0x13, 0x00, 0x47])
RW1_ID = bytes([0x44, 0x12, 0x00, 0x47])
RW2_ID = bytes([0x44, 0x12, 0x01, 0x48])
RW3_ID = bytes([0x44, 0x12, 0x02, 0x49])
RW4_ID = bytes([0x44, 0x12, 0x03, 0x50])
IMTQ_HANDLER_ID = bytes([0x44, 0x14, 0x00, 0x14])
# Misc Object IDs
PUS_SERVICE_17_ID = bytes([0x53, 0x00, 0x00, 0x17])
TEST_DEVICE_ID = bytes([0x54, 0x00, 0xAF, 0xFE])
CCSDS_HANDLER_ID = bytes([0x50, 0x00, 0x08, 0x00])
PDEC_HANDLER_ID = bytes([0x50, 0x00, 0x07, 0x00])
# Payload Object IDs
STAR_TRACKER_ID = bytes([0x44, 0x13, 0x00, 0x1])
RAD_SENSOR_ID = bytes([0x44, 0x32, 0x00, 0xA5])
PLOC_SUPV_ID = bytes([0x44, 0x33, 0x00, 0x16])
PLOC_MEMORY_DUMPER_ID = bytes([0x44, 0x33, 0x00, 0x01])
STR_IMG_HELPER_ID = bytes([0x44, 0x33, 0x00, 0x02])
PLOC_MPSOC_ID = bytes([0x44, 0x33, 0x00, 0x15])
PL_PCDU_ID = bytes([0x44, 0x30, 0x00, 0x00])
# Other
HEATER_0_PLOC_PROC_BRD = bytes([0x60, 0x00, 0x00, 0x00])
HEATER_1_PCDU_BRD = bytes([0x60, 0x00, 0x00, 0x01])
HEATER_2_ACS_BRD = bytes([0x60, 0x00, 0x00, 0x02])
HEATER_3_OBC_BRD = bytes([0x60, 0x00, 0x00, 0x03])
HEATER_4_CAMERA = bytes([0x60, 0x00, 0x00, 0x04])
HEATER_5_STR = bytes([0x60, 0x00, 0x00, 0x05])
HEATER_6_DRO = bytes([0x60, 0x00, 0x00, 0x06])
HEATER_7_SYRLINKS = bytes([0x60, 0x00, 0x00, 0x07])
# RTDs
RTD_0_PLOC_HSPD = bytes([0x44, 0x42, 0x00, 0x16])
RTD_1_PLOC_MISSIONBRD = bytes([0x44, 0x42, 0x00, 0x17])
RTD_2_4K_CAM = bytes([0x44, 0x42, 0x00, 0x18])
RTD_3_DAC_HSPD = bytes([0x44, 0x42, 0x00, 0x19])
RTD_4_STR = bytes([0x44, 0x42, 0x00, 0x20])
RTD_5_RW1_MX_MY = bytes([0x44, 0x42, 0x00, 0x21])
RTD_6_DRO = bytes([0x44, 0x42, 0x00, 0x22])
RTD_7_SCEX = bytes([0x44, 0x42, 0x00, 0x23])
RTD_8_X8 = bytes([0x44, 0x42, 0x00, 0x24])
RTD_9_HPA = bytes([0x44, 0x42, 0x00, 0x25])
RTD_10_PL_TX = bytes([0x44, 0x42, 0x00, 0x26])
RTD_11_MPA = bytes([0x44, 0x42, 0x00, 0x27])
RTD_12_ACU = bytes([0x44, 0x42, 0x00, 0x28])
RTD_13_PLPCDU_HSPD = bytes([0x44, 0x42, 0x00, 0x29])
RTD_14_TCS_BRD = bytes([0x44, 0x42, 0x00, 0x30])
RTD_15_IMTQ = bytes([0x44, 0x42, 0x00, 0x31])
# SUS
"""
Name convention for SUS devices
SUS_<IDX>_<N/R>_LOC_X<F/M/B>Y<F/M/B>Z<F/M/B>_PT_<DIR><F/B>
LOC: Location
PT: Pointing
N/R: Nominal/Redundant
F/M/B: Forward/Middle/Backwards
"""
SUS_0_N_LOC_XFYFZM_PT_XF = bytes([0x44, 0x12, 0x00, 0x32])
SUS_6_R_LOC_XFYBZM_PT_XF = bytes([0x44, 0x12, 0x00, 0x38])
SUS_1_N_LOC_XBYFZM_PT_XB = bytes([0x44, 0x12, 0x00, 0x33])
SUS_7_R_LOC_XBYBZM_PT_XB = bytes([0x44, 0x12, 0x00, 0x39])
SUS_2_N_LOC_XFYBZB_PT_YB = bytes([0x44, 0x12, 0x00, 0x34])
SUS_8_R_LOC_XBYBZB_PT_YB = bytes([0x44, 0x12, 0x00, 0x40])
SUS_3_N_LOC_XFYBZF_PT_YF = bytes([0x44, 0x12, 0x00, 0x35])
SUS_9_R_LOC_XBYBZB_PT_YF = bytes([0x44, 0x12, 0x00, 0x41])
SUS_4_N_LOC_XMYFZF_PT_ZF = bytes([0x44, 0x12, 0x00, 0x36])
SUS_10_R_LOC_XMYBZF_PT_ZF = bytes([0x44, 0x12, 0x00, 0x42])
SUS_5_N_LOC_XFYMZB_PT_ZB = bytes([0x44, 0x12, 0x00, 0x37])
SUS_11_R_LOC_XBYMZB_PT_ZB = bytes([0x44, 0x12, 0x00, 0x43])
# System and Assembly Objects
EIVE_SYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x00])
ACS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x01])
PL_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x02])
TCS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x03])
COM_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x04])
EPS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x05])
# Legacy names, kept for backwards compatibility
ACS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x01])
TCS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x03])
SUS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x02])
IMTQ_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x08])
ACS_BOARD_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x01])
SUS_BOARD_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x02])
TCS_BOARD_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x03])
RW_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x04])
CAM_SWITCHER = bytes([0x73, 0x00, 0x00, 0x06])
SYRLINKS_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x07])
# To be removed soon..
MGT_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x08])
STR_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x09])
# Controllers
TCS_CONTROLLER = bytes([0x43, 0x40, 0x00, 0x01])
ACS_CONTROLLER = bytes([0x43, 0x00, 0x00, 0x02])
CORE_CONTROLLER_ID = bytes([0x43, 0x00, 0x00, 0x03])
PWR_CONTROLLER = bytes([0x43, 0x00, 0x00, 0x04])
MISC_TM_STORE = bytes([0x73, 0x02, 0x00, 0x01])
OK_TM_STORE = bytes([0x73, 0x02, 0x00, 0x02])
NOT_OK_TM_STORE = bytes([0x73, 0x02, 0x00, 0x03])
HK_TM_STORE = bytes([0x73, 0x02, 0x00, 0x04])
CFDP_TM_STORE = bytes([0x73, 0x03, 0x00, 0x00])
ObjectIdDict = Dict[bytes, ObjectIdU32]
def get_object_ids() -> ObjectIdDict:
global __OBJECT_ID_DICT
if not os.path.exists(DEFAULT_OBJECTS_CSV_PATH):
logging.getLogger(__name__).warning(
f"No Objects CSV file found at {DEFAULT_OBJECTS_CSV_PATH}"
)
if __OBJECT_ID_DICT is None:
if os.path.exists(DEFAULT_OBJECTS_CSV_PATH):
__OBJECT_ID_DICT = parse_fsfw_objects_csv(csv_file=DEFAULT_OBJECTS_CSV_PATH)
else:
__OBJECT_ID_DICT = dict()
return __OBJECT_ID_DICT