Merge branch 'main' into set-health-cmd-payload
EIVE/-/pipeline/pr-main Build started... Details

This commit is contained in:
Robin Müller 2024-04-10 11:28:43 +02:00
commit 64dd19bd12
11 changed files with 70 additions and 38 deletions

View File

@ -12,12 +12,17 @@ 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
- EPS power commands working again.
## Changed
- Fixed PLOC commanding
# [v6.1.1] 2024-03-06
## Added

View File

@ -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

View File

@ -75,9 +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;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h
8902;0x22c6;CLOCK_SET_FAILURE;LOW;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

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
75 7902 0x1ede BIT_LOCK INFO A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0 fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
76 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
77 7905 0x1ee1 FRAME_PROCESSING_FAILED LOW The CCSDS Board could not interpret a TC fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
78 8900 0x22c4 CLOCK_SET INFO No description Clock has been set. P1: old timeval seconds. P2: new timeval seconds. fsfw/src/fsfw/pus/Service9TimeManagement.h
79 8901 0x22c5 CLOCK_DUMP CLOCK_DUMP_LEGACY INFO No description Clock dump event. P1: timeval seconds P2: timeval milliseconds. fsfw/src/fsfw/pus/Service9TimeManagement.h
80 8902 0x22c6 CLOCK_SET_FAILURE LOW No description Clock could not be set. P1: Returncode. fsfw/src/fsfw/pus/Service9TimeManagement.h
81 8903 0x22c7 CLOCK_DUMP INFO Clock dump event. P1: timeval seconds P2: timeval microseconds. fsfw/src/fsfw/pus/Service9TimeManagement.h
82 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
83 9700 0x25e4 TEST INFO No description fsfw/src/fsfw/pus/Service17Test.h
84 10600 0x2968 CHANGE_OF_SETUP_PARAMETER LOW No description fsfw/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h

View File

@ -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

View File

@ -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

View File

@ -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":
@ -263,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(

View File

@ -122,12 +122,18 @@ 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":
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
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":
sd_0_state = (event_def.param2 >> 16) & 0xFFFF
sd_1_state = event_def.param2 & 0xFFFF

View File

@ -1,4 +1,5 @@
"""HK Handling for EIVE OBSW"""
import dataclasses
import logging
import base64 # noqa

View File

@ -1,5 +1,6 @@
"""Core EIVE TM handler module
"""
import logging
import sqlite3
import uuid

View File

@ -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

View File

@ -1,6 +1,7 @@
import enum
import struct
import logging
from datetime import datetime
import datetime
from spacepackets.ecss import PusTelecommand, PusService
@ -8,28 +9,34 @@ 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_ascii = current_time.encode("ascii")
logging.getLogger(__name__).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(
@ -38,6 +45,17 @@ def pack_time_management_cmd(q: DefaultPusQueueHelper, cmd_str: str):
app_data=current_time_ascii,
)
)
elif cmd_str == CmdStr.RELATIVE_TIMESHIFT:
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,
)
)
elif cmd_str == CmdStr.DUMP_TIME:
q.add_log_cmd(Info.DUMP_TIME)
q.add_pus_tc(
@ -51,4 +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))
return time_node