156 lines
6.2 KiB
Python
156 lines
6.2 KiB
Python
from typing import Optional
|
|
|
|
from tmtccmd import CcsdsTmtcBackend, HookBase
|
|
from tmtccmd.com import ComInterface
|
|
from tmtccmd.config import CmdTreeNode
|
|
from tmtccmd.util import ObjectIdDictT, RetvalDictT
|
|
|
|
from eive_tmtc.config.definitions import SPACE_PACKET_IDS
|
|
from eive_tmtc.config.retvals import get_retval_dict
|
|
from eive_tmtc.tmtc.time import create_time_node
|
|
from eive_tmtc.tmtc.acs.acs_ctrl import create_acs_ctrl_node
|
|
|
|
|
|
class EiveHookObject(HookBase):
|
|
def __init__(self, json_cfg_path: str):
|
|
super().__init__(json_cfg_path=json_cfg_path)
|
|
|
|
def get_command_definitions(self) -> CmdTreeNode:
|
|
root_node = CmdTreeNode.root_node()
|
|
mode_node = CmdTreeNode("mode", "Mode Commands")
|
|
hk_node = CmdTreeNode("hk", "HK Commands")
|
|
action_node = CmdTreeNode("action", "Action Commands")
|
|
param_node = CmdTreeNode("params", "Parameter Commands")
|
|
health_node = CmdTreeNode("health", "Health Commands")
|
|
dev_node = CmdTreeNode("dev", "Device Commands")
|
|
dev_node.add_child(hk_node)
|
|
dev_node.add_child(mode_node)
|
|
dev_node.add_child(health_node)
|
|
dev_node.add_child(param_node)
|
|
# Not strictly necessary, but I do not know a single device which does not have actions..
|
|
dev_node.add_child(action_node)
|
|
assy_node = CmdTreeNode("assy", "Assembly Commands")
|
|
assy_node.add_child(mode_node)
|
|
|
|
system_node = CmdTreeNode("sys", "EIVE System")
|
|
|
|
acs_node = CmdTreeNode("acs", "ACS Subsystem")
|
|
acs_brd_assy_node = CmdTreeNode("acs_brd_assy", "ACS Board Assembly")
|
|
acs_brd_assy_node.add_child(mode_node)
|
|
mgm_devs = CmdTreeNode("mgm_devs", "MGM Devices")
|
|
gyro_devs = CmdTreeNode("gyro_devs", "Gyro Devices")
|
|
acs_brd_assy_node.add_child(mgm_devs)
|
|
acs_brd_assy_node.add_child(gyro_devs)
|
|
rws = CmdTreeNode("rws", "Reaction Wheel Devices")
|
|
rw_assy = CmdTreeNode("rw_assy", "Reaction Wheel Assembly")
|
|
rw_1 = CmdTreeNode("rw_1", "Reaction Wheel 1")
|
|
rw_2 = CmdTreeNode("rw_2", "Reaction Wheel 2")
|
|
rw_3 = CmdTreeNode("rw_3", "Reaction Wheel 3")
|
|
rw_4 = CmdTreeNode("rw_4", "Reaction Wheel 4")
|
|
rws.add_child(rw_assy)
|
|
rws.add_child(rw_1)
|
|
rws.add_child(rw_2)
|
|
rws.add_child(rw_3)
|
|
rws.add_child(rw_4)
|
|
mgt = CmdTreeNode("mgt", "ISIS MGT")
|
|
mgt.add_child(dev_node)
|
|
mgt.add_child(assy_node)
|
|
star_tracker = CmdTreeNode("str", "Star Tracker")
|
|
star_tracker_img_helper = CmdTreeNode(
|
|
"str_img_helper", "Star Tracker Image Helper"
|
|
)
|
|
star_tracker.add_child(star_tracker_img_helper)
|
|
gnss_devs = CmdTreeNode("gnss", "GNSS Devices")
|
|
|
|
acs_node.add_child(acs_brd_assy_node)
|
|
acs_node.add_child(create_acs_ctrl_node())
|
|
acs_node.add_child(mode_node)
|
|
acs_node.add_child(rws)
|
|
acs_node.add_child(mgt)
|
|
acs_node.add_child(star_tracker)
|
|
acs_node.add_child(gnss_devs)
|
|
|
|
tcs_node = CmdTreeNode("tcs", "TCS Subsystem")
|
|
tmp_1075_node = CmdTreeNode("tmp1075_devs", "TMP1075 Devices")
|
|
rtds_node = CmdTreeNode("rtd_devs", "RTD Devices")
|
|
heaters_node = CmdTreeNode("heaters", "Heater Devices")
|
|
tcs_ctrl = CmdTreeNode("tcs_ctrl", "TCS Controller")
|
|
tcs_node.add_child(rtds_node)
|
|
tcs_node.add_child(tmp_1075_node)
|
|
tcs_node.add_child(tcs_ctrl)
|
|
tcs_node.add_child(heaters_node)
|
|
tcs_brd_assy = CmdTreeNode("tcs_brd_assy", "TCS Board Assembly")
|
|
tcs_node.add_child(tcs_brd_assy)
|
|
|
|
com_node = CmdTreeNode("com", "COM Subsystem")
|
|
syrlinks_node = CmdTreeNode("syrlinks", "Syrlinks")
|
|
syrlinks_node.add_child(dev_node)
|
|
syrlinks_node.add_child(assy_node)
|
|
syrlinks_node.add_child(action_node)
|
|
ccsds_node = CmdTreeNode("ccsds", "CCSDS Handler")
|
|
ccsds_node.add_child(action_node)
|
|
com_node.add_child(syrlinks_node)
|
|
|
|
eps_node = CmdTreeNode("eps", "EPS Subsystem")
|
|
acu_node = CmdTreeNode("acu", "PCDU ACU component")
|
|
pdu_1_node = CmdTreeNode("pdu1", "PCDU PDU 1 component")
|
|
pdu_2_node = CmdTreeNode("pdu2", "PCDU PDU 2 component")
|
|
p60_dock_node = CmdTreeNode("p60_dock", "PCDU P60 Dock component")
|
|
bat_node = CmdTreeNode("bat", "Battery Component")
|
|
eps_node.add_child(acu_node)
|
|
eps_node.add_child(pdu_1_node)
|
|
eps_node.add_child(pdu_2_node)
|
|
eps_node.add_child(p60_dock_node)
|
|
eps_node.add_child(bat_node)
|
|
|
|
payload_node = CmdTreeNode("payload", "Payload Subsystem")
|
|
scex_node = CmdTreeNode("scex", "SCEX devices")
|
|
scex_node.add_child(dev_node)
|
|
pl_pcdu = CmdTreeNode("pl_pcdu", "Payload PCDU")
|
|
payload_node.add_child(pl_pcdu)
|
|
|
|
obdh_node = CmdTreeNode("obdh", "OBDH Subsystem")
|
|
xiphos_wdt = CmdTreeNode("wdt", "Xiphos WDT")
|
|
core_ctrl = CmdTreeNode("core", "Core Controller")
|
|
obdh_node.add_child(xiphos_wdt)
|
|
obdh_node.add_child(core_ctrl)
|
|
obdh_node.add_child(create_time_node())
|
|
|
|
root_node.add_child(system_node)
|
|
root_node.add_child(acs_node)
|
|
root_node.add_child(tcs_node)
|
|
root_node.add_child(com_node)
|
|
root_node.add_child(eps_node)
|
|
root_node.add_child(payload_node)
|
|
root_node.add_child(obdh_node)
|
|
return root_node
|
|
|
|
def get_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
|
|
from tmtccmd.config.com import (
|
|
create_com_interface_cfg_default,
|
|
create_com_interface_default,
|
|
)
|
|
|
|
assert self.cfg_path is not None
|
|
|
|
cfg = create_com_interface_cfg_default(
|
|
com_if_key=com_if_key,
|
|
json_cfg_path=self.cfg_path,
|
|
space_packet_ids=SPACE_PACKET_IDS,
|
|
)
|
|
assert cfg is not None
|
|
return create_com_interface_default(cfg)
|
|
|
|
def perform_mode_operation(self, tmtc_backend: CcsdsTmtcBackend, mode: int):
|
|
from eive_tmtc.config.custom_mode_op import custom_mode_operation
|
|
|
|
custom_mode_operation(tmtc_backend, mode)
|
|
|
|
def get_object_ids(self) -> ObjectIdDictT:
|
|
from eive_tmtc.config.object_ids import get_object_ids
|
|
|
|
return get_object_ids()
|
|
|
|
def get_retval_dict(self) -> RetvalDictT:
|
|
return get_retval_dict()
|