From 49b55f01e385b89820df8dcfefd2073b627eed8a Mon Sep 17 00:00:00 2001 From: meggert Date: Mon, 18 Mar 2024 11:11:20 +0100 Subject: [PATCH 01/21] s --- eive_tmtc/tmtc/tcs/heater.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eive_tmtc/tmtc/tcs/heater.py b/eive_tmtc/tmtc/tcs/heater.py index 99fe3eb..356b751 100644 --- a/eive_tmtc/tmtc/tcs/heater.py +++ b/eive_tmtc/tmtc/tcs/heater.py @@ -59,7 +59,7 @@ CTN = CmdTreeNode def create_heater_node() -> CmdTreeNode: - node = CmdTreeNode("heater", "Heater Device", hide_children_which_are_leaves=True) + node = CmdTreeNode("heaters", "Heater Device", hide_children_which_are_leaves=True) node.add_child(CTN(OpCode.HEATER_CMD, Info.HEATER_CMD)) node.add_child(CTN(OpCode.HEATER_HEALTHY_CMD, Info.HEATER_HEALTHY_CMD)) node.add_child(CTN(OpCode.HEATER_EXT_CTRL, Info.HEATER_EXT_CTRL)) From 92c0172b59f92067a00a9a1b12e6f8ab4f19be56 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 26 Mar 2024 17:50:37 +0100 Subject: [PATCH 02/21] bugfix for EPS --- eive_tmtc/pus_tc/cmd_demux.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eive_tmtc/pus_tc/cmd_demux.py b/eive_tmtc/pus_tc/cmd_demux.py index d379ebd..0f0f5ec 100644 --- a/eive_tmtc/pus_tc/cmd_demux.py +++ b/eive_tmtc/pus_tc/cmd_demux.py @@ -116,9 +116,9 @@ def handle_pus_procedure( def handle_eps_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]): obj_id_man = get_object_ids() - if len(cmd_path_list) == 1: - return pack_power_commands(queue_helper, cmd_path_list[0]) - assert len(cmd_path_list) >= 2 + assert len(cmd_path_list) >= 1 + if cmd_path_list[0] == "power": + return pack_power_commands(queue_helper, cmd_path_list[1]) if cmd_path_list[0] == "pwr_ctrl": return pack_power_ctrl_command(queue_helper, cmd_path_list[1]) if cmd_path_list[0] == "p60_dock": From 4704616ca71825d899885d56020a66387a7eee5d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 26 Mar 2024 17:52:41 +0100 Subject: [PATCH 03/21] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c055ce7..57eb6b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ list yields a list of all related PRs for each release. - Added version set for STR +## Fixed + +- EPS power commands working again. + # [v6.1.1] 2024-03-06 ## Added From 492d364246b3417ce3815dc58b405f493e77b9f7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 8 Apr 2024 11:35:05 +0200 Subject: [PATCH 04/21] relative timeshift --- eive_tmtc/tmtc/time.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/eive_tmtc/tmtc/time.py b/eive_tmtc/tmtc/time.py index 1e7fdc7..c8f79a1 100644 --- a/eive_tmtc/tmtc/time.py +++ b/eive_tmtc/tmtc/time.py @@ -1,6 +1,7 @@ import enum +import struct import logging -from datetime import datetime +import datetime from spacepackets.ecss import PusTelecommand, PusService @@ -8,26 +9,31 @@ from tmtccmd.tmtc import DefaultPusQueueHelper from tmtccmd.config import CmdTreeNode +_LOGGER = logging.getLogger(__name__) + class Subservice(enum.IntEnum): SET_TIME = 128 DUMP_TIME = 129 + RELATIVE_TIMESHIFT = 130 class CmdStr: SET_CURRENT_TIME = "set_curr_time" + RELATIVE_TIMESHIFT = "relative_timeshift" DUMP_TIME = "dump_time" class Info: SET_CURRENT_TIME = "Setting current time in ASCII format" + RELATIVE_TIMESHIFT = "Shift time with a relative offset" DUMP_TIME = "Dump system time as event" def pack_time_management_cmd(q: DefaultPusQueueHelper, cmd_str: str): if cmd_str == CmdStr.SET_CURRENT_TIME: - current_time = datetime.utcnow().isoformat() + "Z" + "\0" + current_time = datetime.datetime.now(datetime.UTC).isoformat() + "Z" + "\0" current_time_ascii = current_time.encode("ascii") - logging.getLogger(__name__).info( + _LOGGER.info( f"Current time in ASCII format: {current_time_ascii}" ) q.add_log_cmd(Info.SET_CURRENT_TIME) @@ -38,6 +44,17 @@ def pack_time_management_cmd(q: DefaultPusQueueHelper, cmd_str: str): app_data=current_time_ascii, ) ) + elif cmd_str == CmdStr.RELATIVE_TIMESHIFT: + nanos = input("Specify relative timeshift in nanoseconds") + nanos_packed = struct.pack("!Q", nanos) + q.add_log_cmd(Info.RELATIVE_TIMESHIFT) + q.add_pus_tc( + PusTelecommand( + service=PusService.S9_TIME_MGMT, + subservice=Subservice.RELATIVE_TIMESHIFT, + app_data=nanos_packed + ) + ) elif cmd_str == CmdStr.DUMP_TIME: q.add_log_cmd(Info.DUMP_TIME) q.add_pus_tc( @@ -51,4 +68,5 @@ def create_time_node() -> CmdTreeNode: time_node = CmdTreeNode("time", "Time Management") time_node.add_child(CmdTreeNode(CmdStr.SET_CURRENT_TIME, "Set current time")) time_node.add_child(CmdTreeNode(CmdStr.DUMP_TIME, "Dumpy current time")) + time_node.add_child(CmdTreeNode(CmdStr.RELATIVE_TIMESHIFT,Info.RELATIVE_TIMESHIFT)) return time_node From c72a04b2621dae7de6b6527bf086100d2f5d93e6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 8 Apr 2024 11:36:25 +0200 Subject: [PATCH 05/21] allow setting health for payload components --- eive_tmtc/tmtc/obj_prompt.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eive_tmtc/tmtc/obj_prompt.py b/eive_tmtc/tmtc/obj_prompt.py index c472a01..d19df3b 100644 --- a/eive_tmtc/tmtc/obj_prompt.py +++ b/eive_tmtc/tmtc/obj_prompt.py @@ -6,6 +6,7 @@ from eive_tmtc.config.object_ids import ( GYRO_1_L3G_HANDLER_ID, GYRO_2_ADIS_HANDLER_ID, ACS_BOARD_ASS_ID, + PLOC_MPSOC_ID, RW_ASSEMBLY, SUS_BOARD_ASS_ID, MGM_0_LIS3_HANDLER_ID, @@ -28,6 +29,7 @@ SUBSYSTEM_DICT = { 0: "acs", 1: "tcs", 2: "com", + 3: "payload", } ACS_OBJ_DICT = { @@ -59,6 +61,10 @@ TCS_OBJ_DICT = { 5: ("TMP1075 IF BOARD", TMP1075_HANDLER_IF_BRD_ID), } +PAYLOAD_OBJ_DICT = { + 0: ("Payload MPSoC", PLOC_MPSOC_ID), +} + def get_obj_if_from_dict(lut: dict) -> bytes: for k, v in lut.items(): @@ -81,6 +87,8 @@ def prompt_object() -> bytes: return get_obj_if_from_dict(ACS_OBJ_DICT) elif subsystem == "tcs": return get_obj_if_from_dict(TCS_OBJ_DICT) + elif subsystem == "payload": + return get_obj_if_from_dict(PAYLOAD_OBJ_DICT) else: print(f"No object for subsystem {subsystem}") return bytes() From d182a9d5ec51ea069c78d728c759b53ded8bb222 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 8 Apr 2024 13:24:40 +0200 Subject: [PATCH 06/21] re-run black --- eive_tmtc/config/custom_mode_op.py | 1 + eive_tmtc/config/object_ids.py | 1 + eive_tmtc/pus_tc/cmd_demux.py | 1 + eive_tmtc/pus_tm/event_handler.py | 4 ++-- eive_tmtc/pus_tm/hk_handler.py | 1 + eive_tmtc/pus_tm/pus_handler.py | 1 + eive_tmtc/tmtc/time.py | 17 +++++++++-------- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/eive_tmtc/config/custom_mode_op.py b/eive_tmtc/config/custom_mode_op.py index 7981371..6143aaa 100644 --- a/eive_tmtc/config/custom_mode_op.py +++ b/eive_tmtc/config/custom_mode_op.py @@ -3,6 +3,7 @@ @details Template configuration file. Copy this folder to the TMTC commander root and adapt it to your needs. """ + import enum from tmtccmd import CcsdsTmtcBackend diff --git a/eive_tmtc/config/object_ids.py b/eive_tmtc/config/object_ids.py index cb81d07..3d1c1c5 100644 --- a/eive_tmtc/config/object_ids.py +++ b/eive_tmtc/config/object_ids.py @@ -3,6 +3,7 @@ @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 diff --git a/eive_tmtc/pus_tc/cmd_demux.py b/eive_tmtc/pus_tc/cmd_demux.py index 0f0f5ec..33e5548 100644 --- a/eive_tmtc/pus_tc/cmd_demux.py +++ b/eive_tmtc/pus_tc/cmd_demux.py @@ -1,5 +1,6 @@ """Hook function which packs telecommands based on service and operation code string """ + import logging from typing import List, cast diff --git a/eive_tmtc/pus_tm/event_handler.py b/eive_tmtc/pus_tm/event_handler.py index 496c28b..8dc5a31 100644 --- a/eive_tmtc/pus_tm/event_handler.py +++ b/eive_tmtc/pus_tm/event_handler.py @@ -124,8 +124,8 @@ def handle_event_packet( # noqa C901: Complexity okay here pw.dlog(f"New time (UTC): {new_time_dt}") if info.name == "CLOCK_DUMP": specific_handler = True - # param 1 is timeval seconds, param 2 is timeval subsecond milliseconds - time = event_def.param1 + event_def.param2 / 1000.0 + # param 1 is timeval seconds, param 2 is timeval subsecond microseconds + time = event_def.param1 + event_def.param2 / 1000000.0 time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc) pw.dlog(f"Current time: {time_dt}") if info.name == "ACTIVE_SD_INFO": diff --git a/eive_tmtc/pus_tm/hk_handler.py b/eive_tmtc/pus_tm/hk_handler.py index 56c53af..bee9f23 100644 --- a/eive_tmtc/pus_tm/hk_handler.py +++ b/eive_tmtc/pus_tm/hk_handler.py @@ -1,4 +1,5 @@ """HK Handling for EIVE OBSW""" + import dataclasses import logging import base64 # noqa diff --git a/eive_tmtc/pus_tm/pus_handler.py b/eive_tmtc/pus_tm/pus_handler.py index f3e62d1..7767b7f 100644 --- a/eive_tmtc/pus_tm/pus_handler.py +++ b/eive_tmtc/pus_tm/pus_handler.py @@ -1,5 +1,6 @@ """Core EIVE TM handler module """ + import logging import sqlite3 import uuid diff --git a/eive_tmtc/tmtc/time.py b/eive_tmtc/tmtc/time.py index c8f79a1..97413c5 100644 --- a/eive_tmtc/tmtc/time.py +++ b/eive_tmtc/tmtc/time.py @@ -11,6 +11,7 @@ from tmtccmd.config import CmdTreeNode _LOGGER = logging.getLogger(__name__) + class Subservice(enum.IntEnum): SET_TIME = 128 DUMP_TIME = 129 @@ -31,11 +32,11 @@ class Info: def pack_time_management_cmd(q: DefaultPusQueueHelper, cmd_str: str): if cmd_str == CmdStr.SET_CURRENT_TIME: - current_time = datetime.datetime.now(datetime.UTC).isoformat() + "Z" + "\0" - current_time_ascii = current_time.encode("ascii") - _LOGGER.info( - f"Current time in ASCII format: {current_time_ascii}" + current_time = ( + datetime.datetime.now(datetime.timezone.utc).isoformat() + "Z" + "\0" ) + current_time_ascii = current_time.encode("ascii") + _LOGGER.info(f"Current time in ASCII format: {current_time_ascii}") q.add_log_cmd(Info.SET_CURRENT_TIME) q.add_pus_tc( PusTelecommand( @@ -45,14 +46,14 @@ def pack_time_management_cmd(q: DefaultPusQueueHelper, cmd_str: str): ) ) elif cmd_str == CmdStr.RELATIVE_TIMESHIFT: - nanos = input("Specify relative timeshift in nanoseconds") - nanos_packed = struct.pack("!Q", nanos) + nanos = int(input("Specify relative timeshift in nanoseconds: ")) + nanos_packed = struct.pack("!q", nanos) q.add_log_cmd(Info.RELATIVE_TIMESHIFT) q.add_pus_tc( PusTelecommand( service=PusService.S9_TIME_MGMT, subservice=Subservice.RELATIVE_TIMESHIFT, - app_data=nanos_packed + app_data=nanos_packed, ) ) elif cmd_str == CmdStr.DUMP_TIME: @@ -68,5 +69,5 @@ def create_time_node() -> CmdTreeNode: time_node = CmdTreeNode("time", "Time Management") time_node.add_child(CmdTreeNode(CmdStr.SET_CURRENT_TIME, "Set current time")) time_node.add_child(CmdTreeNode(CmdStr.DUMP_TIME, "Dumpy current time")) - time_node.add_child(CmdTreeNode(CmdStr.RELATIVE_TIMESHIFT,Info.RELATIVE_TIMESHIFT)) + time_node.add_child(CmdTreeNode(CmdStr.RELATIVE_TIMESHIFT, Info.RELATIVE_TIMESHIFT)) return time_node From de84bf112b74347e2022e3850b60ca73cb1d8ce9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 8 Apr 2024 13:25:45 +0200 Subject: [PATCH 07/21] changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57eb6b9..2142692 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,8 @@ list yields a list of all related PRs for each release. ## Added -- Added version set for STR +- Added version set for STR. +- Command for relative timeshift. ## Fixed From 3ae6ccfb7775dc091a63fad6b3e040ce6bd501a8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 8 Apr 2024 13:35:06 +0200 Subject: [PATCH 08/21] this should do the job --- eive_tmtc/pus_tm/event_handler.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eive_tmtc/pus_tm/event_handler.py b/eive_tmtc/pus_tm/event_handler.py index 8dc5a31..e5cfc35 100644 --- a/eive_tmtc/pus_tm/event_handler.py +++ b/eive_tmtc/pus_tm/event_handler.py @@ -122,6 +122,12 @@ def handle_event_packet( # noqa C901: Complexity okay here new_time_dt = datetime.datetime.fromtimestamp(new_time, datetime.timezone.utc) pw.dlog(f"Old time (UTC): {old_time_dt}") pw.dlog(f"New time (UTC): {new_time_dt}") + if info.name == "CLOCK_DUMP_LEGACY": + specific_handler = True + # param 1 is timeval seconds, param 2 is timeval subsecond milliseconds + time = event_def.param1 + event_def.param2 / 1000.0 + time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc) + pw.dlog(f"Current time: {time_dt}") if info.name == "CLOCK_DUMP": specific_handler = True # param 1 is timeval seconds, param 2 is timeval subsecond microseconds From 5bdba2dbad71b94a7b9c9240793eae40dda08de2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 8 Apr 2024 13:35:34 +0200 Subject: [PATCH 09/21] update events --- eive_tmtc/config/events.csv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eive_tmtc/config/events.csv b/eive_tmtc/config/events.csv index 200cbdb..1a30260 100644 --- a/eive_tmtc/config/events.csv +++ b/eive_tmtc/config/events.csv @@ -76,8 +76,9 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 7903;0x1edf;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h 7905;0x1ee1;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h 8900;0x22c4;CLOCK_SET;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h -8901;0x22c5;CLOCK_DUMP;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h +8901;0x22c5;CLOCK_DUMP_LEGACY;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h 8902;0x22c6;CLOCK_SET_FAILURE;LOW;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h +8903;0x22c7;CLOCK_DUMP;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h 9100;0x238c;TC_DELETION_FAILED;MEDIUM;Deletion of a TC from the map failed. P1: First 32 bit of request ID, P2. Last 32 bit of Request ID;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h 9700;0x25e4;TEST;INFO;No description;fsfw/src/fsfw/pus/Service17Test.h 10600;0x2968;CHANGE_OF_SETUP_PARAMETER;LOW;No description;fsfw/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h From 5a0edbefa8449f4796d7d0976822c8fda139c598 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 8 Apr 2024 13:38:28 +0200 Subject: [PATCH 10/21] fix comment block --- eive_tmtc/config/events.csv | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eive_tmtc/config/events.csv b/eive_tmtc/config/events.csv index 1a30260..34aa934 100644 --- a/eive_tmtc/config/events.csv +++ b/eive_tmtc/config/events.csv @@ -75,10 +75,10 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 7902;0x1ede;BIT_LOCK;INFO;A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h 7903;0x1edf;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h 7905;0x1ee1;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h -8900;0x22c4;CLOCK_SET;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h -8901;0x22c5;CLOCK_DUMP_LEGACY;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h -8902;0x22c6;CLOCK_SET_FAILURE;LOW;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h -8903;0x22c7;CLOCK_DUMP;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h +8900;0x22c4;CLOCK_SET;INFO;Clock has been set. P1: old timeval seconds. P2: new timeval seconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h +8901;0x22c5;CLOCK_DUMP_LEGACY;INFO;Clock dump event. P1: timeval seconds P2: timeval milliseconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h +8902;0x22c6;CLOCK_SET_FAILURE;LOW;Clock could not be set. P1: Returncode.;fsfw/src/fsfw/pus/Service9TimeManagement.h +8903;0x22c7;CLOCK_DUMP;INFO;Clock dump event. P1: timeval seconds P2: timeval microseconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h 9100;0x238c;TC_DELETION_FAILED;MEDIUM;Deletion of a TC from the map failed. P1: First 32 bit of request ID, P2. Last 32 bit of Request ID;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h 9700;0x25e4;TEST;INFO;No description;fsfw/src/fsfw/pus/Service17Test.h 10600;0x2968;CHANGE_OF_SETUP_PARAMETER;LOW;No description;fsfw/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h From 5af69eb14ec81be896908eb4ffbcf5fde31dc9d1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 8 Apr 2024 13:40:37 +0200 Subject: [PATCH 11/21] add supervisor --- eive_tmtc/tmtc/obj_prompt.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eive_tmtc/tmtc/obj_prompt.py b/eive_tmtc/tmtc/obj_prompt.py index d19df3b..0764a92 100644 --- a/eive_tmtc/tmtc/obj_prompt.py +++ b/eive_tmtc/tmtc/obj_prompt.py @@ -7,6 +7,7 @@ from eive_tmtc.config.object_ids import ( GYRO_2_ADIS_HANDLER_ID, ACS_BOARD_ASS_ID, PLOC_MPSOC_ID, + PLOC_SUPV_ID, RW_ASSEMBLY, SUS_BOARD_ASS_ID, MGM_0_LIS3_HANDLER_ID, @@ -63,6 +64,7 @@ TCS_OBJ_DICT = { PAYLOAD_OBJ_DICT = { 0: ("Payload MPSoC", PLOC_MPSOC_ID), + 1: ("Payload Supervisor", PLOC_SUPV_ID), } From 11d7ad0f8d9cc01be7b3093e9b525c8dc47b3772 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 9 Apr 2024 11:32:57 +0200 Subject: [PATCH 12/21] start fixing PLOC tree --- eive_tmtc/config/custom_mode_op.py | 1 + eive_tmtc/config/object_ids.py | 1 + eive_tmtc/pus_tc/cmd_definitions.py | 21 --------------------- eive_tmtc/pus_tc/cmd_demux.py | 5 ++++- eive_tmtc/pus_tm/hk_handler.py | 1 + eive_tmtc/pus_tm/pus_handler.py | 1 + eive_tmtc/tmtc/payload/subsystem.py | 26 +++++++++++++++++++++----- 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/eive_tmtc/config/custom_mode_op.py b/eive_tmtc/config/custom_mode_op.py index 7981371..6143aaa 100644 --- a/eive_tmtc/config/custom_mode_op.py +++ b/eive_tmtc/config/custom_mode_op.py @@ -3,6 +3,7 @@ @details Template configuration file. Copy this folder to the TMTC commander root and adapt it to your needs. """ + import enum from tmtccmd import CcsdsTmtcBackend diff --git a/eive_tmtc/config/object_ids.py b/eive_tmtc/config/object_ids.py index cb81d07..3d1c1c5 100644 --- a/eive_tmtc/config/object_ids.py +++ b/eive_tmtc/config/object_ids.py @@ -3,6 +3,7 @@ @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 diff --git a/eive_tmtc/pus_tc/cmd_definitions.py b/eive_tmtc/pus_tc/cmd_definitions.py index 88ba312..e69de29 100644 --- a/eive_tmtc/pus_tc/cmd_definitions.py +++ b/eive_tmtc/pus_tc/cmd_definitions.py @@ -1,21 +0,0 @@ -from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry, CoreServiceList -from tmtccmd.config.tmtc import ( - call_all_definitions_providers, -) -from tmtccmd.config.globals import get_default_tmtc_defs - - -def get_eive_service_op_code_dict() -> TmtcDefinitionWrapper: - """Call all registered TMTC definition providers. They were registered using - the :py:func:`tmtc_definitions_provider` decorator. - """ - def_wrapper = get_default_tmtc_defs() - srv_5 = OpCodeEntry() - srv_5.add("0", "Event Test") - def_wrapper.add_service( - name=CoreServiceList.SERVICE_5.value, - info="PUS Service 5 Event", - op_code_entry=srv_5, - ) - call_all_definitions_providers(def_wrapper) - return def_wrapper diff --git a/eive_tmtc/pus_tc/cmd_demux.py b/eive_tmtc/pus_tc/cmd_demux.py index 0f0f5ec..dd80722 100644 --- a/eive_tmtc/pus_tc/cmd_demux.py +++ b/eive_tmtc/pus_tc/cmd_demux.py @@ -1,5 +1,6 @@ """Hook function which packs telecommands based on service and operation code string """ + import logging from typing import List, cast @@ -51,6 +52,7 @@ from eive_tmtc.tmtc.com.subsystem import build_com_subsystem_procedure from eive_tmtc.tmtc.com.syrlinks_handler import pack_syrlinks_command from eive_tmtc.tmtc.core import pack_core_commands from eive_tmtc.tmtc.health import build_health_cmds +from eive_tmtc.tmtc.payload.subsystem import create_payload_subsystem_cmd from eive_tmtc.tmtc.payload.ploc_mpsoc import pack_ploc_mpsoc_commands from eive_tmtc.tmtc.payload.ploc_supervisor import pack_ploc_supv_commands from eive_tmtc.tmtc.payload.plpcdu import pack_pl_pcdu_commands @@ -251,7 +253,8 @@ def handle_payload_procedure( queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str] ): obj_id_man = get_object_ids() - assert len(cmd_path_list) >= 2 + if cmd_path_list[0] == "subsystem": + return create_payload_subsystem_cmd(queue_helper, cmd_path_list[1]) if cmd_path_list[0] == "ploc_mpsoc": return pack_ploc_mpsoc_commands(queue_helper, cmd_path_list[1]) if cmd_path_list[0] == "ploc_supv": diff --git a/eive_tmtc/pus_tm/hk_handler.py b/eive_tmtc/pus_tm/hk_handler.py index 56c53af..bee9f23 100644 --- a/eive_tmtc/pus_tm/hk_handler.py +++ b/eive_tmtc/pus_tm/hk_handler.py @@ -1,4 +1,5 @@ """HK Handling for EIVE OBSW""" + import dataclasses import logging import base64 # noqa diff --git a/eive_tmtc/pus_tm/pus_handler.py b/eive_tmtc/pus_tm/pus_handler.py index f3e62d1..7767b7f 100644 --- a/eive_tmtc/pus_tm/pus_handler.py +++ b/eive_tmtc/pus_tm/pus_handler.py @@ -1,5 +1,6 @@ """Core EIVE TM handler module """ + import logging import sqlite3 import uuid diff --git a/eive_tmtc/tmtc/payload/subsystem.py b/eive_tmtc/tmtc/payload/subsystem.py index 529865e..7ebd77a 100644 --- a/eive_tmtc/tmtc/payload/subsystem.py +++ b/eive_tmtc/tmtc/payload/subsystem.py @@ -21,20 +21,27 @@ class ModeId(enum.IntEnum): class OpCode(str, enum.Enum): OFF = "off" REPORT_ALL_MODES = "report_modes" + MPSOC_STREAM = "mode_mpsoc_stream" + CAM_STREAM = "mode_cam_stream" + EARTH_OBSV = "mode_eart_obsv" class Info(str, enum.Enum): OFF = "Off Command" REPORT_ALL_MODES = "Report all modes" + MPSOC_STREAM = "MPSoC Stream Mode" + CAM_STREAM = "Camera Stream Mode" + EARTH_OBSV = "Earth Observation Mode" HANDLER_LIST: Dict[str, Tuple[int, str]] = { OpCode.OFF: (ModeId.OFF, Info.OFF), + OpCode.MPSOC_STREAM: (ModeId.MPSOC_STREAM, Info.MPSOC_STREAM), } -def build_acs_subsystem_cmd(q: DefaultPusQueueHelper, cmd_str: str): - info_prefix = "ACS Subsystem" +def create_payload_subsystem_cmd(q: DefaultPusQueueHelper, cmd_str: str): + info_prefix = "Payload Subsystem" if cmd_str == OpCode.REPORT_ALL_MODES: q.add_log_cmd(f"{info_prefix}: {Info.REPORT_ALL_MODES}") q.add_pus_tc( @@ -45,19 +52,28 @@ def build_acs_subsystem_cmd(q: DefaultPusQueueHelper, cmd_str: str): ) ) mode_info_tup = HANDLER_LIST.get(cmd_str) + assert mode_info_tup is not None if mode_info_tup is None: return pack_mode_cmd_with_info( object_id=PL_SUBSYSTEM_ID, info=f"{info_prefix}: {mode_info_tup[1]}", - submode=0, mode=mode_info_tup[0], + submode=0, q=q, ) def create_payload_subsystem_node() -> CmdTreeNode: payload_node = CmdTreeNode("payload", "Payload Subsystem") - payload_node.add_child(CmdTreeNode(OpCode.OFF, Info.OFF)) - payload_node.add_child(CmdTreeNode(OpCode.REPORT_ALL_MODES, Info.REPORT_ALL_MODES)) + subsystem_node = CmdTreeNode("subsystem", "Subsystem Commands") + subsystem_node.add_child(CmdTreeNode(OpCode.OFF, Info.OFF)) + subsystem_node.add_child(CmdTreeNode(OpCode.MPSOC_STREAM, Info.MPSOC_STREAM)) + subsystem_node.add_child(CmdTreeNode(OpCode.EARTH_OBSV, Info.EARTH_OBSV)) + subsystem_node.add_child(CmdTreeNode(OpCode.CAM_STREAM, Info.CAM_STREAM)) + + subsystem_node.add_child( + CmdTreeNode(OpCode.REPORT_ALL_MODES, Info.REPORT_ALL_MODES) + ) + payload_node.add_child(subsystem_node) return payload_node From b160f079b104be5f43b76f4fdcd7a4321d09b4a7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 9 Apr 2024 13:19:25 +0200 Subject: [PATCH 13/21] small bugfix --- eive_tmtc/pus_tc/cmd_demux.py | 1 - 1 file changed, 1 deletion(-) diff --git a/eive_tmtc/pus_tc/cmd_demux.py b/eive_tmtc/pus_tc/cmd_demux.py index dd80722..12c4722 100644 --- a/eive_tmtc/pus_tc/cmd_demux.py +++ b/eive_tmtc/pus_tc/cmd_demux.py @@ -266,7 +266,6 @@ def handle_payload_procedure( object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1] ) if cmd_path_list[0] == "pl_pcdu": - assert len(cmd_path_list) >= 3 return pack_pl_pcdu_commands(q=queue_helper, cmd_str=cmd_path_list[1]) if cmd_path_list[0] == "scex": return pack_scex_cmds( From 6282686f2f384ae6f2a9d0f54ceecac62df1f583 Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 9 Apr 2024 13:29:01 +0200 Subject: [PATCH 14/21] lets just change the tmtc structure he said. everything will still work he said --- eive_tmtc/tmtc/acs/gps.py | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/eive_tmtc/tmtc/acs/gps.py b/eive_tmtc/tmtc/acs/gps.py index a99a7f0..7c309c7 100644 --- a/eive_tmtc/tmtc/acs/gps.py +++ b/eive_tmtc/tmtc/acs/gps.py @@ -15,6 +15,7 @@ from tmtccmd.pus.tc.s3_fsfw_hk import ( create_enable_periodic_hk_command_with_interval_with_diag, create_disable_periodic_hk_command_with_diag, ) +from tmtccmd.pus.tc.s8_fsfw_action import create_action_cmd from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter _LOGGER = logging.getLogger(__name__) @@ -24,6 +25,11 @@ class GpsInfo: MAX_SATELLITES = 30 +class GnssChip(enum.IntEnum): + A_SIDE = 0 + B_SIDE = 1 + + class OpCode: OFF = "off" ON = "on" @@ -59,36 +65,25 @@ def create_gnss_node() -> CmdTreeNode: ] info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")] combined_dict = dict(zip(op_code_strs, info_strs)) - node = CmdTreeNode("gnss", "GNSS device", hide_children_for_print=True) + node = CmdTreeNode("gnss_devs", "GNSS Controller", hide_children_for_print=True) for op_code, info in combined_dict.items(): node.add_child(CmdTreeNode(op_code, info)) return node -@tmtc_definitions_provider -def add_gps_cmds(defs: TmtcDefinitionWrapper): - oce = OpCodeEntry() - oce.add(keys=OpCode.OFF, info=Info.OFF) - oce.add(keys=OpCode.ON, info=Info.ON) - oce.add(keys=OpCode.RESET_GNSS, info=Info.RESET_GNSS) - oce.add(keys=OpCode.REQ_CORE_HK, info=Info.REQ_CORE_HK) - oce.add(keys=OpCode.ENABLE_CORE_HK, info=Info.ENABLE_CORE_HK) - oce.add(keys=OpCode.DISABLE_CORE_HK, info=Info.DISABLE_CORE_HK) - oce.add(keys=OpCode.REQ_SKYVIEW_HK, info=Info.REQ_SKYVIEW_HK) - oce.add(keys=OpCode.ENABLE_SKYVIEW_HK, info=Info.ENABLE_SKYVIEW_HK) - oce.add(keys=OpCode.DISABLE_SKYVIEW_HK, info=Info.DISABLE_SKYVIEW_HK) - defs.add_service( - name=CustomServiceList.GPS_CTRL.value, - info="GPS/GNSS Controller", - op_code_entry=oce, - ) - - def pack_gps_command( # noqa: C901 object_id: bytes, q: DefaultPusQueueHelper, cmd_str: str ): # noqa: C901: if cmd_str == OpCode.RESET_GNSS: - # TODO: This needs to be re-implemented + for val in GnssChip: + print("{:<2}: {:<20}".format(val, val.name)) + chip: str = "" + while chip not in ["0", "1"]: + chip = input("Please specify which chip to reset: ") + q.add_log_cmd(f"gps: {Info.DISABLE_CORE_HK}") + q.add_pus_tc( + create_action_cmd(object_id=object_id, action_id=5, user_data=chip.encode()) + ) _LOGGER.warning("Reset pin handling needs to be re-implemented") if cmd_str == OpCode.ENABLE_CORE_HK: interval = float(input("Please specify interval in floating point seconds: ")) From 7dfdd4096303ff9971e3e236132be7ea20ff8e18 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 9 Apr 2024 14:31:41 +0200 Subject: [PATCH 15/21] fixed PLOC mode commanding --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57eb6b9..f20ec3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ list yields a list of all related PRs for each release. - EPS power commands working again. +## Changed + +- Fixed PLOC commanding + # [v6.1.1] 2024-03-06 ## Added From a880db5655abf90d00fd44b175f75e778b78a75f Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 9 Apr 2024 14:34:23 +0200 Subject: [PATCH 16/21] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2142692..07db8a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ list yields a list of all related PRs for each release. ## Fixed - EPS power commands working again. +- GNSS commands working again. # [v6.1.1] 2024-03-06 From b5f4f2ddabf1ade594f80b8bc9cd835a1a4a9a10 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 10 Apr 2024 11:29:19 +0200 Subject: [PATCH 17/21] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a42af2..112bf97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ list yields a list of all related PRs for each release. - Added version set for STR. - Command for relative timeshift. +- Health commands for payload components. ## Fixed From 512f0e4530b2918cab6c317cc48cdc046018e4c9 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 10 Apr 2024 11:46:35 +0200 Subject: [PATCH 18/21] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9690546..a76b643 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ list yields a list of all related PRs for each release. # [unreleased] +# [v6.2.0] 2024-04-10 + ## Added - Added version set for STR. From 6d97841cbf439d441ab9d746667ab78a72ba2901 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 10 Apr 2024 11:47:05 +0200 Subject: [PATCH 19/21] bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 36e7208..b5f75e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" name = "eive-tmtc" description = "TMTC Commander EIVE" readme = "README.md" -version = "6.1.1" +version = "6.2.0" requires-python = ">=3.10" license = {text = "Apache-2.0"} authors = [ From 20ecef58382b3dd647fd722888fae051ca775340 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 10 Apr 2024 11:48:04 +0200 Subject: [PATCH 20/21] linter --- eive_tmtc/tmtc/acs/gps.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/eive_tmtc/tmtc/acs/gps.py b/eive_tmtc/tmtc/acs/gps.py index 7c309c7..7ff3d72 100644 --- a/eive_tmtc/tmtc/acs/gps.py +++ b/eive_tmtc/tmtc/acs/gps.py @@ -3,10 +3,8 @@ import enum import logging import struct -from eive_tmtc.config.definitions import CustomServiceList from eive_tmtc.pus_tm.defs import PrintWrapper -from tmtccmd.config import CmdTreeNode, TmtcDefinitionWrapper, OpCodeEntry -from tmtccmd.config.tmtc import tmtc_definitions_provider +from tmtccmd.config import CmdTreeNode from tmtccmd.pus.s200_fsfw_mode import create_mode_command, Mode from tmtccmd.tmtc import DefaultPusQueueHelper from tmtccmd.pus.tc.s3_fsfw_hk import ( From a0ad5f8948b433fd558122101b4efed4046c90d1 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 10 Apr 2024 11:50:15 +0200 Subject: [PATCH 21/21] reran gens --- eive_tmtc/config/events.csv | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eive_tmtc/config/events.csv b/eive_tmtc/config/events.csv index 34aa934..3c05a3c 100644 --- a/eive_tmtc/config/events.csv +++ b/eive_tmtc/config/events.csv @@ -79,6 +79,8 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 8901;0x22c5;CLOCK_DUMP_LEGACY;INFO;Clock dump event. P1: timeval seconds P2: timeval milliseconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h 8902;0x22c6;CLOCK_SET_FAILURE;LOW;Clock could not be set. P1: Returncode.;fsfw/src/fsfw/pus/Service9TimeManagement.h 8903;0x22c7;CLOCK_DUMP;INFO;Clock dump event. P1: timeval seconds P2: timeval microseconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h +8904;0x22c8;CLOCK_DUMP_BEFORE_SETTING_TIME;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h +8905;0x22c9;CLOCK_DUMP_AFTER_SETTING_TIME;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h 9100;0x238c;TC_DELETION_FAILED;MEDIUM;Deletion of a TC from the map failed. P1: First 32 bit of request ID, P2. Last 32 bit of Request ID;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h 9700;0x25e4;TEST;INFO;No description;fsfw/src/fsfw/pus/Service17Test.h 10600;0x2968;CHANGE_OF_SETUP_PARAMETER;LOW;No description;fsfw/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h @@ -234,8 +236,9 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 12902;0x3266;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;No description;mission/system/acs/SusAssembly.h 12903;0x3267;SIDE_SWITCH_TRANSITION_NOT_ALLOWED;LOW;Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination;mission/system/acs/SusAssembly.h 13000;0x32c8;CHILDREN_LOST_MODE;MEDIUM;No description;mission/system/tcs/TcsBoardAssembly.h -13100;0x332c;GPS_FIX_CHANGE;INFO;Fix has changed. P1: Old fix. P2: New fix 0: Not seen, 1: No Fix, 2: 2D-Fix, 3: 3D-Fix;mission/acs/archive/GPSDefinitions.h -13101;0x332d;CANT_GET_FIX;LOW;Could not get fix in maximum allowed time. P1: Maximum allowed time to get a fix after the GPS was switched on.;mission/acs/archive/GPSDefinitions.h +13100;0x332c;GPS_FIX_CHANGE;INFO;Fix has changed. P1: New fix. P2: Missed fix changes 0: Not seen, 1: No Fix, 2: 2D-Fix, 3: 3D-Fix;linux/acs/GPSDefinitions.h +13101;0x332d;CANT_GET_FIX;MEDIUM;Could not get fix in maximum allowed time. Trying to reset both GNSS devices. P1: Maximum allowed time to get a fix after the GPS was switched on.;linux/acs/GPSDefinitions.h +13102;0x332e;RESET_FAIL;HIGH;Failed to reset an GNNS Device. P1: Board-Side.;linux/acs/GPSDefinitions.h 13200;0x3390;P60_BOOT_COUNT;INFO;P60 boot count is broadcasted once at SW startup. P1: Boot count;mission/power/P60DockHandler.h 13201;0x3391;BATT_MODE;INFO;Battery mode is broadcasted at startup. P1: Mode;mission/power/P60DockHandler.h 13202;0x3392;BATT_MODE_CHANGED;MEDIUM;Battery mode has changed. P1: Old mode. P2: New mode;mission/power/P60DockHandler.h