update to newest tmtccmd version
Some checks failed
fsfw/fsfw example hosted/pipeline/head There was a failure building this commit

This commit is contained in:
Robin Müller 2022-07-03 21:00:28 +02:00
parent af618f5652
commit f4a346d2a8
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
8 changed files with 97 additions and 28 deletions

3
tmtc/.gitignore vendored
View File

@ -3,4 +3,5 @@
/venv
/config/tmtc_config.json
/log/*.log
/log/*.log
/seqcnt.txt

View File

@ -12,8 +12,8 @@
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcgui.py" />
<option name="PARAMETERS" value="" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-g" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />

View File

@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="TMTC Listener" type="PythonConfigurationType" factoryName="Python">
<module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-l" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
</component>

@ -1 +1 @@
Subproject commit 4cc02d287d48569f4c8b6aed836098efb2b0ea41
Subproject commit d87e2971b43aa464a4860900f7713c0a551cc4f5

View File

@ -1,11 +1,21 @@
from typing import Optional
from common_tmtc.config.definitions import TM_SP_IDS
from common_tmtc.config.hook_implementation import CommonFsfwHookBase
from tmtccmd.tc.definitions import TcQueueT
from common_tmtc.pus_tc.cmd_definitions import common_fsfw_service_op_code_dict
from tmtccmd.com_if import ComInterface
from tmtccmd.config import TmTcDefWrapper
class FsfwHookBase(CommonFsfwHookBase):
def pack_service_queue(self, service: int, op_code: str, service_queue: TcQueueT):
from common_tmtc.pus_tc.tc_packing import common_service_queue_user
def get_tmtc_definitions(self) -> TmTcDefWrapper:
return common_fsfw_service_op_code_dict()
common_service_queue_user(
service=service, op_code=op_code, tc_queue=service_queue
def assign_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
from tmtccmd.config.com_if import create_communication_interface_default
return create_communication_interface_default(
com_if_key=com_if_key,
json_cfg_path=self.json_cfg_path,
space_packet_ids=TM_SP_IDS,
)

@ -1 +1 @@
Subproject commit dd56396e12d5c06418a05902839cec62d9c7f06c
Subproject commit 4d34585d45ede975f14e16c730390b6bd8343e8f

View File

@ -1 +1 @@
tmtccmd >= 2.2.1
tmtccmd >= 3.0.0rc1

View File

@ -1,27 +1,61 @@
#!/usr/bin/env python3
"""TMTC commander for FSFW Example"""
import sys
import time
from spacepackets.ecss import PusVerificator
import tmtccmd
from common_tmtc.common import (
tmtcc_post_args,
tmtcc_pre_args
)
from common_tmtc.common import setup_params, setup_tmtc_handlers, setup_backend
from config.hook import FsfwHookBase
from examples.tmtcc import EXAMPLE_APID
from tmtccmd.config import SetupParams, ArgParserWrapper, SetupWrapper
from tmtccmd import get_console_logger
from tmtccmd.core import BackendRequest
from tmtccmd.logging.pus import (
RegularTmtcLogWrapper,
RawTmtcTimedLogWrapper,
TimedLogWhen,
)
from tmtccmd.pus import VerificationWrapper
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
LOGGER = get_console_logger()
def main():
tmtcc_pre_args()
hook_obj = FsfwHookBase(json_cfg_path="tmtc_conf.json")
params = SetupParams()
parser_wrapper = ArgParserWrapper(hook_obj)
parser_wrapper.parse()
tmtccmd.init_printout(parser_wrapper.use_gui)
parser_wrapper.set_params(params)
params.apid = EXAMPLE_APID
setup_wrapper = SetupWrapper(hook_obj, params)
tmtcc_post_args(hook_obj=hook_obj, use_gui=False, args=args)
setup_wrapper = setup_params(FsfwHookBase())
tmtc_logger = RegularTmtcLogWrapper()
printer = FsfwTmTcPrinter(tmtc_logger.logger)
raw_logger = RawTmtcTimedLogWrapper(when=TimedLogWhen.PER_HOUR, interval=2)
pus_verificator = PusVerificator()
verif_wrapper = VerificationWrapper(
console_logger=get_console_logger(),
file_logger=printer.file_logger,
pus_verificator=pus_verificator,
)
ccsds_handler, tc_handler = setup_tmtc_handlers(
verif_wrapper=verif_wrapper, raw_logger=raw_logger, printer=printer
)
tmtccmd.setup(setup_wrapper)
backend = setup_backend(
setup_wrapper=setup_wrapper, ccsds_handler=ccsds_handler, tc_handler=tc_handler
)
try:
while True:
state = backend.periodic_op(None)
if state.request == BackendRequest.TERMINATION_NO_ERROR:
sys.exit(0)
elif state.request == BackendRequest.DELAY_IDLE:
LOGGER.info("TMTC Client in IDLE mode")
time.sleep(3.0)
elif state.request == BackendRequest.DELAY_LISTENER:
time.sleep(0.8)
elif state.request == BackendRequest.DELAY_CUSTOM:
time.sleep(state.next_delay.total_seconds())
elif state.request == BackendRequest.CALL_NEXT:
pass
except KeyboardInterrupt:
sys.exit(0)
if __name__ == "__main__":