Skip to content

Commit

Permalink
prep next major version
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed May 5, 2024
1 parent a56a9bd commit fd48282
Show file tree
Hide file tree
Showing 22 changed files with 190 additions and 741 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ Starting from v4.0.0, this project adheres to [Semantic Versioning](http://semve

# [unreleased]

# [v8.0.0] 2024-05-05

## Changed

- Renamed `FsfwTmTcPrinter.get_validity_buffer` to `FsfwTmTcPrinter.get_validity_buffer_str`
- Renamed `ObjectId<$TY>.from_bytes` to `ObjectId<$TY>.from_bytes_typed` to avoid invalid override.

## Added

- Added `fsfw.tmtc_printer.get_validity_buffer_str` function.

## Removed

- Broken FSFW PUS 3, PUS 20, PUS 8 TM unpackers.

# [v8.0.0rc2] 2024-04-23

- Bumped `spacepackets` to release range >=0.24, <0.25.
Expand All @@ -22,7 +37,7 @@ Starting from v4.0.0, this project adheres to [Semantic Versioning](http://semve
- Renamed `add_default_procedure_arguments` to `add_tree_commanding_arguments`.
- Renamed `TcProcedureType.DEFAULT` to `TcProcedureType.TREE_COMMANDING`.
- Replaced `TelemetryListT` by `List[bytes]`.
- Renamed `TcpSpacePacketsComIF` to `TcpSpacePacketsClient`.
- Renamed `TcpSpacePacketsComIF` to `TcpSpacepacketsClient`.
- Renamed `UdpComIF` to `UdpClient`.

## Removed
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,20 @@ used either as a command line tool or as a GUI tool which requires a PyQt6 insta
packets and [CCSDS Space Packets](https://public.ccsds.org/Pubs/133x0b2e1.pdf).
This library uses the [spacepackets](https://github.com/us-irs/py-spacepackets) library for most
packet implementations.
- Support for both CLI and GUI usage
- Support for both CLI and GUI usage.
- Flexibility in the way to specify telecommands to send and how to handle incoming telemetry.
This is done by requiring the user to specify callbacks for both TC specification and TM handling.
- One-Queue Mode for simple command sequences and Multi-Queue for more complex command sequences
- Listener mode to only listen to incoming telemetry
- One-Queue Mode for simple command sequences and Multi-Queue for more complex command sequences.
- Listener mode to only listen to incoming telemetry.
- Some components are tailored towards usage with the
[Flight Software Framework (FSFW)](https://absatsw.irs.uni-stuttgart.de/index.html) and the
[sat-rs framework](https://absatsw.irs.uni-stuttgart.de/sat-rs.html)

The framework currently supports the following communication interfaces:
The framework currently supports the following communication interfaces (among others):

1. TCP/IP with UDP and TCP. The TCP interface currently only supports sending CCSDS space packets
and is able to parse those packets from the received data stream.
2. Serial Communication with a transport layer using either [COBS](https://pypi.org/project/cobs/)
encoded packets or DLE as a simple [ASCII based transport layer](https://pypi.org/project/dle-encoder/).
3. QEMU, using a virtual serial interface
2. Serial Communication with a transport layer using [COBS](https://pypi.org/project/cobs/).

It is also possible to supply custom interfaces.

Expand Down
10 changes: 0 additions & 10 deletions docs/api/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,3 @@ Objects Submodule
:members:
:undoc-members:
:show-inheritance:

Global Module [deprecated]
-----------------------------

This module is deprecated, and usage is discouraged.

.. automodule:: tmtccmd.config.globals
:members:
:undoc-members:
:show-inheritance:
21 changes: 9 additions & 12 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ the TMTC commander
The first way assumes that the OBSW can be run on a host computer and starts a TPC/IP
server internally. The TMTC commander can then be used to send telecommands via the TCP/IP
interface. The second way assumes that the OBSW is run on an external microcontroller.
Here, the serial interface is used to send telecommands. Other ways like sending TMTCs
Here, the serial interface is used to send telecommands. Other ways like sending TMTCs
via Ethernet to a microcontroller running a TCP/IP server are possible as well.

.. _`SOURCE`: https://www.ksat-stuttgart.de/en/our-missions/source/
Expand All @@ -33,25 +33,22 @@ Features
more information and examples.
- Special support for `Packet Utilisation Standard (PUS)`_ packets and `CCSDS Space Packets`_.
This library uses the `spacepackets`_ library for most packet implementations.
- Support for both CLI and GUI usage
- Support for both CLI and GUI usage.
- Flexibility in the way to specify telecommands to send and how to handle incoming telemetry.
This is done by requiring the user to specify callbacks for both TC specification and TM handling.
- One-Queue Mode for simple command sequences and Multi-Queue for more complex command sequences
- Listener mode to only listen to incoming telemetry
- Basic logger components which can be used to store sent Telecommands and incoming Telemetry
in files
- One-Queue Mode for simple command sequences and Multi-Queue for more complex command sequences.
- Listener mode to only listen to incoming telemetry.
- Some components are tailored towards usage with the
`Flight Software Framework (FSFW) <https://egit.irs.uni-stuttgart.de/fsfw/fsfw/>`_.
`Flight Software Framework (FSFW) <https://absatsw.irs.uni-stuttgart.de/projects/fsfw/>`_ and the
`sat-rs library <https://absatsw.irs.uni-stuttgart.de/projects/sat-rs/>`_.

This framework also has a communication interface abstraction which allows to exchange TMTC through
different channels. The framework currently supports the following communication interfaces:
different channels. The framework currently supports (among others) the following communication
interfaces:

1. TCP/IP with the :py:class:`tmtccmd.com.udp.UdpComIF` and :py:class:`tmtccmd.com.tcp.TcpSpacePacketsComIF`.
1. TCP/IP with the :py:class:`tmtccmd.com.udp.UdpClient` and :py:class:`tmtccmd.com.tcp.TcpSpacepacketsClient`.
2. Serial Communication with `COBS <https://pypi.org/project/cobs/>`_ encoded packets by using the
:py:class:`tmtccmd.com.serial_cobs.SerialCobsComIF`.
3. The `DLE ASCII based transport layer <https://pypi.org/project/dle-encoder/>`_ by using the
:py:class:`tmtccmd.com.serial_dle.SerialDleComIF`.
4. QEMU, using a virtual serial interface.

It is also possible to supply custom interfaces.

Expand Down
4 changes: 2 additions & 2 deletions examples/app/tmtcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ def main(): # noqa: C901
else:
post_args_wrapper.set_params_with_prompts(proc_wrapper)
params.apid = EXAMPLE_PUS_APID
if params.tc_params.print_tree:
perform_tree_printout(params.tc_params, hook_obj.get_command_definitions())
if params.cmd_params.print_tree and not params.use_gui:
perform_tree_printout(params.cmd_params, hook_obj.get_command_definitions())
sys.exit(0)
setup_args = SetupWrapper(
hook_obj=hook_obj, setup_params=params, proc_param_wrapper=proc_wrapper
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
name = "tmtccmd"
description = "TMTC Commander Core"
readme = "README.md"
version = "8.0.0rc.2"
version = "8.0.0"
requires-python = ">=3.8"
license = {text = "Apache-2.0 or MIT" }
authors = [
Expand Down
20 changes: 10 additions & 10 deletions tests/config/test_args_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_basic(self):
self.params.backend_params.mode = ""
self.params.backend_params.com_if_id = ""
self.simple_pargs_cli_set()
self.assertEqual(self.params.tc_params.delay, 0)
self.assertEqual(self.params.cmd_params.delay, 0)
self.assertEqual(self.params.backend_params.mode, "")
self.assertEqual(self.params.backend_params.com_if_id, "")
def_params = TreeCommandingParams(None)
Expand All @@ -62,9 +62,9 @@ def test_basic(self):
assign_com_if=False,
)
# Set to default value
self.assertEqual(self.params.tc_params.delay, 4.0)
self.assertEqual(self.params.cmd_params.delay, 4.0)
# Unset
self.assertEqual(self.params.tc_params.apid, 0)
self.assertEqual(self.params.cmd_params.apid, 0)
self.assertEqual(self.params.app_params.use_gui, False)
self.assertEqual(self.params.app_params.use_ansi_colors, True)
self.assertEqual(def_params.cmd_path, "/PING")
Expand All @@ -88,7 +88,7 @@ def test_delay_set(self):
assign_com_if=False,
)
self.assertEqual(def_params.cmd_path, "/PING")
self.assertEqual(self.params.tc_params.delay, 2.0)
self.assertEqual(self.params.cmd_params.delay, 2.0)

def test_cfdp_conversion_basic(self):
self.pargs.source = "hello.txt"
Expand Down Expand Up @@ -147,9 +147,9 @@ def test_tree_printout_conversion_default(self):
def_tmtc_params=def_params,
assign_com_if=False,
)
self.assertTrue(self.params.tc_params.print_tree)
self.assertTrue(self.params.tc_params.tree_print_with_description)
self.assertIsNone(self.params.tc_params.tree_print_max_depth)
self.assertTrue(self.params.cmd_params.print_tree)
self.assertTrue(self.params.cmd_params.tree_print_with_description)
self.assertIsNone(self.params.cmd_params.tree_print_max_depth)

def test_tree_printout_conversion_with_custom_args(self):
self.base_cli_set()
Expand All @@ -163,9 +163,9 @@ def test_tree_printout_conversion_with_custom_args(self):
def_tmtc_params=def_params,
assign_com_if=False,
)
self.assertTrue(self.params.tc_params.print_tree)
self.assertFalse(self.params.tc_params.tree_print_with_description)
self.assertEqual(self.params.tc_params.tree_print_max_depth, 2)
self.assertTrue(self.params.cmd_params.print_tree)
self.assertFalse(self.params.cmd_params.tree_print_with_description)
self.assertEqual(self.params.cmd_params.tree_print_max_depth, 2)

@patch("builtins.print")
def test_tree_printout_0(self, print_mock: MagicMock):
Expand Down
2 changes: 1 addition & 1 deletion tmtccmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def create_default_tmtc_backend(
if setup_wrapper.params.backend_params.listener:
tmtc_backend.keep_listener_mode = True
tmtc_backend.inter_cmd_delay = timedelta(
seconds=setup_wrapper.params.tc_params.delay
seconds=setup_wrapper.params.cmd_params.delay
)
if init_procedure is not None:
tmtc_backend.current_procedure = init_procedure.procedure
Expand Down
8 changes: 4 additions & 4 deletions tmtccmd/com/tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import threading
import select
from collections import deque
from typing import List, Optional, Sequence
from typing import Any, List, Optional, Sequence

from spacepackets.ccsds.spacepacket import parse_space_packets, PacketId

Expand All @@ -27,7 +27,7 @@ class TcpCommunicationType(enum.Enum):
SPACE_PACKETS = 0


class TcpSpacePacketsClient(ComInterface):
class TcpSpacepacketsClient(ComInterface):
"""Communication interface for TCP communication. This particular interface expects
raw space packets to be sent via TCP and uses a list of passed packet IDs to parse for them.
"""
Expand Down Expand Up @@ -74,10 +74,10 @@ def __del__(self):
except IOError:
_LOGGER.warning("Could not close TCP communication interface!")

def initialize(self, args: any = None) -> any:
def initialize(self, args: Any = None):
pass

def open(self, args: any = None):
def open(self, args: Any = None):
if self.is_open():
return
self.__thread_kill_signal.clear()
Expand Down
42 changes: 21 additions & 21 deletions tmtccmd/config/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,25 @@ class SetupParams:
def __init__(
self,
com_if: Optional[ComInterface] = None,
tc_params: Optional[CommandingParams] = None,
cmd_params: Optional[CommandingParams] = None,
backend_params: Optional[BackendParams] = None,
app_params: Optional[AppParams] = None,
):
self.com_if = com_if
if tc_params is None:
self.tc_params = CommandingParams()
if cmd_params is None:
self.cmd_params = CommandingParams()
if backend_params is None:
self.backend_params = BackendParams()
if app_params is None:
self.app_params = AppParams()

@property
def apid(self):
return self.tc_params.apid
return self.cmd_params.apid

@apid.setter
def apid(self, apid):
self.tc_params.apid = apid
self.cmd_params.apid = apid

@property
def use_gui(self):
Expand Down Expand Up @@ -458,9 +458,9 @@ def args_to_all_params_for_cfdp(
CoreModeList.MULTI_INTERACTIVE_QUEUE_MODE
)
if pargs.delay is None:
params.tc_params.delay = 0.4
params.cmd_params.delay = 0.4
else:
params.tc_params.delay = float(pargs.delay)
params.cmd_params.delay = float(pargs.delay)


def args_to_all_params_tmtc(
Expand Down Expand Up @@ -496,14 +496,14 @@ def args_to_all_params_tmtc(
use_prompts=use_prompts,
assign_com_if=assign_com_if,
)
params.tc_params.print_tree = False
params.cmd_params.print_tree = False
if pargs.print_tree is not None:
params.tc_params.print_tree = True
params.cmd_params.print_tree = True
for arg in pargs.print_tree:
if "b" in arg:
params.tc_params.tree_print_with_description = False
params.cmd_params.tree_print_with_description = False
if arg.isdigit():
params.tc_params.tree_print_max_depth = int(arg)
params.cmd_params.tree_print_max_depth = int(arg)
mode_set_explicitely = False
if pargs.mode is None:
params.mode = CoreModeConverter.get_str(CoreModeList.ONE_QUEUE_MODE)
Expand All @@ -521,14 +521,14 @@ def args_to_all_params_tmtc(
if params.backend_params.mode == CoreModeConverter.get_str(
CoreModeList.ONE_QUEUE_MODE
):
params.tc_params.delay = 4.0
params.cmd_params.delay = 4.0
else:
params.tc_params.delay = 0.0
params.cmd_params.delay = 0.0
else:
params.tc_params.delay = float(pargs.delay)
params.cmd_params.delay = float(pargs.delay)
if (
params.mode != CoreModeConverter.get_str(CoreModeList.LISTENER_MODE)
and not params.tc_params.print_tree
and not params.cmd_params.print_tree
):
determine_cmd_path(
params=params,
Expand All @@ -539,18 +539,18 @@ def args_to_all_params_tmtc(
)


def perform_tree_printout(tc_params: CommandingParams, cmd_def_tree: CmdTreeNode):
if tc_params.tree_print_with_description:
def perform_tree_printout(cmd_params: CommandingParams, cmd_def_tree: CmdTreeNode):
if cmd_params.tree_print_with_description:
info_str = "with full descriptions"
else:
info_str = "without descriptions"
if tc_params.tree_print_max_depth is not None:
info_str += f" and maximum depth {tc_params.tree_print_max_depth}"
if cmd_params.tree_print_max_depth is not None:
info_str += f" and maximum depth {cmd_params.tree_print_max_depth}"
print(f"Printing command tree {info_str}:")
print(
cmd_def_tree.str_for_tree(
tc_params.tree_print_with_description,
tc_params.tree_print_max_depth,
cmd_params.tree_print_with_description,
cmd_params.tree_print_max_depth,
)
)

Expand Down
4 changes: 2 additions & 2 deletions tmtccmd/config/com.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from tmtccmd.com.ser_utils import determine_com_port, determine_baud_rate
from tmtccmd.com.tcpip_utils import TcpIpType, EthAddr
from tmtccmd.com.udp import UdpClient
from tmtccmd.com.tcp import TcpSpacePacketsClient
from tmtccmd.com.tcp import TcpSpacepacketsClient

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -219,7 +219,7 @@ def create_default_tcpip_interface(tcpip_cfg: TcpipCfg) -> Optional[ComInterface
)
elif tcpip_cfg.com_if_key == CoreComInterfaces.TCP.value:
assert tcpip_cfg.space_packet_ids is not None
communication_interface = TcpSpacePacketsClient(
communication_interface = TcpSpacepacketsClient(
com_if_id=tcpip_cfg.com_if_key,
space_packet_ids=tcpip_cfg.space_packet_ids,
inner_thread_delay=0.5,
Expand Down
Loading

0 comments on commit fd48282

Please sign in to comment.