common tmtc folder

This commit is contained in:
Robin Müller 2021-07-14 00:24:09 +02:00
parent bed32bc947
commit 275d79d179
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
26 changed files with 52 additions and 35 deletions

@ -1 +1 @@
Subproject commit e4879130b09c76dac75265768fc757759e9aedcd
Subproject commit 49566cd1301cffad09defd4051b66f0129d82f17

2
fsfw

@ -1 +1 @@
Subproject commit 3a9add82fe56b4b75b0079b48c094e6c4f778c42
Subproject commit 66a79cb86c061a7113a43a21035f1fdb1e082729

View File

@ -5,19 +5,18 @@ from tmtccmd.com_if.com_interface_base import CommunicationInterface
from tmtccmd.config.definitions import ServiceOpCodeDictT
from tmtccmd.config.hook import TmTcHookBase
from tmtccmd.core.backend import TmTcHandler
from tmtccmd.ecss.tm import PusTelemetry
from tmtccmd.pus_tc.definitions import TcQueueT
from tmtccmd.pus_tm.service_3_base import Service3Base
from tmtccmd.ecss.conf import PusVersion
from tmtccmd.utility.tmtc_printer import TmTcPrinter
from config.definitions import PUS_APID
from common_tmtc.config.definitions import PUS_APID
class FsfwHookBase(TmTcHookBase):
def get_version(self) -> str:
from config.version import SW_NAME, SW_VERSION, SW_SUBVERSION, SW_SUBSUBVERSION
from common_tmtc.config.version import SW_NAME, SW_VERSION, SW_SUBVERSION, SW_SUBSUBVERSION
return f"{SW_NAME} {SW_VERSION}.{SW_SUBVERSION}.{SW_SUBSUBVERSION}"
def get_json_config_file_path(self) -> str:
@ -35,7 +34,9 @@ class FsfwHookBase(TmTcHookBase):
def add_globals_post_args_parsing(self, args: argparse.Namespace):
from tmtccmd.config.globals import set_default_globals_post_args_parsing
set_default_globals_post_args_parsing(args=args, json_cfg_path=self.get_json_config_file_path())
set_default_globals_post_args_parsing(
args=args, json_cfg_path=self.get_json_config_file_path()
)
def assign_communication_interface(
self, com_if_key: str, tmtc_printer: TmTcPrinter
@ -50,18 +51,18 @@ class FsfwHookBase(TmTcHookBase):
print("No custom mode operation implemented")
def pack_service_queue(self, service: int, op_code: str, service_queue: TcQueueT):
from pus_tc.tc_packing import pack_service_queue_user
from common_tmtc.pus_tc.tc_packing import pack_service_queue_user
pack_service_queue_user(service=service, op_code=op_code, tc_queue=service_queue)
def get_object_ids(self) -> Dict[bytes, list]:
from config.object_ids import get_object_ids
from common_tmtc.config.object_ids import get_object_ids
return get_object_ids()
@staticmethod
def handle_service_8_telemetry(
object_id: int, action_id: int, custom_data: bytearray
) -> Tuple[list, list]:
from pus_tm.service_8_handling import custom_service_8_handling
from common_tmtc.pus_tm.service_8_handling import custom_service_8_handling
return custom_service_8_handling(
object_id=object_id, action_id=action_id, custom_data=custom_data
)
@ -70,7 +71,7 @@ class FsfwHookBase(TmTcHookBase):
def handle_service_3_housekeeping(
object_id: bytes, set_id: int, hk_data: bytearray, service3_packet: Service3Base
) -> Tuple[list, list, bytearray, int]:
from pus_tm.service_3_hk_handling import service_3_hk_handling
from common_tmtc.pus_tm import service_3_hk_handling
return service_3_hk_handling(
object_id=object_id, set_id=set_id, hk_data=hk_data, service3_packet=service3_packet
)

View File

@ -10,7 +10,7 @@ from tmtccmd.ecss.tc import PusTelecommand
from tmtccmd.pus_tc.packer import TcQueueT
from tmtccmd.pus_tc.service_200_mode import pack_mode_data
from config.object_ids import TEST_DEVICE_0_ID
from common_tmtc.config.object_ids import TEST_DEVICE_0_ID
def pack_service_200_commands_into(tc_queue: TcQueueT, op_code: str):

View File

@ -8,7 +8,7 @@ from tmtccmd.pus_tc.service_20_parameter import pack_type_and_matrix_data, \
from tmtccmd.pus_tc.service_200_mode import pack_mode_data
from tmtccmd.utility.logger import get_console_logger
from config.object_ids import TEST_DEVICE_0_ID
from common_tmtc.config.object_ids import TEST_DEVICE_0_ID
LOGGER = get_console_logger()

View File

@ -10,10 +10,10 @@ import struct
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.ecss.tc import PusTelecommand
from tmtccmd.pus_tc.definitions import TcQueueT
from pus_tc.service_200_mode import pack_mode_data
from common_tmtc.pus_tc.service_200_mode import pack_mode_data
import pus_tc.command_data as cmd_data
from config.object_ids import TEST_DEVICE_0_ID
from common_tmtc import pus_tc as cmd_data
from common_tmtc.config.object_ids import TEST_DEVICE_0_ID
def pack_service_2_commands_into(tc_queue: TcQueueT, op_code: str):

View File

@ -7,7 +7,7 @@ from tmtccmd.ecss.tc import PusTelecommand
from tmtccmd.pus_tc.definitions import TcQueueT
from tmtccmd.pus_tc.service_8_functional_cmd import generate_action_command
from config.object_ids import TEST_DEVICE_0_ID, TEST_DEVICE_1_ID
from common_tmtc.config.object_ids import TEST_DEVICE_0_ID, TEST_DEVICE_1_ID
# Set IDs

View File

@ -2,10 +2,10 @@ from tmtccmd.config.definitions import QueueCommands
from tmtccmd.ecss.tc import PusTelecommand
from tmtccmd.pus_tc.definitions import TcQueueT
import pus_tc.command_data as cmd_data
from pus_tc.service_200_mode import pack_mode_data
from common_tmtc import pus_tc as cmd_data
from common_tmtc.pus_tc.service_200_mode import pack_mode_data
from config.object_ids import TEST_DEVICE_0_ID
from common_tmtc.config.object_ids import TEST_DEVICE_0_ID
def pack_service_8_commands_into(tc_queue: TcQueueT, op_code: str):

View File

@ -8,17 +8,17 @@ import os
from collections import deque
from typing import Union
from pus_tc.service_20_parameters import pack_service20_commands_into
from pus_tc.service_2_raw_cmd import pack_service_2_commands_into
from pus_tc.service_3_housekeeping import pack_service_3_commands_into
from pus_tc.service_17_test import pack_service_17_commands
from pus_tc.service_8_func_cmd import pack_service_8_commands_into
from common_tmtc.pus_tc.service_20_parameters import pack_service20_commands_into
from common_tmtc.pus_tc.service_2_raw_cmd import pack_service_2_commands_into
from common_tmtc.pus_tc.service_3_housekeeping import pack_service_3_commands_into
from common_tmtc.pus_tc.service_17_test import pack_service_17_commands
from common_tmtc.pus_tc.service_8_func_cmd import pack_service_8_commands_into
from tmtccmd.utility.logger import get_console_logger
from tmtccmd.pus_tc.definitions import TcQueueT
from tmtccmd.config.definitions import CoreServiceList
from tmtccmd.pus_tc.service_5_event import pack_generic_service5_test_into
from tmtccmd.pus_tc.service_17_test import pack_generic_service17_test
from pus_tc.service_200_mode import pack_service_200_commands_into
from common_tmtc.pus_tc.service_200_mode import pack_service_200_commands_into
LOGGER = get_console_logger()

View File

View File

@ -16,7 +16,7 @@ from tmtccmd.pus_tm.service_20_parameters import Service20TM
from tmtccmd.pus_tm.service_200_mode import Service200TM
from tmtccmd.utility.tmtc_printer import TmTcPrinter
from config.definitions import PUS_APID
from common_tmtc.config.definitions import PUS_APID
LOGGER = get_console_logger()

View File

@ -7,10 +7,10 @@
import struct
from typing import Tuple
from tmtccmd.pus_tm.service_3_housekeeping import Service3Base
from tmtccmd.utility.logger import get_logger
from tmtccmd.utility.logger import get_console_logger
from config.object_ids import TEST_DEVICE_0_ID, TEST_DEVICE_1_ID
LOGGER = get_logger()
from common_tmtc.config.object_ids import TEST_DEVICE_0_ID, TEST_DEVICE_1_ID
LOGGER = get_console_logger()
def service_3_hk_handling(

View File

@ -28,9 +28,9 @@ limitations under the License.
"""
import sys
from config.hook_implementation import FsfwHookBase
from config.definitions import PUS_APID
from pus_tm.factory_hook import ccsds_tm_handler
from common_tmtc.config.hook_implementation import FsfwHookBase
from common_tmtc.config.definitions import PUS_APID
from common_tmtc.pus_tm.factory_hook import ccsds_tm_handler
try:
from tmtccmd.runner import run_tmtc_commander, initialize_tmtc_commander, add_ccsds_handler
from tmtccmd.ccsds.handler import CcsdsTmHandler

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
@brief TMTC Commander entry point for GUI mode.
@brief TMTC Commander entry point for command line mode.
@details
This client was developed by KSat for the SOURCE project to test the on-board software but
has evolved into a more generic tool for satellite developers to perform TMTC (Telemetry and Telecommand)
@ -26,13 +26,29 @@ limitations under the License.
@author R. Mueller
"""
from config.hook_implementation import FsfwHookBase
from tmtccmd.runner import run_tmtc_commander, initialize_tmtc_commander
import sys
from common_tmtc.config.hook_implementation import FsfwHookBase
from common_tmtc.config.definitions import PUS_APID
from common_tmtc.pus_tm.factory_hook import ccsds_tm_handler
try:
from tmtccmd.runner import run_tmtc_commander, initialize_tmtc_commander, add_ccsds_handler
from tmtccmd.ccsds.handler import CcsdsTmHandler
except ImportError as error:
run_tmtc_commander = None
initialize_tmtc_commander = None
print(error)
print("Python tmtccmd submodule could not be imported")
print("Install with \"cd tmtccmd && python3 -m pip install -e .\" for interactive installation")
sys.exit(0)
def main():
hook_obj = FsfwHookBase()
initialize_tmtc_commander(hook_object=hook_obj)
ccsds_handler = CcsdsTmHandler()
ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50)
add_ccsds_handler(ccsds_handler)
run_tmtc_commander(use_gui=True, app_name="TMTC Commander FSFW")