Compare commits
68 Commits
Author | SHA1 | Date | |
---|---|---|---|
8aec6c48a0 | |||
cab0aa027a | |||
457ccf1ca0 | |||
fbb078784f | |||
f50aac689f | |||
66867ad9d2 | |||
e617faa4df | |||
fc5e3c88ff | |||
b474841d69 | |||
5e27a22a85 | |||
04f5a76962 | |||
5ed3cec20b | |||
c3c58b95ad | |||
5b309e4013 | |||
a39e94279b | |||
b9f58e0612 | |||
d9c202c68e | |||
28c367c6fb | |||
15adb9bf2e | |||
b4e4228040 | |||
26ebe9ab67 | |||
a680bf28f0 | |||
17486fdca7 | |||
c633893df4 | |||
bf16fa14ad | |||
d7c66e4ac3 | |||
2cb923314b | |||
ee38f83ec1 | |||
0399b478f3 | |||
4fa333977a | |||
e4ec0689b5 | |||
fa23e05971 | |||
bf06dd70f4 | |||
c8ea75b2ad | |||
6b657b5623 | |||
6c663b473c | |||
7b5df331ef | |||
c6478f05fd | |||
b95204ef9e | |||
f082f05886 | |||
28b3e4bec7 | |||
dbd2e5d9fc | |||
3eeb58182b | |||
48675efe3f | |||
b98fc2f56d | |||
3c20d2ea24 | |||
2793b354a6 | |||
72fee20d65 | |||
98af6a7907 | |||
a7f11b3159 | |||
98ba66dba2 | |||
28fda7cdbd | |||
619bd6b71b | |||
ece20bf177 | |||
63d7f577b1 | |||
6f783441be | |||
db70b4bd44 | |||
a4a4a6b666 | |||
f99a3ab74a | |||
a9c23a4453 | |||
407163397d | |||
65839f5aec | |||
14ed2415a4 | |||
fb6d5eeb80 | |||
39a9497494 | |||
f4702eb701 | |||
b7e6a79704 | |||
b8376c6f48 |
66
CHANGELOG.md
66
CHANGELOG.md
@ -10,6 +10,72 @@ list yields a list of all related PRs for each release.
|
||||
|
||||
# [unreleased]
|
||||
|
||||
# [v2.12.0] 2023-02-06
|
||||
|
||||
## Changed
|
||||
|
||||
- Updated the subsystem IDs to avoid value clashes with regular device handler mode IDs.
|
||||
|
||||
# [v2.11.0] 2023-02-06
|
||||
|
||||
## Fixed
|
||||
|
||||
- TMP1075 comands: Implement proper prompt for device select.
|
||||
- TMP1075 commands: Add OFF, ON, NORMAL, and HK command
|
||||
|
||||
# [v2.10.0] 2023-02-03
|
||||
|
||||
tmtccmd v4.0.0rc0
|
||||
|
||||
## Changed
|
||||
|
||||
- Updated ACS SS commands for OBSW ACS SS update.
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/130
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fixed parsing of processed GPS data
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/129
|
||||
|
||||
# [v2.9.0] 2023-02-01
|
||||
|
||||
## Fixed
|
||||
|
||||
- Create proper application root logger now.
|
||||
- Generated files update.
|
||||
|
||||
## Added
|
||||
|
||||
- Dedicated handling for health events.
|
||||
- Add time dump command.
|
||||
- Time event handling.
|
||||
|
||||
# [v2.8.0] 2023-02-01
|
||||
|
||||
- Move all device modules inside `pus_tc` and `pus_tm` to `tmtc` module and respective
|
||||
subsystem submodules.
|
||||
- Move low level ACS board device modules `gyros.py` and `mgms.py`
|
||||
to the `tmtc.acs` module.
|
||||
- Bump tmtccmd to include more pythonic log usage. All related changes.
|
||||
It is recommended to use `logging.getLogger(__name__)` for module level loggers now.
|
||||
- Moved TCS components to `tmtc` module
|
||||
- Renamed `HEATER_ID` to `HEATER_CONTROLLER_ID`
|
||||
|
||||
# [v2.7.0] 2023-01-31
|
||||
|
||||
- tmtccmd v4.0.0a3
|
||||
|
||||
# [v2.6.0 and v2.6.1] 2023-01-28
|
||||
|
||||
## Changed
|
||||
|
||||
- Reworked and improved PUS 20 parameter reply handling
|
||||
|
||||
## Added
|
||||
|
||||
- COM subsystem commanding. Default datarate parameter commanding
|
||||
was moved to the subsystem as well.
|
||||
|
||||
# [v2.5.0] 2023-01-26
|
||||
|
||||
## Fixed
|
||||
|
@ -1,11 +1,14 @@
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
SW_NAME = "eive-tmtc"
|
||||
VERSION_MAJOR = 2
|
||||
VERSION_MINOR = 5
|
||||
VERSION_MINOR = 12
|
||||
VERSION_REVISION = 0
|
||||
|
||||
__version__ = "2.5.0"
|
||||
__version__ = "2.12.0"
|
||||
|
||||
EIVE_TMTC_ROOT = Path(__file__).parent
|
||||
PACKAGE_ROOT = EIVE_TMTC_ROOT.parent
|
||||
|
||||
APP_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -17,8 +17,8 @@ CFDP_APID = 0x66
|
||||
PUS_PACKET_ID = PacketId(PacketType.TM, True, PUS_APID)
|
||||
CFDP_PACKET_ID = PacketId(PacketType.TM, False, CFDP_APID)
|
||||
SPACE_PACKET_IDS = (
|
||||
PUS_PACKET_ID.raw(),
|
||||
CFDP_PACKET_ID.raw(),
|
||||
PUS_PACKET_ID,
|
||||
CFDP_PACKET_ID,
|
||||
)
|
||||
|
||||
CFDP_LOCAL_ENTITY_ID = UnsignedByteField(byte_len=2, val=1)
|
||||
@ -29,15 +29,15 @@ class CustomServiceList(str, enum.Enum):
|
||||
value: str
|
||||
|
||||
TEST_DEVICE = "test"
|
||||
HEALTH = "health"
|
||||
P60DOCK = "p60dock"
|
||||
PDU1 = "pdu1"
|
||||
PDU2 = "pdu2"
|
||||
POWER = "power"
|
||||
ACU = "acu"
|
||||
ACS = "acs"
|
||||
COM_SS = "com"
|
||||
BPX_BATTERY = "bpx"
|
||||
TMP1075_1 = "tmp1075_1"
|
||||
TMP1075_2 = "tmp1075_2"
|
||||
HEATER = "heater"
|
||||
IMTQ = "imtq"
|
||||
PLOC_SUPV = "ploc_supv"
|
||||
@ -51,7 +51,7 @@ class CustomServiceList(str, enum.Enum):
|
||||
REACTION_WHEEL_4 = "rw_4"
|
||||
RW_ASSEMBLY = "rw_ass"
|
||||
RAD_SENSOR = "rad_sensor"
|
||||
GPS_CTRL = "gnss-ctrl"
|
||||
GPS_CTRL = "gps"
|
||||
PLOC_MEMORY_DUMPER = "ploc_memory_dumper"
|
||||
CORE = "core"
|
||||
STAR_TRACKER = "star_tracker"
|
||||
@ -69,6 +69,7 @@ class CustomServiceList(str, enum.Enum):
|
||||
TIME = "time"
|
||||
PROCEDURE = "proc"
|
||||
RTD = "rtd"
|
||||
TMP1075 = "tcs_tmp"
|
||||
TVTTESTPROCEDURE = "tvtestproc"
|
||||
CONTROLLERS = "controllers"
|
||||
SCEX = "scex"
|
||||
|
@ -76,14 +76,16 @@ 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;;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8901;0x22c5;CLOCK_SET_FAILURE;LOW;;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8901;0x22c5;CLOCK_DUMP;INFO;;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8902;0x22c6;CLOCK_SET_FAILURE;LOW;;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;;fsfw/src/fsfw/pus/Service17Test.h
|
||||
10600;0x2968;CHANGE_OF_SETUP_PARAMETER;LOW;;fsfw/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h
|
||||
10800;0x2a30;STORE_ERROR;LOW;;fsfw/src/fsfw/cfdp/handler/defs.h
|
||||
10801;0x2a31;MSG_QUEUE_ERROR;LOW;;fsfw/src/fsfw/cfdp/handler/defs.h
|
||||
10802;0x2a32;SERIALIZATION_ERROR;LOW;;fsfw/src/fsfw/cfdp/handler/defs.h
|
||||
11200;0x2bc0;SAFE_RATE_VIOLATION;MEDIUM;;mission/controller/AcsController.h
|
||||
11200;0x2bc0;SAFE_RATE_VIOLATION;MEDIUM;;mission/acsDefs.h
|
||||
11201;0x2bc1;SAFE_RATE_RECOVERY;MEDIUM;;mission/acsDefs.h
|
||||
11300;0x2c24;SWITCH_CMD_SENT;INFO;Indicates that a FSFW object requested setting a switch P1: 1 if on was requested, 0 for off | P2: Switch Index;mission/devices/devicedefinitions/powerDefinitions.h
|
||||
11301;0x2c25;SWITCH_HAS_CHANGED;INFO;Indicated that a switch state has changed P1: New switch state, 1 for on, 0 for off | P2: Switch Index;mission/devices/devicedefinitions/powerDefinitions.h
|
||||
11302;0x2c26;SWITCHING_Q7S_DENIED;MEDIUM;;mission/devices/devicedefinitions/powerDefinitions.h
|
||||
|
|
@ -1,11 +1,10 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
from eive_tmtc import EIVE_TMTC_ROOT
|
||||
from tmtccmd import get_console_logger
|
||||
from tmtccmd.fsfw import parse_fsfw_events_csv
|
||||
from tmtccmd.pus.s5_event import EventDictT
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
DEFAULT_EVENTS_CSV_PATH = EIVE_TMTC_ROOT / "config/events.csv"
|
||||
__EVENT_DICT = None
|
||||
|
||||
@ -16,6 +15,8 @@ def get_event_dict() -> EventDictT:
|
||||
if os.path.exists(DEFAULT_EVENTS_CSV_PATH):
|
||||
__EVENT_DICT = parse_fsfw_events_csv(DEFAULT_EVENTS_CSV_PATH)
|
||||
else:
|
||||
LOGGER.warning(f"No Event CSV file found at {DEFAULT_EVENTS_CSV_PATH}")
|
||||
logging.getLogger(__name__).warning(
|
||||
f"No Event CSV file found at {DEFAULT_EVENTS_CSV_PATH}"
|
||||
)
|
||||
__EVENT_DICT = dict()
|
||||
return __EVENT_DICT
|
||||
|
@ -1,8 +1,8 @@
|
||||
from typing import Optional
|
||||
|
||||
from eive_tmtc.config.definitions import SPACE_PACKET_IDS
|
||||
from tmtccmd import TmTcCfgHookBase, CcsdsTmtcBackend
|
||||
from tmtccmd.com_if import ComInterface
|
||||
from tmtccmd import HookBase, CcsdsTmtcBackend
|
||||
from tmtccmd.com import ComInterface
|
||||
from tmtccmd.config import TmtcDefinitionWrapper
|
||||
|
||||
from eive_tmtc.config.retvals import get_retval_dict
|
||||
@ -10,7 +10,7 @@ from eive_tmtc.pus_tc.cmd_definitions import get_eive_service_op_code_dict
|
||||
from tmtccmd.util import ObjectIdDictT, RetvalDictT
|
||||
|
||||
|
||||
class EiveHookObject(TmTcCfgHookBase):
|
||||
class EiveHookObject(HookBase):
|
||||
def __init__(self, json_cfg_path: str):
|
||||
super().__init__(json_cfg_path=json_cfg_path)
|
||||
|
||||
@ -18,7 +18,7 @@ class EiveHookObject(TmTcCfgHookBase):
|
||||
return get_eive_service_op_code_dict()
|
||||
|
||||
def assign_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
|
||||
from tmtccmd.config.com_if import (
|
||||
from tmtccmd.config.com import (
|
||||
create_com_interface_default,
|
||||
create_com_interface_cfg_default,
|
||||
)
|
||||
|
@ -3,15 +3,15 @@
|
||||
@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
|
||||
|
||||
from eive_tmtc import EIVE_TMTC_ROOT
|
||||
from tmtccmd.util.obj_id import ObjectIdDictT
|
||||
from tmtccmd.util.obj_id import ObjectIdDictT, ObjectIdU32
|
||||
from tmtccmd.fsfw import parse_fsfw_objects_csv
|
||||
from tmtccmd.logging import get_console_logger
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
DEFAULT_OBJECTS_CSV_PATH = EIVE_TMTC_ROOT / "config/objects.csv"
|
||||
__OBJECT_ID_DICT = None
|
||||
|
||||
@ -30,9 +30,11 @@ SCEX_HANDLER_ID = bytes([0x44, 0x33, 0x00, 0x32])
|
||||
|
||||
# Thermal Object IDs
|
||||
THERMAL_CONTROLLER_ID = bytes([0x43, 0x40, 0x00, 0x01])
|
||||
HEATER_ID = bytes([0x44, 0x41, 0x00, 0xA4])
|
||||
TMP_1075_1_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x04])
|
||||
TMP_1075_2_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x05])
|
||||
HEATER_CONTROLLER_ID = bytes([0x44, 0x41, 0x00, 0xA4])
|
||||
TMP1075_HANDLER_TCS_BRD_0_ID = bytes([0x44, 0x42, 0x00, 0x04])
|
||||
TMP1075_HANDLER_TCS_BRD_1_ID = bytes([0x44, 0x42, 0x00, 0x05])
|
||||
TMP1075_HANDLER_PLPCDU_0_ID = bytes([0x44, 0x42, 0x00, 0x06])
|
||||
TMP1075_HANDLER_IF_BRD_ID = bytes([0x44, 0x42, 0x00, 0x08])
|
||||
|
||||
# Communication Object IDs
|
||||
SYRLINKS_HANDLER_ID = bytes([0x44, 0x53, 0x00, 0xA3])
|
||||
@ -127,6 +129,8 @@ SUS_11_R_LOC_XBYMZB_PT_ZB = bytes([0x44, 0x12, 0x00, 0x43])
|
||||
ACS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x01])
|
||||
PL_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x02])
|
||||
TCS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x03])
|
||||
COM_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x04])
|
||||
|
||||
ACS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x01])
|
||||
SUS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x02])
|
||||
TCS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x03])
|
||||
@ -138,10 +142,15 @@ ACS_CONTROLLER = bytes([0x43, 0x00, 0x00, 0x02])
|
||||
CORE_CONTROLLER_ID = bytes([0x43, 0x00, 0x00, 0x03])
|
||||
|
||||
|
||||
def get_object_ids() -> ObjectIdDictT:
|
||||
ObjectIdDict = Dict[bytes, ObjectIdU32]
|
||||
|
||||
|
||||
def get_object_ids() -> ObjectIdDict:
|
||||
global __OBJECT_ID_DICT
|
||||
if not os.path.exists(DEFAULT_OBJECTS_CSV_PATH):
|
||||
LOGGER.warning(f"No Objects CSV file found at {DEFAULT_OBJECTS_CSV_PATH}")
|
||||
logging.getLogger(__name__).warning(
|
||||
f"No Objects CSV file found at {DEFAULT_OBJECTS_CSV_PATH}"
|
||||
)
|
||||
if __OBJECT_ID_DICT is None:
|
||||
if os.path.exists(DEFAULT_OBJECTS_CSV_PATH):
|
||||
__OBJECT_ID_DICT = parse_fsfw_objects_csv(csv_file=DEFAULT_OBJECTS_CSV_PATH)
|
||||
|
@ -72,7 +72,7 @@
|
||||
0x44420029;RTD_13_IC16_PLPCDU_HEATSPREADER
|
||||
0x44420030;RTD_14_IC17_TCS_BOARD
|
||||
0x44420031;RTD_15_IC18_IMTQ
|
||||
0x445300A3;SYRLINKS_HK_HANDLER
|
||||
0x445300A3;SYRLINKS_HANDLER
|
||||
0x49000000;ARDUINO_COM_IF
|
||||
0x49010005;GPIO_IF
|
||||
0x49010006;SCEX_UART_READER
|
||||
@ -147,5 +147,6 @@
|
||||
0x73010001;ACS_SUBSYSTEM
|
||||
0x73010002;PL_SUBSYSTEM
|
||||
0x73010003;TCS_SUBSYSTEM
|
||||
0x73010004;COM_SUBSYSTEM
|
||||
0x73500000;CCSDS_IP_CORE_BRIDGE
|
||||
0xFFFFFFFF;NO_OBJECT
|
||||
|
|
@ -1,12 +1,11 @@
|
||||
import os
|
||||
import logging
|
||||
|
||||
from eive_tmtc import EIVE_TMTC_ROOT
|
||||
from tmtccmd.fsfw import parse_fsfw_returnvalues_csv, RetvalDictT
|
||||
from tmtccmd.logging import get_console_logger
|
||||
|
||||
DEFAULT_RETVAL_CSV_NAME = EIVE_TMTC_ROOT / "config/returnvalues.csv"
|
||||
__RETVAL_DICT = None
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
def get_retval_dict() -> RetvalDictT:
|
||||
@ -17,7 +16,7 @@ def get_retval_dict() -> RetvalDictT:
|
||||
csv_file=DEFAULT_RETVAL_CSV_NAME
|
||||
)
|
||||
else:
|
||||
LOGGER.warning(
|
||||
logging.getLogger(__name__).warning(
|
||||
f"No Return Value CSV file found at {DEFAULT_RETVAL_CSV_NAME}"
|
||||
)
|
||||
__RETVAL_DICT = dict()
|
||||
|
@ -23,14 +23,6 @@ def get_eive_service_op_code_dict() -> TmtcDefinitionWrapper:
|
||||
return def_wrapper
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_tmp_sens_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add("0", "TMP1075 Tests")
|
||||
defs.add_service(CustomServiceList.TMP1075_1.value, "TMP1075 1", oce)
|
||||
defs.add_service(CustomServiceList.TMP1075_2.value, "TMP1075 2", oce)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_pdec_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
@ -104,22 +96,6 @@ def add_str_cmds(defs: TmtcDefinitionWrapper):
|
||||
defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_time_cmds(defs: TmtcDefinitionWrapper):
|
||||
from eive_tmtc.pus_tc.system.time import OpCode, Info
|
||||
|
||||
oce = OpCodeEntry()
|
||||
oce.add(
|
||||
keys=OpCode.SET_CURRENT_TIME,
|
||||
info=Info.SET_CURRENT_TIME,
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.TIME.value,
|
||||
info="Time Service",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_system_cmds(defs: TmtcDefinitionWrapper):
|
||||
import eive_tmtc.pus_tc.system.controllers as controllers
|
||||
|
@ -1 +0,0 @@
|
||||
|
@ -1,48 +0,0 @@
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
||||
from tmtccmd.logging import get_console_logger
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class OpCode:
|
||||
REQ_OS_HK = ["0", "hk-os"]
|
||||
RESET_GNSS = ["5", "reset"]
|
||||
|
||||
|
||||
class Info:
|
||||
REQ_OS_HK = "Request One-Shot HK"
|
||||
RESET_GNSS = "Reset GNSS using reset pin"
|
||||
|
||||
|
||||
class SetId:
|
||||
HK = 0
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_gps_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCode.RESET_GNSS, info=Info.RESET_GNSS)
|
||||
oce.add(keys=OpCode.REQ_OS_HK, info=Info.REQ_OS_HK)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.GPS_CTRL.value,
|
||||
info="GPS/GNSS Controller",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
||||
|
||||
def pack_gps_command(object_id: bytes, q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCode.RESET_GNSS:
|
||||
# TODO: This needs to be re-implemented
|
||||
LOGGER.warning("Reset pin handling needs to be re-implemented")
|
||||
if op_code in OpCode.REQ_OS_HK:
|
||||
q.add_log_cmd(f"GMSS: {Info.REQ_OS_HK}")
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(sid=make_sid(object_id=object_id, set_id=SetId.HK))
|
||||
)
|
@ -1,10 +0,0 @@
|
||||
import enum
|
||||
|
||||
|
||||
class AdisGyroSetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
CFG_HK = 1
|
||||
|
||||
|
||||
class L3gGyroSetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
@ -1,9 +0,0 @@
|
||||
import enum
|
||||
|
||||
|
||||
class MgmLis3SetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
|
||||
|
||||
class MgmRm3100SetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
@ -1,2 +0,0 @@
|
||||
class SetId:
|
||||
HK = 3
|
@ -1,65 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file tmp1075.py
|
||||
@brief TMP1075 tests
|
||||
@author J. Meier
|
||||
@date 06.01.2021
|
||||
"""
|
||||
import enum
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from eive_tmtc.pus_tc.service_200_mode import pack_mode_data
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Mode
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import make_action_id
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class Tmp1075TestProcedure:
|
||||
"""
|
||||
@brief Use this class to define the tests to perform for the Tmp1075.
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
|
||||
all = False
|
||||
start_adc_conversion = False
|
||||
get_temp = False
|
||||
set_mode_normal = (
|
||||
True # Setting mode to normal starts continuous temperature reading
|
||||
)
|
||||
set_mode_on = False # If mode is MODE_ON, temperature will only be read on command
|
||||
|
||||
|
||||
class Tmp1075ActionId(enum.IntEnum):
|
||||
GET_TEMP = 1
|
||||
START_ADC_CONV = 2
|
||||
|
||||
|
||||
def pack_tmp1075_test_into(
|
||||
object_id: ObjectIdU32, op_code: str, q: DefaultPusQueueHelper
|
||||
):
|
||||
q.add_log_cmd(
|
||||
f"Testing Tmp1075 Temperature Sensor Handler with object id: {object_id.as_hex_string}"
|
||||
)
|
||||
obyt = object_id.as_bytes
|
||||
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.start_adc_conversion:
|
||||
q.add_log_cmd("TMP1075: Starting new temperature conversion")
|
||||
command = obyt + make_action_id(Tmp1075ActionId.GET_TEMP)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.get_temp:
|
||||
q.add_log_cmd("TMP1075: Read temperature")
|
||||
command = obyt + make_action_id(Tmp1075ActionId.START_ADC_CONV)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
if Tmp1075TestProcedure.set_mode_normal:
|
||||
q.add_log_cmd("TMP1075: Set Mode Normal")
|
||||
mode_data = pack_mode_data(obyt, Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
if Tmp1075TestProcedure.set_mode_on:
|
||||
q.add_log_cmd("TMP1075: Set Mode On")
|
||||
mode_data = pack_mode_data(obyt, Mode.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
return q
|
@ -1,18 +1,18 @@
|
||||
"""Hook function which packs telecommands based on service and operation code string
|
||||
"""
|
||||
import logging
|
||||
from typing import cast
|
||||
|
||||
from eive_tmtc.tmtc.power.power import pack_power_commands
|
||||
from eive_tmtc.pus_tc.devs.rtd import pack_rtd_commands
|
||||
from eive_tmtc.pus_tc.devs.scex import pack_scex_cmds
|
||||
from eive_tmtc.tmtc.tcs.rtd import pack_rtd_commands
|
||||
from eive_tmtc.tmtc.payload.scex import pack_scex_cmds
|
||||
from eive_tmtc.pus_tc.system.controllers import (
|
||||
pack_cmd_ctrl_to_prompted_mode,
|
||||
get_object_from_op_code,
|
||||
)
|
||||
from eive_tmtc.tmtc.tcs import pack_tcs_sys_commands
|
||||
from eive_tmtc.tmtc.tcs.subsystem import pack_tcs_sys_commands
|
||||
from tmtccmd import DefaultProcedureInfo, TcHandlerBase
|
||||
from tmtccmd.config import CoreServiceList
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.decorator import (
|
||||
route_to_registered_service_handlers,
|
||||
@ -22,38 +22,34 @@ from tmtccmd.tc.pus_5_event import (
|
||||
pack_generic_service_5_test_into,
|
||||
)
|
||||
|
||||
from eive_tmtc.pus_tc.service_200_mode import pack_service_200_test_into
|
||||
from eive_tmtc.tmtc.misc.s200_test import pack_service_200_test_into
|
||||
from eive_tmtc.tmtc.power.p60dock import pack_p60dock_cmds
|
||||
from eive_tmtc.tmtc.power.pdu2 import pack_pdu2_commands
|
||||
from eive_tmtc.tmtc.power.pdu1 import pack_pdu1_commands
|
||||
from eive_tmtc.tmtc.power.acu import pack_acu_commands
|
||||
from eive_tmtc.tmtc.acs.imtq import pack_imtq_test_into
|
||||
from eive_tmtc.pus_tc.devs.tmp1075 import pack_tmp1075_test_into
|
||||
from eive_tmtc.pus_tc.devs.heater import pack_heater_cmds
|
||||
from eive_tmtc.tmtc.tcs.heater import pack_heater_cmds
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import (
|
||||
pack_single_rw_test_into,
|
||||
pack_rw_ass_cmds,
|
||||
)
|
||||
from eive_tmtc.pus_tc.devs.rad_sensor import pack_rad_sensor_test_into
|
||||
from eive_tmtc.tmtc.payload.ploc_memory_dumper import pack_ploc_memory_dumper_cmd
|
||||
from eive_tmtc.tmtc.com.ccsds_handler import pack_ccsds_handler_test
|
||||
from eive_tmtc.tmtc.core import pack_core_commands
|
||||
from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import pack_syrlinks_command
|
||||
from eive_tmtc.pus_tc.devs.gps import pack_gps_command
|
||||
from eive_tmtc.tmtc.acs.acs_board import pack_acs_command
|
||||
from eive_tmtc.pus_tc.devs.plpcdu import pack_pl_pcdu_commands
|
||||
from eive_tmtc.pus_tc.devs.str_img_helper import pack_str_img_helper_command
|
||||
from eive_tmtc.pus_tc.system.proc import pack_proc_commands
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import (
|
||||
P60_DOCK_HANDLER,
|
||||
PDU_1_HANDLER_ID,
|
||||
PDU_2_HANDLER_ID,
|
||||
ACU_HANDLER_ID,
|
||||
TMP_1075_1_HANDLER_ID,
|
||||
TMP_1075_2_HANDLER_ID,
|
||||
HEATER_ID,
|
||||
TMP1075_HANDLER_TCS_BRD_0_ID,
|
||||
TMP1075_HANDLER_TCS_BRD_1_ID,
|
||||
TMP1075_HANDLER_PLPCDU_0_ID,
|
||||
TMP1075_HANDLER_IF_BRD_ID,
|
||||
HEATER_CONTROLLER_ID,
|
||||
IMTQ_HANDLER_ID,
|
||||
RW1_ID,
|
||||
RW2_ID,
|
||||
@ -69,10 +65,18 @@ from eive_tmtc.config.object_ids import (
|
||||
RW_ASSEMBLY,
|
||||
get_object_ids,
|
||||
)
|
||||
|
||||
from eive_tmtc.tmtc.tcs.tmp1075 import pack_tmp1075_test_into
|
||||
from eive_tmtc.tmtc.acs.gps import pack_gps_command
|
||||
from eive_tmtc.tmtc.payload.rad_sensor import pack_rad_sensor_test_into
|
||||
from eive_tmtc.tmtc.power.plpcdu import pack_pl_pcdu_commands
|
||||
from eive_tmtc.tmtc.acs.str_img_helper import pack_str_img_helper_command
|
||||
from eive_tmtc.pus_tc.system.proc import pack_proc_commands
|
||||
|
||||
import eive_tmtc.config.object_ids as oids
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
|
||||
|
||||
def handle_default_procedure(
|
||||
@ -103,18 +107,21 @@ def handle_default_procedure(
|
||||
return pack_acu_commands(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.TCS.value:
|
||||
return pack_tcs_sys_commands(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.TMP1075_1.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(TMP_1075_1_HANDLER_ID))
|
||||
return pack_tmp1075_test_into(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.TMP1075_2.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(TMP_1075_2_HANDLER_ID))
|
||||
if service == CustomServiceList.TMP1075.value:
|
||||
menu_dict = {
|
||||
"0": ("TMP1075 TCS Board 0", TMP1075_HANDLER_TCS_BRD_0_ID),
|
||||
"1": ("TMP1075 TCS Board 1", TMP1075_HANDLER_TCS_BRD_1_ID),
|
||||
"2": ("TMP1075 PL PCDU 0", TMP1075_HANDLER_PLPCDU_0_ID),
|
||||
"4": ("TMP1075 IF Board", TMP1075_HANDLER_IF_BRD_ID),
|
||||
}
|
||||
input_helper = InputHelper(menu_dict)
|
||||
tmp_select = input_helper.get_key()
|
||||
object_id = obj_id_man.get(menu_dict[tmp_select][1])
|
||||
return pack_tmp1075_test_into(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.HEATER.value:
|
||||
object_id = HEATER_ID
|
||||
object_id = HEATER_CONTROLLER_ID
|
||||
return pack_heater_cmds(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.IMTQ.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(IMTQ_HANDLER_ID))
|
||||
@ -214,4 +221,4 @@ def handle_default_procedure(
|
||||
queue_helper=queue_helper,
|
||||
),
|
||||
):
|
||||
LOGGER.warning(f"Invalid Service {service}")
|
||||
logging.getLogger(__name__).warning(f"Invalid Service {service}")
|
||||
|
@ -1,7 +1,7 @@
|
||||
from typing import Union
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Mode
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
from tmtccmd.util import ObjectIdU32, ObjectIdBase
|
||||
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
|
@ -17,19 +17,12 @@ from tmtccmd.pus.s11_tc_sched import (
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import *
|
||||
|
||||
import eive_tmtc.config.object_ids as oids
|
||||
from eive_tmtc.tmtc.tcs import OpCodeAssy as TcsOpCodes, pack_tcs_sys_commands
|
||||
from eive_tmtc.pus_tc.devs.bpx_batt import BpxSetId
|
||||
from eive_tmtc.tmtc.tcs.brd_assy import OpCodeAssy as TcsOpCodes
|
||||
from eive_tmtc.tmtc.tcs.subsystem import pack_tcs_sys_commands
|
||||
from eive_tmtc.tmtc.core import SetId as CoreSetIds
|
||||
from eive_tmtc.tmtc.power.common_power import SetId as GsSetIds
|
||||
from eive_tmtc.pus_tc.devs.rad_sensor import SetId as RadSetIds
|
||||
from eive_tmtc.pus_tc.devs.mgms import MgmLis3SetId as MgmLis3SetIds_0_2
|
||||
from eive_tmtc.pus_tc.devs.mgms import MgmRm3100SetId as MgmRm3100SetIds_1_3
|
||||
from eive_tmtc.pus_tc.devs.gyros import AdisGyroSetId as AdisGyroSetIds_0_2
|
||||
from eive_tmtc.pus_tc.devs.gyros import L3gGyroSetId as L3gGyroSetIds_1_3
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import SetId as SyrlinksSetIds
|
||||
from eive_tmtc.pus_tc.devs.gps import SetId as GpsSetIds
|
||||
from eive_tmtc.tmtc.acs.imtq import ImtqSetId
|
||||
from eive_tmtc.pus_tc.devs.sus import SetId
|
||||
from eive_tmtc.tmtc.acs.star_tracker import SetId as StrSetIds
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import (
|
||||
RwSetId,
|
||||
@ -46,6 +39,17 @@ from eive_tmtc.tmtc.acs.imtq import pack_imtq_test_into, pack_dipole_command
|
||||
from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import pack_rw_ass_cmds, pack_set_speed_command
|
||||
|
||||
from eive_tmtc.tmtc.acs.sus import SetId
|
||||
from eive_tmtc.tmtc.power.bpx_batt import BpxSetId
|
||||
from eive_tmtc.tmtc.payload.rad_sensor import SetId as RadSetIds
|
||||
from eive_tmtc.tmtc.acs.mgms import MgmLis3SetId as MgmLis3SetIds_0_2
|
||||
from eive_tmtc.tmtc.acs.mgms import MgmRm3100SetId as MgmRm3100SetIds_1_3
|
||||
from eive_tmtc.tmtc.acs.gyros import (
|
||||
AdisGyroSetId as AdisGyroSetIds_0_2,
|
||||
L3gGyroSetId as L3gGyroSetIds_1_3,
|
||||
)
|
||||
from eive_tmtc.tmtc.acs.gps import SetId as GpsSetIds
|
||||
|
||||
|
||||
class OpCode:
|
||||
"""FT: Functional Test"""
|
||||
|
@ -1,29 +0,0 @@
|
||||
from datetime import datetime
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd import DefaultProcedureInfo, TcHandlerBase
|
||||
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.tc import DefaultPusQueueHelper, service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class OpCode:
|
||||
SET_CURRENT_TIME = ["0", "set-curr-time"]
|
||||
|
||||
|
||||
class Info:
|
||||
SET_CURRENT_TIME = "Setting current time in ASCII format"
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.TIME.value)
|
||||
def pack_set_current_time_ascii_command(p: ServiceProviderParams):
|
||||
q = p.queue_helper
|
||||
time_test_current_time = datetime.utcnow().isoformat() + "Z" + "\0"
|
||||
current_time_ascii = time_test_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(service=9, subservice=128, app_data=current_time_ascii))
|
@ -6,12 +6,11 @@ from eive_tmtc.tmtc.payload.ploc_mpsoc import PlocReplyIds
|
||||
from eive_tmtc.tmtc.payload.ploc_supervisor import SupvActionId
|
||||
from eive_tmtc.tmtc.acs.star_tracker import StarTrackerActionId
|
||||
from eive_tmtc.tmtc.power.tm import handle_get_param_data_reply
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.tm import Service8FsfwTm
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_action_reply(
|
||||
@ -123,7 +122,7 @@ def handle_startracker_replies(
|
||||
):
|
||||
if action_id == StarTrackerActionId.CHECKSUM:
|
||||
if len(custom_data) != 5:
|
||||
LOGGER.warning(
|
||||
_LOGGER.warning(
|
||||
"Star tracker reply has invalid length {0}".format(len(custom_data))
|
||||
)
|
||||
return
|
||||
|
@ -1,3 +1,5 @@
|
||||
import logging
|
||||
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
@ -9,6 +11,10 @@ class PrintWrapper:
|
||||
print(string)
|
||||
self.printer.file_logger.info(string)
|
||||
|
||||
def ilog(self, logger: logging.Logger, string: str):
|
||||
logger.info(string)
|
||||
self.printer.file_logger.info(string)
|
||||
|
||||
|
||||
def log_to_both(printer: FsfwTmTcPrinter, string: str):
|
||||
print(string)
|
||||
|
@ -1,68 +0,0 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tc.devs.bpx_batt import BpxSetId
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
HEADER_LIST = [
|
||||
"Charge Current",
|
||||
"Discharge Current",
|
||||
"Heater Current",
|
||||
"Battery Voltage",
|
||||
"Batt Temp 1",
|
||||
"Batt Temp 2",
|
||||
"Batt Temp 3",
|
||||
"Batt Temp 4",
|
||||
"Reboot Counter",
|
||||
"Boot Cause",
|
||||
]
|
||||
|
||||
|
||||
def handle_bpx_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
if set_id == BpxSetId.GET_HK_SET:
|
||||
fmt_str = "!HHHHhhhhIB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
charge_current,
|
||||
discharge_current,
|
||||
heater_current,
|
||||
batt_voltage,
|
||||
batt_temp_1,
|
||||
batt_temp_2,
|
||||
batt_temp_3,
|
||||
batt_temp_4,
|
||||
reboot_cntr,
|
||||
boot_cause,
|
||||
) = struct.unpack(fmt_str, hk_data[0:inc_len])
|
||||
content_list = [
|
||||
charge_current,
|
||||
discharge_current,
|
||||
heater_current,
|
||||
batt_voltage,
|
||||
batt_temp_1,
|
||||
batt_temp_2,
|
||||
batt_temp_3,
|
||||
batt_temp_4,
|
||||
reboot_cntr,
|
||||
boot_cause,
|
||||
]
|
||||
validity_buffer = hk_data[inc_len:]
|
||||
pw.dlog(str(HEADER_LIST))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=10)
|
||||
elif set_id == BpxSetId.GET_CFG_SET:
|
||||
battheat_mode = hk_data[0]
|
||||
battheat_low = struct.unpack("!b", hk_data[1:2])[0]
|
||||
battheat_high = struct.unpack("!b", hk_data[2:3])[0]
|
||||
header_list = [
|
||||
"Battery Heater Mode",
|
||||
"Battery Heater Low Limit",
|
||||
"Battery Heater High Limit",
|
||||
]
|
||||
content_list = [battheat_mode, battheat_low, battheat_high]
|
||||
validity_buffer = hk_data[3:]
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=10)
|
@ -1,39 +0,0 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
def handle_gps_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Received GPS data, HK data length {len(hk_data)}")
|
||||
current_idx = 0
|
||||
fmt_str = "!ddddBBBHBBBBBI"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
lat,
|
||||
long,
|
||||
alt,
|
||||
speed,
|
||||
fix,
|
||||
sats_in_use,
|
||||
sats_in_view,
|
||||
year,
|
||||
month,
|
||||
day,
|
||||
hours,
|
||||
minutes,
|
||||
seconds,
|
||||
unix_seconds,
|
||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
current_idx += inc_len
|
||||
date_string = f"{day}.{month}.{year} {hours}:{minutes}:{seconds}"
|
||||
pw.dlog(f"Lat: {lat} deg")
|
||||
pw.dlog(f"Long: {long} deg")
|
||||
pw.dlog(f"Altitude: {alt} m | Speed: {speed} m/s")
|
||||
pw.dlog(
|
||||
f"Fix Type: {fix} | Sats in View {sats_in_view} | Sats in Use {sats_in_use}"
|
||||
)
|
||||
pw.dlog(f"GNSS Date: {date_string}")
|
||||
pw.dlog(f"Unix seconds {unix_seconds}")
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=14)
|
@ -1,52 +0,0 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from eive_tmtc.pus_tc.devs.plpcdu import SetId
|
||||
|
||||
|
||||
ADC_CHANNELS_NAMED = [
|
||||
"U BAT DIV 6",
|
||||
"U NEG V FB",
|
||||
"I HPA",
|
||||
"U HPA DIV 6",
|
||||
"I MPA",
|
||||
"U MPA DIV 6",
|
||||
"I TX",
|
||||
"U TX DIV 6",
|
||||
"I X8",
|
||||
"U X8 DIV 6",
|
||||
"I DRO",
|
||||
"U DRO DIV 6",
|
||||
]
|
||||
|
||||
|
||||
def handle_plpcdu_hk(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
if set_id == SetId.ADC:
|
||||
pw = PrintWrapper(printer)
|
||||
current_idx = 0
|
||||
pw.dlog("Received PL PCDU ADC HK data")
|
||||
channels = []
|
||||
ch_print = "Channels Raw (hex): ["
|
||||
for i in range(12):
|
||||
channels.append(
|
||||
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
||||
)
|
||||
if i < 11:
|
||||
ch_print += f"{channels[i]:06x},"
|
||||
else:
|
||||
ch_print += f"{channels[i]:06x}]"
|
||||
current_idx += 2
|
||||
processed_vals = []
|
||||
for i in range(12):
|
||||
processed_vals.append(
|
||||
struct.unpack("!f", hk_data[current_idx : current_idx + 4])[0]
|
||||
)
|
||||
current_idx += 4
|
||||
temp = struct.unpack("!f", hk_data[current_idx : current_idx + 4])[0]
|
||||
current_idx += 4
|
||||
pw.dlog(f"Temperature: {temp} C")
|
||||
pw.dlog(ch_print)
|
||||
for i in range(12):
|
||||
pw.dlog(f"{ADC_CHANNELS_NAMED[i].ljust(24)} | {processed_vals[i]}")
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=3)
|
@ -1,24 +0,0 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from eive_tmtc.pus_tc.devs.rad_sensor import SetId
|
||||
|
||||
|
||||
def handle_rad_sensor_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
if set_id == SetId.HK:
|
||||
pw = PrintWrapper(printer)
|
||||
current_idx = 0
|
||||
pw.dlog("Received Radiation Sensor HK data")
|
||||
fmt_str = "!fHHHHHH"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(temp, ain0, ain1, ain4, ain5, ain6, ain7) = struct.unpack(
|
||||
fmt_str, hk_data[current_idx : current_idx + inc_len]
|
||||
)
|
||||
ain_dict = {0: ain0, 1: ain1, 4: ain4, 5: ain5, 6: ain6, 7: ain7}
|
||||
pw.dlog(f"Temperature: {temp} C")
|
||||
pw.dlog(f"AIN Channel | Raw Value (hex) | Raw Value (dec)")
|
||||
for idx, val in ain_dict.items():
|
||||
pw.dlog(f"{idx} | {val:#06x} | {str(val).ljust(5)}")
|
||||
current_idx += inc_len
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)
|
@ -1,88 +1,99 @@
|
||||
from datetime import datetime
|
||||
import logging
|
||||
import datetime
|
||||
|
||||
from eive_tmtc.config.events import get_event_dict
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.pus_tm.verification_handler import generic_retval_printout
|
||||
from eive_tmtc.tmtc.acs.acs_subsystem import AcsMode
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Mode
|
||||
from eive_tmtc.tmtc.acs.subsystem import AcsMode
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
from tmtccmd.tc.pus_201_fsfw_health import FsfwHealth
|
||||
|
||||
from tmtccmd.tm import Service5Tm
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.fsfw import EventInfo
|
||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
||||
pw = PrintWrapper(printer)
|
||||
tm = Service5Tm.unpack(raw_telemetry=raw_tm, time_reader=CdsShortTimestamp.empty())
|
||||
tm = Service5Tm.unpack(data=raw_tm, time_reader=CdsShortTimestamp.empty())
|
||||
event_dict = get_event_dict()
|
||||
info = event_dict.get(tm.event_id)
|
||||
event_def = tm.event_definition
|
||||
info = event_dict.get(event_def.event_id)
|
||||
if info is None:
|
||||
LOGGER.warning(f"Event ID {tm.event_id} has no information")
|
||||
_LOGGER.warning(f"Event ID {event_def.event_id} has no information")
|
||||
info = EventInfo()
|
||||
info.name = "Unknown event"
|
||||
obj_ids = get_object_ids()
|
||||
obj_id_obj = obj_ids.get(tm.reporter_id.as_bytes)
|
||||
obj_id_obj = obj_ids.get(event_def.reporter_id)
|
||||
if obj_id_obj is None:
|
||||
LOGGER.warning(f"Object ID 0x{tm.reporter_id.as_hex_string} has no name")
|
||||
obj_name = tm.reporter_id.as_hex_string
|
||||
_LOGGER.warning(f"Object ID 0x{event_def.reporter_id.hex(sep=',')} has no name")
|
||||
obj_name = event_def.reporter_id.hex(sep=",")
|
||||
else:
|
||||
obj_name = obj_id_obj.name
|
||||
generic_event_string = (
|
||||
f"Object {obj_name} generated Event {tm.event_id} | {info.name}"
|
||||
)
|
||||
generic_event_string = f"Object {obj_name} generated Event {info.name} (ID: {event_def.event_id:#04x}) at {tm.time_provider.as_date_time()}"
|
||||
_LOGGER.info(generic_event_string)
|
||||
pw.printer.file_logger.info(
|
||||
f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}: {generic_event_string}"
|
||||
f"{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}: {generic_event_string}"
|
||||
)
|
||||
LOGGER.info(generic_event_string)
|
||||
specific_handler = True
|
||||
if info.name == "MODE_TRANSITION_FAILED":
|
||||
reason = generic_retval_printout(tm.param_1)
|
||||
reason = generic_retval_printout(event_def.param1)
|
||||
for string in reason:
|
||||
pw.dlog(f"Reason from event parameter 1: {string}")
|
||||
pw.dlog(f"Mode, sequence or table: {tm.param_2:#08x}")
|
||||
pw.dlog(f"Mode, sequence or table: {event_def.param2:#08x}")
|
||||
if info.name == "SUPV_UPDATE_PROGRESS" or info.name == "WRITE_MEMORY_FAILED":
|
||||
additional_event_info = f"Additional info: {info.info}"
|
||||
context = (
|
||||
f"Progress Percent: {tm.param_1 >> 24 & 0xff} | Sequence Count: {tm.param_1 & 0xffff} "
|
||||
f"| Bytes Written: {tm.param_2}"
|
||||
f"Progress Percent: {event_def.param1 >> 24 & 0xff} | Sequence Count: {event_def.param1 & 0xffff} "
|
||||
f"| Bytes Written: {event_def.param2}"
|
||||
)
|
||||
pw.dlog(additional_event_info)
|
||||
pw.dlog(context)
|
||||
if info.name == "MODE_INFO":
|
||||
mode_name = "Unknown"
|
||||
if obj_name == "ACS_SUBSYSTEM":
|
||||
if tm.param_1 == Mode.OFF:
|
||||
mode_name = "Off"
|
||||
elif tm.param_1 == AcsMode.IDLE:
|
||||
mode_name = "Idle"
|
||||
elif tm.param_1 == AcsMode.DETUMBLE:
|
||||
mode_name = "Detumble"
|
||||
elif tm.param_1 == AcsMode.SAFE:
|
||||
mode_name = "Safe"
|
||||
elif tm.param_1 == AcsMode.TARGET_PT:
|
||||
mode_name = "Target Pointing"
|
||||
acs_mode = AcsMode(event_def.param1)
|
||||
pw.dlog(f"ACS Mode: {acs_mode!r}")
|
||||
elif obj_name == "ACS_CONTROLLER_ID":
|
||||
mode_name = Mode(event_def.param1)
|
||||
submode = AcsMode(event_def.param2)
|
||||
pw.dlog(f"Mode: {mode_name!r}")
|
||||
pw.dlog(f"ACS Mode: {submode!r}")
|
||||
else:
|
||||
if tm.param_1 == Mode.OFF:
|
||||
if event_def.param1 == Mode.OFF:
|
||||
mode_name = "Off"
|
||||
elif tm.param_1 == Mode.ON:
|
||||
elif event_def.param1 == Mode.ON:
|
||||
mode_name = "On"
|
||||
elif tm.param_1 == Mode.NORMAL:
|
||||
elif event_def.param1 == Mode.NORMAL:
|
||||
mode_name = "Normal"
|
||||
elif tm.param_1 == Mode.RAW:
|
||||
elif event_def.param1 == Mode.RAW:
|
||||
mode_name = "Raw"
|
||||
pw.dlog(f"Mode Number {tm.param_1}, Mode Name {mode_name}")
|
||||
pw.dlog(f"Submode: {tm.param_2}")
|
||||
pw.dlog(f"Mode Number {event_def.param1}, Mode Name {mode_name}")
|
||||
pw.dlog(f"Submode: {event_def.param2}")
|
||||
elif info.name == "CLOCK_SET":
|
||||
old_time = event_def.param1
|
||||
new_time = event_def.param2
|
||||
old_time_dt = datetime.datetime.fromtimestamp(old_time, datetime.timezone.utc)
|
||||
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}")
|
||||
elif info.name == "CLOCK_DUMP":
|
||||
# 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}")
|
||||
elif info.name == "HEALTH_INFO":
|
||||
health = FsfwHealth(event_def.param1)
|
||||
pw.dlog(f"{obj_name}: {health!r}")
|
||||
else:
|
||||
specific_handler = False
|
||||
if info.info != "":
|
||||
additional_event_info = (
|
||||
f"Additional info: {info.info} | P1: {tm.param_1} | P2: {tm.param_2}"
|
||||
)
|
||||
additional_event_info = f"Additional info: {info.info} | P1: {event_def.param1} | P2: {event_def.param2}"
|
||||
pw.dlog(additional_event_info)
|
||||
if not specific_handler:
|
||||
printer.handle_long_tm_print(packet_if=tm, info_if=tm)
|
||||
# printer.handle_long_tm_print(packet_if=tm.pus_tm, info_if=tm.pus_tm)
|
||||
pass
|
||||
|
@ -1,15 +1,18 @@
|
||||
"""Core EIVE TM handler module
|
||||
"""
|
||||
import logging
|
||||
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
from spacepackets.ecss import PusTelemetry
|
||||
from spacepackets.ecss.pus_17_test import Service17Tm
|
||||
from spacepackets.util import PrintFormats
|
||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||
from tmtccmd import get_console_logger
|
||||
from tmtccmd.logging.pus import RawTmtcTimedLogWrapper
|
||||
from tmtccmd.pus import VerificationWrapper
|
||||
from tmtccmd.tm import Service20FsfwTm, Service200FsfwTm
|
||||
from tmtccmd.tm.pus_200_fsfw_modes import Subservice as ModeSubservices
|
||||
from tmtccmd.tm.pus_20_fsfw_param import Service20ParamDumpWrapper
|
||||
from tmtccmd.pus.s20_fsfw_param_defs import CustomSubservice as ParamSubservice
|
||||
from tmtccmd.tm.pus_200_fsfw_mode import Subservice as ModeSubservice
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from .defs import PrintWrapper
|
||||
|
||||
@ -18,7 +21,7 @@ from .verification_handler import handle_service_1_fsfw_packet, generic_retval_p
|
||||
from .hk_handling import handle_hk_packet
|
||||
from .action_reply_handler import handle_action_reply
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def pus_factory_hook(
|
||||
@ -28,13 +31,13 @@ def pus_factory_hook(
|
||||
raw_logger: RawTmtcTimedLogWrapper,
|
||||
):
|
||||
if len(packet) < 8:
|
||||
LOGGER.warning("Detected packet shorter than 8 bytes!")
|
||||
_LOGGER.warning("Detected packet shorter than 8 bytes!")
|
||||
return
|
||||
try:
|
||||
tm_packet = PusTelemetry.unpack(packet, CdsShortTimestamp.empty())
|
||||
except ValueError:
|
||||
LOGGER.warning("Could not generate PUS TM object from raw data")
|
||||
LOGGER.warning(f"Raw Packet: [{packet.hex(sep=',')}], REPR: {packet!r}")
|
||||
_LOGGER.warning("Could not generate PUS TM object from raw data")
|
||||
_LOGGER.warning(f"Raw Packet: [{packet.hex(sep=',')}], REPR: {packet!r}")
|
||||
return
|
||||
service = tm_packet.service
|
||||
obj_id_dict = get_object_ids()
|
||||
@ -50,21 +53,48 @@ def pus_factory_hook(
|
||||
handle_action_reply(raw_tm=packet, printer=printer, obj_id_dict=obj_id_dict)
|
||||
elif service == 17:
|
||||
tm_packet = Service17Tm.unpack(
|
||||
raw_telemetry=packet, time_reader=CdsShortTimestamp.empty()
|
||||
data=packet, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
if tm_packet.subservice == 2:
|
||||
verif_wrapper.dlog("Received Ping Reply TM[17,2]")
|
||||
dedicated_handler = True
|
||||
elif service == 20:
|
||||
tm_packet = Service20FsfwTm.unpack(
|
||||
param_packet = Service20FsfwTm.unpack(
|
||||
raw_telemetry=packet, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
dedicated_handler = False
|
||||
if tm_packet.subservice == ParamSubservice.TM_DUMP_REPLY:
|
||||
param_wrapper = Service20ParamDumpWrapper(param_tm=param_packet)
|
||||
try:
|
||||
param = param_wrapper.get_param()
|
||||
obj = obj_id_dict.get(param_wrapper.param_tm.object_id)
|
||||
pw.dlog(f"Received parameter dump TM from {obj}")
|
||||
pw.dlog(f"Parameter: {param}")
|
||||
if param.rows == 1 and param.columns == 1:
|
||||
try:
|
||||
scalar_param = param.parse_scalar_param()
|
||||
if isinstance(scalar_param, int):
|
||||
pw.dlog(f"Scalar integer parameter: {scalar_param}")
|
||||
elif isinstance(scalar_param, float):
|
||||
pw.dlog(f"Scalar floating point parameter: {scalar_param}")
|
||||
except ValueError as e:
|
||||
pw.dlog("received {e} trying to parse scalar parameter")
|
||||
else:
|
||||
# TODO: Could improve display further by actually displaying a matrix as a
|
||||
# matrix using row and column information
|
||||
pw.dlog(
|
||||
f"Received vector or matrix data: {param.param_raw.hex(sep=',')}"
|
||||
)
|
||||
except ValueError as e:
|
||||
pw.dlog(f"received {e} when trying to parse parameters")
|
||||
except NotImplementedError as e:
|
||||
pw.dlog(f"received {e} when trying to parse parameters")
|
||||
else:
|
||||
pw.dlog(f"unknown subservice {tm_packet.subservice} for parameter service")
|
||||
elif service == 200:
|
||||
tm_packet = Service200FsfwTm.unpack(
|
||||
raw_telemetry=packet, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
if tm_packet.subservice == ModeSubservices.TM_CANT_REACH_MODE:
|
||||
if tm_packet.subservice == ModeSubservice.TM_CANT_REACH_MODE:
|
||||
obj_id = tm_packet.object_id
|
||||
obj_id_obj = obj_id_dict.get(obj_id)
|
||||
retval = tm_packet.return_value
|
||||
@ -76,7 +106,7 @@ def pus_factory_hook(
|
||||
else:
|
||||
dedicated_handler = False
|
||||
else:
|
||||
LOGGER.info(f"The service {service} is not implemented in Telemetry Factory")
|
||||
_LOGGER.info(f"The service {service} is not implemented in Telemetry Factory")
|
||||
tm_packet.print_source_data(PrintFormats.HEX)
|
||||
dedicated_handler = True
|
||||
if not dedicated_handler and tm_packet is not None:
|
||||
|
@ -1,9 +1,11 @@
|
||||
"""HK Handling for EIVE OBSW"""
|
||||
import logging
|
||||
|
||||
# from pus_tm.tcp_server_objects import TCP_SEVER_SENSOR_TEMPERATURES
|
||||
from eive_tmtc.tmtc.acs.acs_ctrl import handle_raw_mgm_data, handle_acs_ctrl_hk_data
|
||||
from eive_tmtc.pus_tm.devs.plpcdu import handle_plpcdu_hk
|
||||
from eive_tmtc.pus_tm.devs.rad_sensor import handle_rad_sensor_data
|
||||
from eive_tmtc.pus_tm.devs.sus import handle_sus_hk
|
||||
from eive_tmtc.tmtc.power.plpcdu import handle_plpcdu_hk
|
||||
from eive_tmtc.tmtc.payload.rad_sensor import handle_rad_sensor_data
|
||||
from eive_tmtc.tmtc.acs.sus import handle_sus_hk
|
||||
from eive_tmtc.tmtc.payload.ploc_supervisor import handle_supv_hk_data
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import handle_rw_hk_data
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import handle_syrlinks_hk_data
|
||||
@ -14,11 +16,10 @@ from tmtccmd.tm.pus_3_fsfw_hk import (
|
||||
Service3FsfwTm,
|
||||
)
|
||||
from tmtccmd.util.obj_id import ObjectIdU32, ObjectIdDictT
|
||||
from tmtccmd.logging import get_console_logger
|
||||
|
||||
from eive_tmtc.pus_tm.devs.bpx_bat import handle_bpx_hk_data
|
||||
from eive_tmtc.pus_tm.devs.gps import handle_gps_data
|
||||
from eive_tmtc.pus_tm.devs.gyros import handle_gyros_hk_data
|
||||
from eive_tmtc.tmtc.power.bpx_batt import handle_bpx_hk_data
|
||||
from eive_tmtc.tmtc.acs.gps import handle_gps_data
|
||||
from eive_tmtc.tmtc.acs.gyros import handle_gyros_hk_data
|
||||
from eive_tmtc.tmtc.power.tm import (
|
||||
handle_pdu_data,
|
||||
handle_p60_hk_data,
|
||||
@ -33,11 +34,11 @@ from eive_tmtc.tmtc.acs.imtq import (
|
||||
)
|
||||
from eive_tmtc.pus_tm.defs import FsfwTmTcPrinter
|
||||
from eive_tmtc.tmtc.core import handle_core_hk_data
|
||||
from eive_tmtc.pus_tm.devs.mgms import handle_mgm_hk_data
|
||||
from eive_tmtc.tmtc.acs.mgms import handle_mgm_hk_data
|
||||
import eive_tmtc.config.object_ids as obj_ids
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
FORWARD_SENSOR_TEMPS = False
|
||||
@ -74,11 +75,11 @@ def handle_hk_packet(
|
||||
hk_data=hk_data,
|
||||
)
|
||||
except ValueError as e:
|
||||
LOGGER.exception(
|
||||
_LOGGER.exception(
|
||||
f"{e} error when parsing HK data coming from {named_obj_id}"
|
||||
)
|
||||
if tm_packet.subservice == 10 or tm_packet.subservice == 12:
|
||||
LOGGER.warning("HK definitions printout not implemented yet")
|
||||
_LOGGER.warning("HK definitions printout not implemented yet")
|
||||
|
||||
|
||||
def handle_regular_hk_print(
|
||||
@ -106,7 +107,7 @@ def handle_regular_hk_print(
|
||||
elif set_id == ImtqSetId.RAW_MTM_SET:
|
||||
return handle_raw_mtm_measurement(printer, hk_data)
|
||||
else:
|
||||
LOGGER.info("Service 3 TM: IMTQ handler reply with unknown set id")
|
||||
_LOGGER.info("Service 3 TM: IMTQ handler reply with unknown set id")
|
||||
elif objb == obj_ids.GPS_CONTROLLER:
|
||||
return handle_gps_data(printer=printer, hk_data=hk_data)
|
||||
elif objb == obj_ids.BPX_HANDLER_ID:
|
||||
@ -177,7 +178,7 @@ def handle_regular_hk_print(
|
||||
elif objb == obj_ids.ACS_CONTROLLER:
|
||||
handle_acs_ctrl_hk_data(printer, set_id, hk_data)
|
||||
else:
|
||||
LOGGER.info(
|
||||
_LOGGER.info(
|
||||
f"Service 3 TM: Parsing for object {object_id} and set ID {set_id} "
|
||||
f"has not been implemented."
|
||||
)
|
||||
|
@ -1,13 +1,13 @@
|
||||
import logging
|
||||
from typing import List, Optional
|
||||
|
||||
from spacepackets.ccsds import CdsShortTimestamp
|
||||
from spacepackets.ecss.pus_1_verification import UnpackParams, Service1Tm
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.pus import VerificationWrapper
|
||||
from tmtccmd.tm.pus_1_verification import Service1FsfwWrapper
|
||||
from eive_tmtc.config.retvals import get_retval_dict
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_service_1_fsfw_packet(wrapper: VerificationWrapper, raw_tm: bytes):
|
||||
@ -22,11 +22,11 @@ def handle_service_1_fsfw_packet(wrapper: VerificationWrapper, raw_tm: bytes):
|
||||
fsfw_wrapper = Service1FsfwWrapper(tm_packet)
|
||||
res = wrapper.verificator.add_tm(tm_packet)
|
||||
if res is None:
|
||||
LOGGER.info(
|
||||
_LOGGER.info(
|
||||
f"Received Verification TM[{tm_packet.service}, {tm_packet.subservice}] "
|
||||
f"with Request ID {tm_packet.tc_req_id.as_u32():#08x}"
|
||||
)
|
||||
LOGGER.warning(f"No matching telecommand found for {tm_packet.tc_req_id}")
|
||||
_LOGGER.warning(f"No matching telecommand found for {tm_packet.tc_req_id}")
|
||||
else:
|
||||
wrapper.log_to_console(tm_packet, res)
|
||||
wrapper.log_to_file(tm_packet, res)
|
||||
|
@ -1,3 +1,5 @@
|
||||
from .payload.pl_subsystem import add_payload_subsystem_cmds
|
||||
from .payload.subsystem import add_payload_subsystem_cmds
|
||||
from .solar_array_deployment import add_sa_depl_cmds
|
||||
from .test import add_test_defs
|
||||
from .time import add_time_cmds
|
||||
from .health import add_health_cmd_defs
|
||||
|
@ -8,7 +8,7 @@ from tmtccmd.config.tmtc import (
|
||||
)
|
||||
from tmtccmd.tc import service_provider, DefaultPusQueueHelper
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Mode
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
from eive_tmtc.config.object_ids import ACS_BOARD_ASS_ID
|
||||
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
|
@ -1,4 +1,5 @@
|
||||
import enum
|
||||
import logging
|
||||
import socket
|
||||
import struct
|
||||
from socket import AF_INET
|
||||
@ -7,27 +8,24 @@ from typing import Tuple
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import ACS_CONTROLLER
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd import get_console_logger
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Mode, pack_mode_command
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_command
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
generate_one_hk_command,
|
||||
make_sid,
|
||||
enable_periodic_hk_command_with_interval,
|
||||
disable_periodic_hk_command,
|
||||
create_request_one_diag_command,
|
||||
)
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
MGM_RAW_SET = 0
|
||||
MGM_PROC_SET = 1
|
||||
@ -289,7 +287,9 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
|
||||
elif op_code in OpCodes.REQUEST_PROC_GYR_HK:
|
||||
q.add_log_cmd(Info.REQUEST_PROC_GYR_HK)
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.GYR_PROC_SET))
|
||||
create_request_one_diag_command(
|
||||
make_sid(ACS_CONTROLLER, SetId.GYR_PROC_SET)
|
||||
)
|
||||
)
|
||||
elif op_code in OpCodes.ENABLE_PROC_GYR_HK:
|
||||
q.add_log_cmd(Info.ENABLE_PROC_GYR_HK)
|
||||
@ -378,7 +378,7 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
|
||||
)
|
||||
)
|
||||
else:
|
||||
LOGGER.info(f"Unknown op code {op_code}")
|
||||
logging.getLogger(__name__).info(f"Unknown op code {op_code}")
|
||||
|
||||
|
||||
def handle_acs_ctrl_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
@ -514,8 +514,6 @@ def handle_raw_mgm_data(pw: PrintWrapper, hk_data: bytes):
|
||||
for entry in zip(print_str_list, formatted_list):
|
||||
pw.dlog(f"{entry[0].ljust(28)}: {entry[1]}")
|
||||
current_idx += 1
|
||||
if PERFORM_MGM_CALIBRATION:
|
||||
perform_mgm_calibration(pw, mgm_0_lis3_floats_ut)
|
||||
assert current_idx == 61
|
||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=6)
|
||||
|
||||
@ -528,31 +526,48 @@ def handle_mgm_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog("Recieved HK set too small")
|
||||
return
|
||||
current_idx = 0
|
||||
for i in range(5):
|
||||
fmt_str = "!fff"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
mgm_vec = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
mgm_vec = [f"{val:8.3f}" for val in mgm_vec]
|
||||
pw.dlog(f"MGM {i}: {mgm_vec}")
|
||||
current_idx += inc_len
|
||||
fmt_str = "!fff"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
mgm_0 = struct.unpack(fmt_str, hk_data[current_idx: current_idx + inc_len])
|
||||
mgm_0_str = [f"{val:8.3f}" for val in mgm_0]
|
||||
pw.dlog(f"MGM 0 Vec: {mgm_0_str}")
|
||||
current_idx += inc_len
|
||||
mgm_1 = struct.unpack(fmt_str, hk_data[current_idx: current_idx + inc_len])
|
||||
mgm_1_str = [f"{val:8.3f}" for val in mgm_1]
|
||||
pw.dlog(f"MGM 1 Vec: {mgm_1_str}")
|
||||
current_idx += inc_len
|
||||
mgm_2 = struct.unpack(fmt_str, hk_data[current_idx: current_idx + inc_len])
|
||||
mgm_2_str = [f"{val:8.3f}" for val in mgm_2]
|
||||
pw.dlog(f"MGM 2 Vec: {mgm_2_str}")
|
||||
current_idx += inc_len
|
||||
mgm_3 = struct.unpack(fmt_str, hk_data[current_idx: current_idx + inc_len])
|
||||
mgm_3_str = [f"{val:8.3f}" for val in mgm_3]
|
||||
pw.dlog(f"MGM 3 Vec: {mgm_3_str}")
|
||||
current_idx += inc_len
|
||||
mgm_4 = struct.unpack(fmt_str, hk_data[current_idx: current_idx + inc_len])
|
||||
mgm_4_str = [f"{val:8.3f}" for val in mgm_4]
|
||||
pw.dlog(f"MGM 4 Vec: {mgm_4_str}")
|
||||
current_idx += inc_len
|
||||
fmt_str = "!ddd"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
mgm_vec_tot = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
mgm_vec_tot = struct.unpack(fmt_str, hk_data[current_idx: current_idx + inc_len])
|
||||
mgm_vec_tot = [f"{val:8.3f}" for val in mgm_vec_tot]
|
||||
current_idx += inc_len
|
||||
pw.dlog(f"MGM Total Vec: {mgm_vec_tot}")
|
||||
mgm_vec_tot_deriv = struct.unpack(
|
||||
fmt_str, hk_data[current_idx : current_idx + inc_len]
|
||||
fmt_str, hk_data[current_idx: current_idx + inc_len]
|
||||
)
|
||||
mgm_vec_tot_deriv = [f"{val:8.3f}" for val in mgm_vec_tot_deriv]
|
||||
pw.dlog(f"MGM Total Vec Deriv: {mgm_vec_tot_deriv}")
|
||||
current_idx += inc_len
|
||||
mag_igrf_model = struct.unpack(
|
||||
fmt_str, hk_data[current_idx : current_idx + inc_len]
|
||||
fmt_str, hk_data[current_idx: current_idx + inc_len]
|
||||
)
|
||||
mag_igrf_model = [f"{val:8.3f}" for val in mag_igrf_model]
|
||||
pw.dlog(f"MAG IGRF Model: {mag_igrf_model}")
|
||||
current_idx += inc_len
|
||||
if PERFORM_MGM_CALIBRATION:
|
||||
perform_mgm_calibration(pw, mgm_3)
|
||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=8)
|
||||
|
||||
|
||||
@ -622,7 +637,7 @@ def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||
fmt_vec = "!ddd"
|
||||
inc_len_scalar = struct.calcsize(fmt_scalar)
|
||||
inc_len_vec = struct.calcsize(fmt_vec)
|
||||
if len(hk_data) < 2 * inc_len_scalar + inc_len_vec:
|
||||
if len(hk_data) < 2 * inc_len_scalar + 2 * inc_len_vec:
|
||||
pw.dlog("Received HK set too small")
|
||||
return
|
||||
current_idx = 0
|
||||
@ -640,14 +655,22 @@ def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||
)
|
||||
]
|
||||
current_idx += inc_len_scalar
|
||||
pos = [
|
||||
f"{val:8.3f}"
|
||||
for val in struct.unpack(
|
||||
fmt_vec, hk_data[current_idx : current_idx + inc_len_vec]
|
||||
)
|
||||
]
|
||||
velo = [
|
||||
f"{val:8.3f}"
|
||||
for val in struct.unpack(
|
||||
fmt_vec, hk_data[current_idx : current_idx + inc_len_vec]
|
||||
)
|
||||
]
|
||||
current_idx += inc_len_vec
|
||||
pw.dlog(f"GPS Latitude: {lat} [rad]")
|
||||
pw.dlog(f"GPS Longitude: {long} [rad]")
|
||||
pw.dlog(f"GPS Position: {pos} [m]")
|
||||
pw.dlog(f"GPS Velocity: {velo} [m/s]")
|
||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=3)
|
||||
|
||||
@ -675,6 +698,7 @@ def handle_mekf_data(pw: PrintWrapper, hk_data: bytes):
|
||||
fmt_vec, hk_data[current_idx : current_idx + inc_len_vec]
|
||||
)
|
||||
]
|
||||
current_idx += inc_len_vec
|
||||
pw.dlog(f"MEKF Quaternion: {quat}")
|
||||
pw.dlog(f"MEKF Rotational Rate: {rate}")
|
||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=2)
|
||||
@ -710,6 +734,7 @@ def handle_ctrl_val_data(pw: PrintWrapper, hk_data: bytes):
|
||||
fmt_scalar, hk_data[current_idx : current_idx + inc_len_scalar]
|
||||
)
|
||||
]
|
||||
current_idx += inc_len_scalar
|
||||
pw.dlog(f"Control Values Target Quaternion: {tgt_quat}")
|
||||
pw.dlog(f"Control Values Error Quaternion: {err_quat}")
|
||||
pw.dlog(f"Control Values Error Angle: {err_ang} [rad]")
|
||||
@ -748,6 +773,7 @@ def handle_act_cmd_data(pw: PrintWrapper, hk_data: bytes):
|
||||
fmt_vec3_int16, hk_data[current_idx : current_idx + inc_len_vec3_int16]
|
||||
)
|
||||
]
|
||||
current_idx += inc_len_vec3_int16
|
||||
pw.dlog(f"Actuator Commands RW Target Torque: {rw_tgt_torque}")
|
||||
pw.dlog(f"Actuator Commands RW Target Speed: {rw_tgt_speed}")
|
||||
pw.dlog(f"Actuator Commands MTQ Target Dipole: {mtq_tgt_dipole}")
|
||||
|
84
eive_tmtc/tmtc/acs/gps.py
Normal file
84
eive_tmtc/tmtc/acs/gps.py
Normal file
@ -0,0 +1,84 @@
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpCode:
|
||||
REQ_OS_HK = ["hk"]
|
||||
RESET_GNSS = ["reset"]
|
||||
|
||||
|
||||
class Info:
|
||||
REQ_OS_HK = "Request One-Shot HK"
|
||||
RESET_GNSS = "Reset GNSS using reset pin"
|
||||
|
||||
|
||||
class SetId:
|
||||
HK = 0
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_gps_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCode.RESET_GNSS, info=Info.RESET_GNSS)
|
||||
oce.add(keys=OpCode.REQ_OS_HK, info=Info.REQ_OS_HK)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.GPS_CTRL.value,
|
||||
info="GPS/GNSS Controller",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
||||
|
||||
def pack_gps_command(object_id: bytes, q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCode.RESET_GNSS:
|
||||
# TODO: This needs to be re-implemented
|
||||
_LOGGER.warning("Reset pin handling needs to be re-implemented")
|
||||
if op_code in OpCode.REQ_OS_HK:
|
||||
q.add_log_cmd(f"GMSS: {Info.REQ_OS_HK}")
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(sid=make_sid(object_id=object_id, set_id=SetId.HK))
|
||||
)
|
||||
|
||||
|
||||
def handle_gps_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Received GPS data, HK data length {len(hk_data)}")
|
||||
current_idx = 0
|
||||
fmt_str = "!ddddBBBHBBBBBI"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
lat,
|
||||
long,
|
||||
alt,
|
||||
speed,
|
||||
fix,
|
||||
sats_in_use,
|
||||
sats_in_view,
|
||||
year,
|
||||
month,
|
||||
day,
|
||||
hours,
|
||||
minutes,
|
||||
seconds,
|
||||
unix_seconds,
|
||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
current_idx += inc_len
|
||||
date_string = f"{day}.{month}.{year} {hours}:{minutes}:{seconds}"
|
||||
pw.dlog(f"Lat: {lat} deg")
|
||||
pw.dlog(f"Long: {long} deg")
|
||||
pw.dlog(f"Altitude: {alt} m | Speed: {speed} m/s")
|
||||
pw.dlog(
|
||||
f"Fix Type: {fix} | Sats in View {sats_in_view} | Sats in Use {sats_in_use}"
|
||||
)
|
||||
pw.dlog(f"GNSS Date: {date_string}")
|
||||
pw.dlog(f"Unix seconds {unix_seconds}")
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=14)
|
@ -1,11 +1,20 @@
|
||||
import enum
|
||||
import struct
|
||||
|
||||
import eive_tmtc.config.object_ids as obj_ids
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
from eive_tmtc.pus_tc.devs.gyros import L3gGyroSetId, AdisGyroSetId
|
||||
import eive_tmtc.config.object_ids as obj_ids
|
||||
|
||||
class AdisGyroSetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
CFG_HK = 1
|
||||
|
||||
|
||||
class L3gGyroSetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
|
||||
|
||||
def handle_gyros_hk_data(
|
@ -22,7 +22,7 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
generate_one_diag_command,
|
||||
generate_one_hk_command,
|
||||
)
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Mode
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
@ -1,10 +1,19 @@
|
||||
import enum
|
||||
import struct
|
||||
|
||||
import eive_tmtc.config.object_ids as obj_ids
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.pus_tc.devs.mgms import MgmRm3100SetId, MgmLis3SetId
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
import eive_tmtc.config.object_ids as obj_ids
|
||||
|
||||
|
||||
class MgmLis3SetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
|
||||
|
||||
class MgmRm3100SetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
|
||||
|
||||
def handle_mgm_hk_data(
|
@ -20,7 +20,7 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
disable_periodic_hk_command,
|
||||
)
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Mode, Subservice
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode, Subservice
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
@ -6,18 +6,18 @@
|
||||
@date 14.08.2021
|
||||
"""
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Mode
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class StarTrackerActionId(enum.IntEnum):
|
||||
@ -647,7 +647,7 @@ def pack_checksum_command(object_id: bytes) -> bytearray:
|
||||
|
||||
|
||||
def get_config_file() -> str:
|
||||
LOGGER.info("Specify json file")
|
||||
_LOGGER.info("Specify json file")
|
||||
input_helper = InputHelper(json_dict)
|
||||
key = input_helper.get_key()
|
||||
json_file = json_dict[key][1]
|
||||
@ -655,7 +655,7 @@ def get_config_file() -> str:
|
||||
|
||||
|
||||
def get_firmware() -> str:
|
||||
LOGGER.info("Specify firmware file")
|
||||
_LOGGER.info("Specify firmware file")
|
||||
input_helper = InputHelper(firmware_dict)
|
||||
key = input_helper.get_key()
|
||||
firmware = firmware_dict[key][1]
|
||||
@ -663,7 +663,7 @@ def get_firmware() -> str:
|
||||
|
||||
|
||||
def get_upload_image() -> str:
|
||||
LOGGER.info("Specify image to upload")
|
||||
_LOGGER.info("Specify image to upload")
|
||||
input_helper = InputHelper(upload_image_dict)
|
||||
key = input_helper.get_key()
|
||||
image = upload_image_dict[key][1]
|
||||
|
@ -10,7 +10,7 @@ from tmtccmd.config.tmtc import (
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Subservice as ModeSubservices
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Subservice as ModeSubservices
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
|
||||
@ -20,16 +20,22 @@ class OpCode(str, enum.Enum):
|
||||
SAFE = "safe"
|
||||
DETUMBLE = "detumble"
|
||||
IDLE = "idle"
|
||||
TARGET_PT = "target"
|
||||
PTG_TARGET = "ptg_target"
|
||||
PTG_TARGET_NADIR = "ptg_nadir"
|
||||
PTG_TARGET_GS = "ptg_target_gs"
|
||||
PTG_TARGET_INERTIAL = "ptg_inertial"
|
||||
REPORT_ALL_MODES = "all_modes"
|
||||
|
||||
|
||||
class AcsMode(enum.IntEnum):
|
||||
OFF = 0
|
||||
SAFE = 1 << 24
|
||||
DETUMBLE = 2 << 24
|
||||
IDLE = 3 << 24
|
||||
TARGET_PT = 4 << 24
|
||||
SAFE = 10
|
||||
DETUMBLE = 11
|
||||
IDLE = 12
|
||||
PTG_TARGET_NADIR = 13
|
||||
PTG_TARGET = 14
|
||||
PTG_TARGET_GS = 15
|
||||
PTG_TARGET_INERTIAL = 16
|
||||
|
||||
|
||||
class Info(str, enum.Enum):
|
||||
@ -37,15 +43,22 @@ class Info(str, enum.Enum):
|
||||
SAFE = "Safe Mode Command"
|
||||
DETUMBLE = "Detumble Mode Command"
|
||||
IDLE = "Idle Mode Command"
|
||||
TARGET_PT = "Target Pointing Mode Command"
|
||||
PTG_TARGET_NADIR = "Target Pointing Nadir"
|
||||
PTG_TARGET = "Target Pointing"
|
||||
PTG_TARGET_GS = "Target Pointing Ground Station"
|
||||
PTG_TARGET_INERTIAL = "Target Pointing Inertial"
|
||||
REPORT_ALL_MODES = "Report All Modes Recursively"
|
||||
|
||||
|
||||
HANDLER_LIST: Dict[str, Tuple[int, str]] = {
|
||||
OpCode.OFF: (AcsMode.OFF, Info.OFF),
|
||||
OpCode.IDLE: (AcsMode.IDLE, Info.IDLE),
|
||||
OpCode.SAFE: (AcsMode.SAFE, Info.SAFE),
|
||||
OpCode.DETUMBLE: (AcsMode.DETUMBLE, Info.DETUMBLE),
|
||||
OpCode.IDLE: (AcsMode.IDLE, Info.IDLE),
|
||||
OpCode.PTG_TARGET: (AcsMode.PTG_TARGET, Info.PTG_TARGET),
|
||||
OpCode.PTG_TARGET_GS: (AcsMode.PTG_TARGET_GS, Info.PTG_TARGET_GS),
|
||||
OpCode.PTG_TARGET_NADIR: (AcsMode.PTG_TARGET_NADIR, Info.PTG_TARGET_NADIR),
|
||||
OpCode.PTG_TARGET_INERTIAL: (AcsMode.PTG_TARGET_INERTIAL, Info.PTG_TARGET_INERTIAL),
|
||||
}
|
||||
|
||||
|
||||
@ -78,8 +91,7 @@ def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
||||
@tmtc_definitions_provider
|
||||
def add_acs_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.OFF, Info.OFF)
|
||||
oce.add(OpCode.SAFE, Info.SAFE)
|
||||
oce.add(OpCode.IDLE, Info.IDLE)
|
||||
for op_code, (_, info) in HANDLER_LIST.items():
|
||||
oce.add(op_code, info)
|
||||
oce.add(OpCode.REPORT_ALL_MODES, Info.REPORT_ALL_MODES)
|
||||
defs.add_service(CustomServiceList.ACS_SS, "ACS Subsystem", oce)
|
@ -1,11 +1,14 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.pus_tc.devs.sus import SetId
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class SetId:
|
||||
HK = 3
|
||||
|
||||
|
||||
def handle_sus_hk(
|
||||
object_id: ObjectIdU32, hk_data: bytes, printer: FsfwTmTcPrinter, set_id: int
|
||||
):
|
@ -9,7 +9,7 @@ from tmtccmd.config.tmtc import (
|
||||
)
|
||||
from tmtccmd.tc import service_provider, DefaultPusQueueHelper
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Mode
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
|
||||
|
||||
class SusOpCode:
|
||||
|
@ -0,0 +1 @@
|
||||
from .subsystem import add_com_subsystem_cmds
|
||||
|
@ -16,7 +16,7 @@ from tmtccmd.config.tmtc import (
|
||||
TmtcDefinitionWrapper,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import create_mode_command, Mode
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command, Mode
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from eive_tmtc.config.object_ids import CCSDS_HANDLER_ID
|
||||
|
||||
|
115
eive_tmtc/tmtc/com/subsystem.py
Normal file
115
eive_tmtc/tmtc/com/subsystem.py
Normal file
@ -0,0 +1,115 @@
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import COM_SUBSYSTEM_ID
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import Datarate
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command
|
||||
from tmtccmd.tc.pus_20_fsfw_param import (
|
||||
create_load_param_cmd,
|
||||
pack_scalar_u8_parameter_app_data,
|
||||
)
|
||||
|
||||
|
||||
class ParameterId(enum.IntEnum):
|
||||
DATARATE = 0
|
||||
|
||||
|
||||
class Submode(enum.IntEnum):
|
||||
RX_ONLY = 10
|
||||
RX_AND_TX_DEF_DATARATE = 11
|
||||
RX_AND_TX_LOW_DATARATE = 12
|
||||
RX_AND_TX_HIGH_DATARATE = 13
|
||||
RX_AND_TX_CARRIER_WAVE = 14
|
||||
|
||||
|
||||
class OpCode:
|
||||
RX_ONLY = "rx_only"
|
||||
TX_AND_RX_DEF_RATE = "rx_and_tx_default_rate"
|
||||
TX_AND_RX_LOW_RATE = "rx_and_tx_low_rate"
|
||||
TX_AND_RX_HIGH_RATE = "rx_and_tx_high_rate"
|
||||
TX_AND_RX_CARRIER_WAVE = "rx_and_tx_carrier_wave"
|
||||
UPDATE_DEFAULT_DATARATE_LOW = "update_default_rate_low"
|
||||
UPDATE_DEFAULT_DATARATE_HIGH = "update_default_rate_high"
|
||||
|
||||
|
||||
class Info:
|
||||
RX_ONLY = "Syrlinks RX Only"
|
||||
TX_AND_RX_DEF_DATARATE = "Syrlinks with TX default datarate"
|
||||
TX_AND_RX_LOW_DATARATE = "Syrlinks with TX low datarate (BPSK modulation)"
|
||||
TX_AND_RX_HIGH_DATARATE = "Syrlinks with TX high datarate (0QPSK modulation)"
|
||||
TX_AND_RX_CARRIER_WAVE = "Syrlinks with TX carrier wave"
|
||||
UPDATE_DEFAULT_DATARATE_LOW = "Configure default low datarate (BPSK modulation)"
|
||||
UPDATE_DEFAULT_DATARATE_HIGH = "Configure default high datarate (0QPSK modulation)"
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.COM_SS)
|
||||
def build_com_subsystem_cmd(p: ServiceProviderParams):
|
||||
q = p.queue_helper
|
||||
o = p.op_code
|
||||
prefix = "COM Subsystem"
|
||||
if o == OpCode.RX_ONLY:
|
||||
q.add_log_cmd(Info.RX_ONLY)
|
||||
q.add_pus_tc(create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_ONLY, 0))
|
||||
elif o == OpCode.TX_AND_RX_DEF_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_DEF_DATARATE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_DEF_DATARATE, 0)
|
||||
)
|
||||
elif o == OpCode.TX_AND_RX_LOW_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_LOW_DATARATE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_LOW_DATARATE, 0)
|
||||
)
|
||||
elif o == OpCode.TX_AND_RX_HIGH_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_HIGH_DATARATE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_HIGH_DATARATE, 0)
|
||||
)
|
||||
if o == OpCode.UPDATE_DEFAULT_DATARATE_LOW:
|
||||
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_LOW}")
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
pack_scalar_u8_parameter_app_data(
|
||||
COM_SUBSYSTEM_ID,
|
||||
0,
|
||||
ParameterId.DATARATE,
|
||||
Datarate.LOW_RATE_MODULATION_BPSK,
|
||||
)
|
||||
)
|
||||
)
|
||||
if o == OpCode.UPDATE_DEFAULT_DATARATE_HIGH:
|
||||
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_HIGH}")
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
pack_scalar_u8_parameter_app_data(
|
||||
COM_SUBSYSTEM_ID,
|
||||
0,
|
||||
ParameterId.DATARATE,
|
||||
Datarate.HIGH_RATE_MODULATION_0QPSK,
|
||||
)
|
||||
)
|
||||
)
|
||||
elif o == OpCode.TX_AND_RX_CARRIER_WAVE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_CARRIER_WAVE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, Submode.RX_AND_TX_CARRIER_WAVE, 0)
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_com_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.RX_ONLY, Info.RX_ONLY)
|
||||
oce.add(OpCode.TX_AND_RX_LOW_RATE, Info.TX_AND_RX_LOW_DATARATE)
|
||||
oce.add(OpCode.TX_AND_RX_HIGH_RATE, Info.TX_AND_RX_HIGH_DATARATE)
|
||||
oce.add(OpCode.TX_AND_RX_DEF_RATE, Info.TX_AND_RX_DEF_DATARATE)
|
||||
oce.add(OpCode.UPDATE_DEFAULT_DATARATE_LOW, Info.UPDATE_DEFAULT_DATARATE_LOW)
|
||||
oce.add(OpCode.UPDATE_DEFAULT_DATARATE_HIGH, Info.UPDATE_DEFAULT_DATARATE_HIGH)
|
||||
defs.add_service(CustomServiceList.COM_SS, "COM Subsystem", oce)
|
@ -23,11 +23,7 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
create_disable_periodic_hk_command,
|
||||
)
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Mode, create_mode_command
|
||||
from tmtccmd.tc.pus_20_fsfw_params import (
|
||||
pack_scalar_u8_parameter_app_data,
|
||||
create_load_param_cmd,
|
||||
)
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, create_mode_command
|
||||
from eive_tmtc.config.object_ids import SYRLINKS_HANDLER_ID
|
||||
import struct
|
||||
|
||||
@ -49,8 +45,6 @@ class OpCode:
|
||||
NORMAL_RX_AND_TX_DEF_DATARATE = "nml_default_datarate"
|
||||
NORMAL_RX_AND_TX_LOW_DATARATE = "nml_low_datarate"
|
||||
NORMAL_RX_AND_TX_HIGH_DATARATE = "nml_high_datarate"
|
||||
UPDATE_DEFAULT_DATARATE_LOW_RATE = "param_low_datarate"
|
||||
UPDATE_DEFAULT_DATARATE_HIGH_RATE = "param_high_datarate"
|
||||
HK_RX_REGS = "hk_rx_regs"
|
||||
ENABLE_HK_RX_REGS = "enable_hk_rx"
|
||||
DISABLE_HK_RX_REGS = "disable_hk_rx"
|
||||
@ -69,8 +63,6 @@ class Info:
|
||||
NORMAL_RX_AND_TX_DEF_DATARATE = "NORMAL RX and TX, TX with default datarate"
|
||||
NORMAL_RX_AND_TX_LOW_DATARATE = "NORMAL RX and TX, TX with low datarate"
|
||||
NORMAL_RX_AND_TX_HIGH_DATARATE = "NORMAL RX and TX, TX with high datarate"
|
||||
UPDATE_DEFAULT_DATARATE_LOW_RATE = "Update default datarate to low rate (BPSK)"
|
||||
UPDATE_DEFAULT_DATARATE_HIGH_RATE = "Update default datarate to high rate (0QPSK)"
|
||||
HK_RX_REGS = "Request RX register set"
|
||||
HK_TX_REGS = "Request TX register set"
|
||||
ENABLE_HK_RX_REGS = "Enable periodic RX register HK"
|
||||
@ -108,10 +100,6 @@ class Submode(enum.IntEnum):
|
||||
RX_AND_TX_CW = 4
|
||||
|
||||
|
||||
class ParameterId(enum.IntEnum):
|
||||
DATARATE = 0
|
||||
|
||||
|
||||
class Datarate(enum.IntEnum):
|
||||
LOW_RATE_MODULATION_BPSK = 0
|
||||
HIGH_RATE_MODULATION_0QPSK = 1
|
||||
@ -127,12 +115,6 @@ def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce.add(OpCode.NORMAL_RX_AND_TX_DEF_DATARATE, Info.NORMAL_RX_AND_TX_DEF_DATARATE)
|
||||
oce.add(OpCode.NORMAL_RX_AND_TX_LOW_DATARATE, Info.NORMAL_RX_AND_TX_LOW_DATARATE)
|
||||
oce.add(OpCode.NORMAL_RX_AND_TX_HIGH_DATARATE, Info.NORMAL_RX_AND_TX_HIGH_DATARATE)
|
||||
oce.add(
|
||||
OpCode.UPDATE_DEFAULT_DATARATE_LOW_RATE, Info.UPDATE_DEFAULT_DATARATE_LOW_RATE
|
||||
)
|
||||
oce.add(
|
||||
OpCode.UPDATE_DEFAULT_DATARATE_HIGH_RATE, Info.UPDATE_DEFAULT_DATARATE_HIGH_RATE
|
||||
)
|
||||
oce.add(OpCode.HK_RX_REGS, Info.HK_RX_REGS)
|
||||
oce.add(OpCode.HK_TX_REGS, Info.HK_TX_REGS)
|
||||
oce.add(OpCode.TX_STATUS, Info.TX_STATUS)
|
||||
@ -188,24 +170,6 @@ def pack_syrlinks_command(
|
||||
normal_mode_cmd(
|
||||
q, Info.NORMAL_RX_AND_TX_HIGH_DATARATE, Submode.RX_AND_TX_HIGH_DATARATE
|
||||
)
|
||||
if op_code == OpCode.UPDATE_DEFAULT_DATARATE_LOW_RATE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_LOW_RATE}")
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
pack_scalar_u8_parameter_app_data(
|
||||
obyt, 0, ParameterId.DATARATE, Datarate.LOW_RATE_MODULATION_BPSK
|
||||
)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.UPDATE_DEFAULT_DATARATE_HIGH_RATE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_HIGH_RATE}")
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
pack_scalar_u8_parameter_app_data(
|
||||
obyt, 0, ParameterId.DATARATE, Datarate.HIGH_RATE_MODULATION_0QPSK
|
||||
)
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.NORMAL_RX_AND_TX_CW:
|
||||
normal_mode_cmd(q, Info.NORMAL_RX_AND_TX_CW, Submode.RX_AND_TX_CW)
|
||||
if op_code in OpCode.HK_RX_REGS:
|
||||
|
@ -2,7 +2,7 @@ from typing import Union
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Mode, Subservice
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode, Subservice
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
@ -9,13 +10,12 @@ from tmtccmd.config import TmtcDefinitionWrapper
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
||||
from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider
|
||||
from eive_tmtc.config.object_ids import CORE_CONTROLLER_ID
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ActionId(enum.IntEnum):
|
||||
@ -244,7 +244,7 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
while True:
|
||||
active_sd_card = int(input("Please specify active SD cqrd [0/1]: "))
|
||||
if active_sd_card not in [0, 1]:
|
||||
LOGGER.warning("Invalid SD card specified. Try again")
|
||||
_LOGGER.warning("Invalid SD card specified. Try again")
|
||||
break
|
||||
q.add_log_cmd(Info.SWITCH_TO_BOTH_SD_CARDS)
|
||||
q.add_pus_tc(
|
||||
@ -282,9 +282,9 @@ def determine_reboot_params() -> (bool, Chip, Copy):
|
||||
copy_select = -1
|
||||
reboot_self = input("Reboot self? [y/n]: ")
|
||||
if reboot_self in ["y", "yes", "1"]:
|
||||
LOGGER.info("Rebooting currently running image")
|
||||
_LOGGER.info("Rebooting currently running image")
|
||||
return True, chip_select, copy_select
|
||||
LOGGER.info("Rebooting image specified by chip and copy")
|
||||
_LOGGER.info("Rebooting image specified by chip and copy")
|
||||
return False, determine_chip_and_copy()
|
||||
|
||||
|
||||
@ -298,7 +298,7 @@ def determine_chip_and_copy() -> (int, int):
|
||||
chip_select = Chip.CHIP_1
|
||||
break
|
||||
else:
|
||||
LOGGER.warning("Invalid chip select value. Try again")
|
||||
_LOGGER.warning("Invalid chip select value. Try again")
|
||||
while True:
|
||||
copy_select = input("Copy select [0/1]: ")
|
||||
if copy_select in ["0", "1"]:
|
||||
@ -308,7 +308,7 @@ def determine_chip_and_copy() -> (int, int):
|
||||
copy_select = Copy.COPY_1_GOLD
|
||||
break
|
||||
else:
|
||||
LOGGER.warning("Invalid copy select value. Try again")
|
||||
_LOGGER.warning("Invalid copy select value. Try again")
|
||||
return chip_select, copy_select
|
||||
|
||||
|
||||
|
43
eive_tmtc/tmtc/health.py
Normal file
43
eive_tmtc/tmtc/health.py
Normal file
@ -0,0 +1,43 @@
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.pus.s201_fsfw_health import Subservice
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
|
||||
|
||||
class OpCode:
|
||||
ANNOUNCE_HEALTH_ALL = "read_health_all"
|
||||
ANNOUNCE_HEALTH = "read_health"
|
||||
|
||||
|
||||
class Info:
|
||||
ANNOUNCE_HEALTH_ALL = "Read all health states"
|
||||
ANNOUNCE_HEALTH = "Read health state of one object"
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.HEALTH)
|
||||
def pack_test_command(p: ServiceProviderParams):
|
||||
o = p.op_code
|
||||
q = p.queue_helper
|
||||
if o == OpCode.ANNOUNCE_HEALTH:
|
||||
raise NotImplementedError()
|
||||
elif o == OpCode.ANNOUNCE_HEALTH_ALL:
|
||||
q.add_log_cmd(Info.ANNOUNCE_HEALTH_ALL)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(service=201, subservice=Subservice.TC_ANNOUNCE_HEALTH_ALL)
|
||||
)
|
||||
return
|
||||
raise ValueError(f"unknown op code {o} for service {CustomServiceList.HEALTH}")
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_health_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.ANNOUNCE_HEALTH_ALL, Info.ANNOUNCE_HEALTH_ALL)
|
||||
oce.add(OpCode.ANNOUNCE_HEALTH, Info.ANNOUNCE_HEALTH)
|
||||
defs.add_service(CustomServiceList.HEALTH, info="Health Service", op_code_entry=oce)
|
@ -7,7 +7,7 @@
|
||||
"""
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Mode
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||
from eive_tmtc.config.object_ids import TEST_DEVICE_ID
|
||||
|
||||
TEST_DEVICE_OBJ_ID = TEST_DEVICE_ID
|
@ -6,6 +6,7 @@
|
||||
@author J. Meier
|
||||
@date 06.03.2021
|
||||
"""
|
||||
import logging
|
||||
import struct
|
||||
import enum
|
||||
|
||||
@ -16,15 +17,14 @@ from tmtccmd.config.tmtc import (
|
||||
OpCodeEntry,
|
||||
TmtcDefinitionWrapper,
|
||||
)
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Mode
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
MANUAL_INPUT = "1"
|
||||
|
||||
@ -324,7 +324,7 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
|
||||
|
||||
|
||||
def get_obc_file() -> str:
|
||||
LOGGER.info("Specify OBC file ")
|
||||
_LOGGER.info("Specify OBC file ")
|
||||
input_helper = InputHelper(flash_write_file_dict)
|
||||
key = input_helper.get_key()
|
||||
if key == MANUAL_INPUT:
|
||||
@ -335,7 +335,7 @@ def get_obc_file() -> str:
|
||||
|
||||
|
||||
def get_mpsoc_file() -> str:
|
||||
LOGGER.info("Specify MPSoC file")
|
||||
_LOGGER.info("Specify MPSoC file")
|
||||
input_helper = InputHelper(mpsoc_file_dict)
|
||||
key = input_helper.get_key()
|
||||
if key == MANUAL_INPUT:
|
||||
@ -346,7 +346,7 @@ def get_mpsoc_file() -> str:
|
||||
|
||||
|
||||
def get_sequence_file() -> str:
|
||||
LOGGER.info("Specify sequence file")
|
||||
_LOGGER.info("Specify sequence file")
|
||||
input_helper = InputHelper(SEQ_FILE_DICT)
|
||||
key = input_helper.get_key()
|
||||
if key == MANUAL_INPUT:
|
||||
|
@ -7,6 +7,7 @@
|
||||
@date 10.07.2021
|
||||
"""
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.object_ids import PLOC_SUPV_ID, get_object_ids
|
||||
@ -16,7 +17,6 @@ from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
from tmtccmd.config import TmtcDefinitionWrapper
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider, OpCodeEntry
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
|
||||
@ -24,7 +24,7 @@ from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
latchup_id_dict = {
|
||||
"0": "0.85V",
|
||||
@ -698,7 +698,7 @@ def pack_logging_set_topic(object_id: bytes) -> bytearray:
|
||||
|
||||
|
||||
def get_update_file() -> str:
|
||||
LOGGER.info("Specify update file ")
|
||||
_LOGGER.info("Specify update file ")
|
||||
input_helper = InputHelper(update_file_dict)
|
||||
key = input_helper.get_key()
|
||||
if key == HARDCODED:
|
||||
@ -711,7 +711,7 @@ def get_update_file() -> str:
|
||||
|
||||
|
||||
def get_event_buffer_path() -> str:
|
||||
LOGGER.info("Specify path where to store event buffer file ")
|
||||
_LOGGER.info("Specify path where to store event buffer file ")
|
||||
input_helper = InputHelper(event_buffer_path_dict)
|
||||
key = input_helper.get_key()
|
||||
if key == MANUAL_INPUT:
|
||||
|
@ -8,14 +8,16 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from eive_tmtc.pus_tc.service_200_mode import pack_mode_data, Mode
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class SetId:
|
||||
@ -95,3 +97,22 @@ def rad_sensor_mode_cmd(
|
||||
q.add_log_cmd(f"Rad sensor: {info}")
|
||||
mode_data = pack_mode_data(object_id.as_bytes, mode, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
|
||||
def handle_rad_sensor_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
if set_id == SetId.HK:
|
||||
pw = PrintWrapper(printer)
|
||||
current_idx = 0
|
||||
pw.dlog("Received Radiation Sensor HK data")
|
||||
fmt_str = "!fHHHHHH"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(temp, ain0, ain1, ain4, ain5, ain6, ain7) = struct.unpack(
|
||||
fmt_str, hk_data[current_idx : current_idx + inc_len]
|
||||
)
|
||||
ain_dict = {0: ain0, 1: ain1, 4: ain4, 5: ain5, 6: ain6, 7: ain7}
|
||||
pw.dlog(f"Temperature: {temp} C")
|
||||
pw.dlog(f"AIN Channel | Raw Value (hex) | Raw Value (dec)")
|
||||
for idx, val in ain_dict.items():
|
||||
pw.dlog(f"{idx} | {val:#06x} | {str(val).ljust(5)}")
|
||||
current_idx += inc_len
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)
|
@ -5,7 +5,7 @@ from spacepackets.ecss import PusTelecommand
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Mode, pack_mode_data, Subservice
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data, Subservice
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
@ -9,7 +9,16 @@ from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Subservice as ModeSubservice
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Subservice as ModeSubservice
|
||||
|
||||
|
||||
class ModeId:
|
||||
OFF = 0
|
||||
SUPV_ONLY = 10
|
||||
MPSOC_STREAM = 11
|
||||
CAM_STREAM = 12
|
||||
EARTH_OBSV = 13
|
||||
SCEX = 14
|
||||
|
||||
|
||||
class OpCode(str, enum.Enum):
|
@ -1,3 +1,6 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
@ -11,8 +14,9 @@ from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Mode
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Subservice as ModeSubservices
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Subservice as ModeSubservices
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class BpxSetId:
|
||||
@ -105,3 +109,66 @@ def pack_bpx_commands(p: ServiceProviderParams):
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(object_id=BPX_HANDLER_ID, action_id=BpxActionId.REBOOT)
|
||||
)
|
||||
|
||||
|
||||
HEADER_LIST = [
|
||||
"Charge Current",
|
||||
"Discharge Current",
|
||||
"Heater Current",
|
||||
"Battery Voltage",
|
||||
"Batt Temp 1",
|
||||
"Batt Temp 2",
|
||||
"Batt Temp 3",
|
||||
"Batt Temp 4",
|
||||
"Reboot Counter",
|
||||
"Boot Cause",
|
||||
]
|
||||
|
||||
|
||||
def handle_bpx_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
if set_id == BpxSetId.GET_HK_SET:
|
||||
fmt_str = "!HHHHhhhhIB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
charge_current,
|
||||
discharge_current,
|
||||
heater_current,
|
||||
batt_voltage,
|
||||
batt_temp_1,
|
||||
batt_temp_2,
|
||||
batt_temp_3,
|
||||
batt_temp_4,
|
||||
reboot_cntr,
|
||||
boot_cause,
|
||||
) = struct.unpack(fmt_str, hk_data[0:inc_len])
|
||||
content_list = [
|
||||
charge_current,
|
||||
discharge_current,
|
||||
heater_current,
|
||||
batt_voltage,
|
||||
batt_temp_1,
|
||||
batt_temp_2,
|
||||
batt_temp_3,
|
||||
batt_temp_4,
|
||||
reboot_cntr,
|
||||
boot_cause,
|
||||
]
|
||||
validity_buffer = hk_data[inc_len:]
|
||||
pw.dlog(str(HEADER_LIST))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=10)
|
||||
elif set_id == BpxSetId.GET_CFG_SET:
|
||||
battheat_mode = hk_data[0]
|
||||
battheat_low = struct.unpack("!b", hk_data[1:2])[0]
|
||||
battheat_high = struct.unpack("!b", hk_data[2:3])[0]
|
||||
header_list = [
|
||||
"Battery Heater Mode",
|
||||
"Battery Heater Low Limit",
|
||||
"Battery Heater High Limit",
|
||||
]
|
||||
content_list = [battheat_mode, battheat_low, battheat_high]
|
||||
validity_buffer = hk_data[3:]
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=10)
|
@ -1,9 +1,11 @@
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
import time
|
||||
from typing import Optional
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.config import TmtcDefinitionWrapper
|
||||
|
||||
from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider
|
||||
@ -18,17 +20,17 @@ from tmtccmd.tc.pus_11_tc_sched import (
|
||||
create_enable_tc_sched_cmd,
|
||||
create_time_tagged_cmd,
|
||||
)
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Mode, Subservice
|
||||
from tmtccmd.tc.pus_20_fsfw_params import (
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode, Subservice
|
||||
from tmtccmd.tc.pus_20_fsfw_param import (
|
||||
pack_scalar_double_param_app_data,
|
||||
create_load_param_cmd,
|
||||
pack_boolean_parameter_app_data,
|
||||
)
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from eive_tmtc.config.object_ids import PL_PCDU_ID
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpCode:
|
||||
@ -369,10 +371,10 @@ def request_wait_time() -> Optional[float]:
|
||||
try:
|
||||
wait_time = float(wait_time)
|
||||
except ValueError:
|
||||
LOGGER.warning("Invalid input")
|
||||
_LOGGER.warning("Invalid input")
|
||||
continue
|
||||
if wait_time <= 0:
|
||||
LOGGER.warning("Invalid input")
|
||||
_LOGGER.warning("Invalid input")
|
||||
else:
|
||||
return wait_time
|
||||
|
||||
@ -448,3 +450,50 @@ def pack_pl_pcdu_mode_cmd(
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=mode_data
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
ADC_CHANNELS_NAMED = [
|
||||
"U BAT DIV 6",
|
||||
"U NEG V FB",
|
||||
"I HPA",
|
||||
"U HPA DIV 6",
|
||||
"I MPA",
|
||||
"U MPA DIV 6",
|
||||
"I TX",
|
||||
"U TX DIV 6",
|
||||
"I X8",
|
||||
"U X8 DIV 6",
|
||||
"I DRO",
|
||||
"U DRO DIV 6",
|
||||
]
|
||||
|
||||
|
||||
def handle_plpcdu_hk(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||
if set_id == SetId.ADC:
|
||||
pw = PrintWrapper(printer)
|
||||
current_idx = 0
|
||||
pw.dlog("Received PL PCDU ADC HK data")
|
||||
channels = []
|
||||
ch_print = "Channels Raw (hex): ["
|
||||
for i in range(12):
|
||||
channels.append(
|
||||
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
||||
)
|
||||
if i < 11:
|
||||
ch_print += f"{channels[i]:06x},"
|
||||
else:
|
||||
ch_print += f"{channels[i]:06x}]"
|
||||
current_idx += 2
|
||||
processed_vals = []
|
||||
for i in range(12):
|
||||
processed_vals.append(
|
||||
struct.unpack("!f", hk_data[current_idx : current_idx + 4])[0]
|
||||
)
|
||||
current_idx += 4
|
||||
temp = struct.unpack("!f", hk_data[current_idx : current_idx + 4])[0]
|
||||
current_idx += 4
|
||||
pw.dlog(f"Temperature: {temp} C")
|
||||
pw.dlog(ch_print)
|
||||
for i in range(12):
|
||||
pw.dlog(f"{ADC_CHANNELS_NAMED[i].ljust(24)} | {processed_vals[i]}")
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=3)
|
@ -1,4 +1,5 @@
|
||||
import enum
|
||||
import logging
|
||||
|
||||
from eive_tmtc.tmtc.power.common_power import (
|
||||
PowerOpCodes,
|
||||
@ -27,7 +28,6 @@ from eive_tmtc.tmtc.power.pdu2 import (
|
||||
pdu2_switch_cmds,
|
||||
add_pdu2_cmds,
|
||||
)
|
||||
from tmtccmd import get_console_logger
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
|
||||
from eive_tmtc.tmtc.power.p60dock import P60OpCode, P60Info, p60_dock_req_hk_cmds
|
||||
@ -37,9 +37,6 @@ from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
SWITCHER_SET = 0
|
||||
|
||||
@ -84,7 +81,9 @@ def pack_power_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
)
|
||||
)
|
||||
if q.empty():
|
||||
LOGGER.info(f"Queue is empty, no stack for op code {op_code}")
|
||||
logging.getLogger(__name__).info(
|
||||
f"Queue is empty, no stack for op code {op_code}"
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
|
@ -5,6 +5,7 @@
|
||||
@author J. Meier
|
||||
@date 15.02.2021
|
||||
"""
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
@ -18,9 +19,6 @@ from tmtccmd.config.tmtc import (
|
||||
from tmtccmd.tc import service_provider, DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd import get_console_logger
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class OpCode:
|
||||
@ -90,7 +88,7 @@ def pack_solar_array_deployment_test_into(p: ServiceProviderParams):
|
||||
def prompt_burn_time() -> int:
|
||||
burn_time = int(input("Please specify burn time in seconds [0-120 secs]: "))
|
||||
if burn_time < 0 or burn_time > 120:
|
||||
LOGGER.warning(f"Invalid burn time {burn_time}")
|
||||
logging.getLogger(__name__).warning(f"Invalid burn time {burn_time}")
|
||||
return -1
|
||||
return burn_time
|
||||
|
||||
@ -102,7 +100,7 @@ def prompt_dry_run() -> int:
|
||||
elif dry_run in ["no", "n", "0"]:
|
||||
return 0
|
||||
else:
|
||||
LOGGER.warning("Invalid input for dry run parameter")
|
||||
logging.getLogger(__name__).warning("Invalid input for dry run parameter")
|
||||
return -1
|
||||
|
||||
|
||||
|
1
eive_tmtc/tmtc/tcs/__init__.py
Normal file
1
eive_tmtc/tmtc/tcs/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .tm import * # noqa
|
57
eive_tmtc/tmtc/tcs/brd_assy.py
Normal file
57
eive_tmtc/tmtc/tcs/brd_assy.py
Normal file
@ -0,0 +1,57 @@
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import TCS_BOARD_ASS_ID
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
|
||||
|
||||
class InfoAssy:
|
||||
TCS_BOARD_ASS_NORMAL = "Switching TCS board assembly on"
|
||||
TCS_BOARD_ASS_OFF = "Switching TCS board assembly off"
|
||||
|
||||
|
||||
class OpCodeAssy:
|
||||
TCS_BOARD_ASS_NORMAL = ["nml"]
|
||||
TCS_BOARD_ASS_OFF = ["off"]
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_tcs_assy_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(
|
||||
keys=OpCodeAssy.TCS_BOARD_ASS_NORMAL,
|
||||
info=InfoAssy.TCS_BOARD_ASS_NORMAL,
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodeAssy.TCS_BOARD_ASS_OFF,
|
||||
info=InfoAssy.TCS_BOARD_ASS_OFF,
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.TCS_ASS.value,
|
||||
info="TCS Board Assembly",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
||||
|
||||
def pack_tcs_ass_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCodeAssy.TCS_BOARD_ASS_NORMAL:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=TCS_BOARD_ASS_ID,
|
||||
mode=Mode.NORMAL,
|
||||
submode=0,
|
||||
q=q,
|
||||
info=InfoAssy.TCS_BOARD_ASS_NORMAL,
|
||||
)
|
||||
if op_code in OpCodeAssy.TCS_BOARD_ASS_OFF:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=TCS_BOARD_ASS_ID,
|
||||
mode=Mode.OFF,
|
||||
submode=0,
|
||||
q=q,
|
||||
info=InfoAssy.TCS_BOARD_ASS_OFF,
|
||||
)
|
7
eive_tmtc/tmtc/tcs/defs.py
Normal file
7
eive_tmtc/tmtc/tcs/defs.py
Normal file
@ -0,0 +1,7 @@
|
||||
import enum
|
||||
|
||||
|
||||
class CtrlSetId(enum.IntEnum):
|
||||
PRIMARY_SENSORS = 0
|
||||
DEVICE_SENSORS = 1
|
||||
SUS_TEMP_SENSORS = 2
|
@ -20,7 +20,7 @@ from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
|
||||
|
||||
class SwitchNumber(enum.IntEnum):
|
||||
class Heater(enum.IntEnum):
|
||||
HEATER_0_OBC_BRD = 0
|
||||
HEATER_1_PLOC_PROC_BRD = 1
|
||||
HEATER_2_ACS_BRD = 2
|
||||
@ -33,10 +33,10 @@ class SwitchNumber(enum.IntEnum):
|
||||
|
||||
|
||||
class OpCode:
|
||||
HEATER_CMD = ["0", "switch-cmd"]
|
||||
HEATER_EXT_CTRL = ["1", "set-ext-ctrl"]
|
||||
HEATER_FAULTY_CMD = ["2", "set-faulty"]
|
||||
HEATER_HEALTHY_CMD = ["3", "set-healthy"]
|
||||
HEATER_CMD = ["switch_cmd"]
|
||||
HEATER_EXT_CTRL = ["set_ext_ctrl"]
|
||||
HEATER_FAULTY_CMD = ["set_faulty"]
|
||||
HEATER_HEALTHY_CMD = ["set_healthy"]
|
||||
|
||||
|
||||
class Info:
|
||||
@ -165,7 +165,7 @@ def prompt_heater() -> int:
|
||||
print("Heater number not a digit")
|
||||
continue
|
||||
heater_number = int(heater_number)
|
||||
if heater_number >= SwitchNumber.NUMBER_OF_SWITCHES or heater_number < 0:
|
||||
if heater_number >= Heater.NUMBER_OF_SWITCHES or heater_number < 0:
|
||||
print("Invalid heater switch number")
|
||||
continue
|
||||
break
|
@ -2,14 +2,13 @@ from typing import Optional
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tc.devs.pdec_handler import CommandId
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Mode, pack_mode_data, Subservice
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data, Subservice
|
||||
import eive_tmtc.config.object_ids as oids
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
|
74
eive_tmtc/tmtc/tcs/subsystem.py
Normal file
74
eive_tmtc/tmtc/tcs/subsystem.py
Normal file
@ -0,0 +1,74 @@
|
||||
from .defs import CtrlSetId
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import TCS_CONTROLLER, TCS_SUBSYSTEM_ID
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
from eive_tmtc.tmtc.tcs.brd_assy import pack_tcs_ass_cmds
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
||||
|
||||
|
||||
class OpCodeSys:
|
||||
OFF = ["off"]
|
||||
NML = ["nml"]
|
||||
REQUEST_PRIMARY_TEMP_SET = ["temp"]
|
||||
REQUEST_DEVICE_TEMP_SET = ["temp_devs"]
|
||||
REQUEST_DEVICE_SUS_SET = ["temp_sus"]
|
||||
|
||||
|
||||
class InfoSys:
|
||||
OFF = "Switch TCS subsystem OFF"
|
||||
NML = "Switch TCS subsystem NORMAL (nominal)"
|
||||
REQUEST_PRIMARY_TEMP_SET = "Request HK set of primary sensor temperatures"
|
||||
REQUEST_DEVICE_TEMP_SET = "Request HK set of device sensor temperatures"
|
||||
REQUEST_DEVICE_SUS_SET = "Request HK set of the SUS temperatures"
|
||||
|
||||
|
||||
def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCodeSys.REQUEST_PRIMARY_TEMP_SET:
|
||||
sensor_set_sid = make_sid(TCS_CONTROLLER, CtrlSetId.PRIMARY_SENSORS)
|
||||
q.add_log_cmd(InfoSys.REQUEST_PRIMARY_TEMP_SET)
|
||||
q.add_pus_tc(generate_one_hk_command(sensor_set_sid))
|
||||
if op_code in OpCodeSys.REQUEST_DEVICE_TEMP_SET:
|
||||
q.add_log_cmd(InfoSys.REQUEST_DEVICE_TEMP_SET)
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(make_sid(TCS_CONTROLLER, CtrlSetId.DEVICE_SENSORS))
|
||||
)
|
||||
if op_code in OpCodeSys.REQUEST_DEVICE_SUS_SET:
|
||||
q.add_log_cmd(InfoSys.REQUEST_DEVICE_SUS_SET)
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(
|
||||
make_sid(TCS_CONTROLLER, CtrlSetId.SUS_TEMP_SENSORS)
|
||||
)
|
||||
)
|
||||
if op_code in OpCodeSys.OFF:
|
||||
q.add_log_cmd(InfoSys.OFF)
|
||||
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.OFF, 0, q, InfoSys.OFF)
|
||||
if op_code in OpCodeSys.NML:
|
||||
q.add_log_cmd(InfoSys.NML)
|
||||
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.NORMAL, 0, q, InfoSys.OFF)
|
||||
pack_tcs_ass_cmds(q, op_code)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_tcs_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodeSys.OFF, info=InfoSys.OFF)
|
||||
oce.add(keys=OpCodeSys.NML, info=InfoSys.NML)
|
||||
oce.add(
|
||||
keys=OpCodeSys.REQUEST_PRIMARY_TEMP_SET, info=InfoSys.REQUEST_PRIMARY_TEMP_SET
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodeSys.REQUEST_DEVICE_TEMP_SET, info=InfoSys.REQUEST_DEVICE_TEMP_SET
|
||||
)
|
||||
oce.add(keys=OpCodeSys.REQUEST_DEVICE_SUS_SET, info=InfoSys.REQUEST_DEVICE_SUS_SET)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.TCS,
|
||||
info="TCS Board",
|
||||
op_code_entry=oce,
|
||||
)
|
@ -1,135 +1,10 @@
|
||||
import enum
|
||||
import pprint
|
||||
import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Mode
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
make_sid,
|
||||
generate_one_hk_command,
|
||||
)
|
||||
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
from eive_tmtc.config.object_ids import (
|
||||
TCS_BOARD_ASS_ID,
|
||||
TCS_CONTROLLER,
|
||||
TCS_SUBSYSTEM_ID,
|
||||
)
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
|
||||
class OpCodeAssy:
|
||||
TCS_BOARD_ASS_NORMAL = ["nml"]
|
||||
TCS_BOARD_ASS_OFF = ["off"]
|
||||
|
||||
|
||||
class OpCodeSys:
|
||||
OFF = ["off"]
|
||||
NML = ["nml"]
|
||||
REQUEST_PRIMARY_TEMP_SET = ["temp"]
|
||||
REQUEST_DEVICE_TEMP_SET = ["temp_devs"]
|
||||
REQUEST_DEVICE_SUS_SET = ["temp_sus"]
|
||||
|
||||
|
||||
class InfoSys:
|
||||
OFF = "Switch TCS subsystem OFF"
|
||||
NML = "Switch TCS subsystem NORMAL (nominal)"
|
||||
REQUEST_PRIMARY_TEMP_SET = "Request HK set of primary sensor temperatures"
|
||||
REQUEST_DEVICE_TEMP_SET = "Request HK set of device sensor temperatures"
|
||||
REQUEST_DEVICE_SUS_SET = "Request HK set of the SUS temperatures"
|
||||
|
||||
|
||||
class InfoAssy:
|
||||
TCS_BOARD_ASS_NORMAL = "Switching TCS board assembly on"
|
||||
TCS_BOARD_ASS_OFF = "Switching TCS board assembly off"
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
PRIMARY_SENSORS = 0
|
||||
DEVICE_SENSORS = 1
|
||||
SUS_TEMP_SENSORS = 2
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_tcs_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(
|
||||
keys=OpCodeAssy.TCS_BOARD_ASS_NORMAL,
|
||||
info=InfoAssy.TCS_BOARD_ASS_NORMAL,
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodeAssy.TCS_BOARD_ASS_OFF,
|
||||
info=InfoAssy.TCS_BOARD_ASS_OFF,
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.TCS_ASS.value,
|
||||
info="TCS Board Assembly",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodeSys.OFF, info=InfoSys.OFF)
|
||||
oce.add(keys=OpCodeSys.NML, info=InfoSys.NML)
|
||||
oce.add(
|
||||
keys=OpCodeSys.REQUEST_PRIMARY_TEMP_SET, info=InfoSys.REQUEST_PRIMARY_TEMP_SET
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodeSys.REQUEST_DEVICE_TEMP_SET, info=InfoSys.REQUEST_DEVICE_TEMP_SET
|
||||
)
|
||||
oce.add(keys=OpCodeSys.REQUEST_DEVICE_SUS_SET, info=InfoSys.REQUEST_DEVICE_SUS_SET)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.TCS,
|
||||
info="TCS Board",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
||||
|
||||
def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCodeSys.REQUEST_PRIMARY_TEMP_SET:
|
||||
sensor_set_sid = make_sid(TCS_CONTROLLER, SetId.PRIMARY_SENSORS)
|
||||
q.add_log_cmd(InfoSys.REQUEST_PRIMARY_TEMP_SET)
|
||||
q.add_pus_tc(generate_one_hk_command(sensor_set_sid))
|
||||
if op_code in OpCodeSys.REQUEST_DEVICE_TEMP_SET:
|
||||
q.add_log_cmd(InfoSys.REQUEST_DEVICE_TEMP_SET)
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(make_sid(TCS_CONTROLLER, SetId.DEVICE_SENSORS))
|
||||
)
|
||||
if op_code in OpCodeSys.REQUEST_DEVICE_SUS_SET:
|
||||
q.add_log_cmd(InfoSys.REQUEST_DEVICE_SUS_SET)
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(make_sid(TCS_CONTROLLER, SetId.SUS_TEMP_SENSORS))
|
||||
)
|
||||
if op_code in OpCodeSys.OFF:
|
||||
q.add_log_cmd(InfoSys.OFF)
|
||||
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.OFF, 0, q, InfoSys.OFF)
|
||||
if op_code in OpCodeSys.NML:
|
||||
q.add_log_cmd(InfoSys.NML)
|
||||
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.NORMAL, 0, q, InfoSys.OFF)
|
||||
pack_tcs_ass_cmds(q, op_code)
|
||||
|
||||
|
||||
def pack_tcs_ass_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCodeAssy.TCS_BOARD_ASS_NORMAL:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=TCS_BOARD_ASS_ID,
|
||||
mode=Mode.NORMAL,
|
||||
submode=0,
|
||||
q=q,
|
||||
info=InfoAssy.TCS_BOARD_ASS_NORMAL,
|
||||
)
|
||||
if op_code in OpCodeAssy.TCS_BOARD_ASS_OFF:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=TCS_BOARD_ASS_ID,
|
||||
mode=Mode.OFF,
|
||||
submode=0,
|
||||
q=q,
|
||||
info=InfoAssy.TCS_BOARD_ASS_OFF,
|
||||
)
|
||||
from .defs import CtrlSetId
|
||||
|
||||
|
||||
def handle_thermal_controller_hk_data(
|
||||
@ -142,7 +17,7 @@ def handle_thermal_controller_hk_data(
|
||||
if TCP_TEMP_DEV_SERVER:
|
||||
TCP_TEMP_DEV_SERVER = TmTcpServer("localhost", 7306)
|
||||
"""
|
||||
if set_id == SetId.PRIMARY_SENSORS:
|
||||
if set_id == CtrlSetId.PRIMARY_SENSORS:
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog("Received sensor temperature data")
|
||||
|
||||
@ -174,7 +49,7 @@ def handle_thermal_controller_hk_data(
|
||||
printer.file_logger.info(str(parsed_data))
|
||||
pp = pprint.PrettyPrinter(depth=4)
|
||||
pp.pprint(parsed_data)
|
||||
elif set_id == SetId.DEVICE_SENSORS:
|
||||
elif set_id == CtrlSetId.DEVICE_SENSORS:
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog("Received device temperature data")
|
||||
fmt_str = "!fhhhhiiiifffhffffffffffffff"
|
||||
@ -211,7 +86,7 @@ def handle_thermal_controller_hk_data(
|
||||
printer.file_logger.info(str(parsed_data))
|
||||
pp = pprint.PrettyPrinter(depth=4)
|
||||
pp.pprint(parsed_data)
|
||||
elif set_id == SetId.SUS_TEMP_SENSORS:
|
||||
elif set_id == CtrlSetId.SUS_TEMP_SENSORS:
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog("Received SUS temperature data")
|
||||
fmt_str = "!ffffffffffffffffff"
|
78
eive_tmtc/tmtc/tcs/tmp1075.py
Normal file
78
eive_tmtc/tmtc/tcs/tmp1075.py
Normal file
@ -0,0 +1,78 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file tmp1075.py
|
||||
@brief TMP1075 tests
|
||||
@author J. Meier
|
||||
@date 06.01.2021
|
||||
"""
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import create_request_one_hk_command, make_sid
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class OpCode:
|
||||
OFF = "off"
|
||||
ON = "on"
|
||||
NML = "nml"
|
||||
HK = "hk"
|
||||
|
||||
|
||||
class Info:
|
||||
OFF = "Off"
|
||||
ON = "On"
|
||||
NML = "Normal"
|
||||
HK = "HK"
|
||||
|
||||
|
||||
class Tmp1075ActionId(enum.IntEnum):
|
||||
GET_TEMP = 1
|
||||
START_ADC_CONV = 2
|
||||
|
||||
|
||||
class SetId:
|
||||
TMEPERATURE = 1
|
||||
|
||||
|
||||
def pack_tmp1075_test_into(
|
||||
object_id: ObjectIdU32, op_code: str, q: DefaultPusQueueHelper
|
||||
):
|
||||
q.add_log_cmd(
|
||||
f"Testing Tmp1075 Temperature Sensor Handler with object id: {object_id}"
|
||||
)
|
||||
obyt = object_id.as_bytes
|
||||
if op_code == OpCode.OFF:
|
||||
q.add_log_cmd("TMP1075: Set Normal Off")
|
||||
mode_data = pack_mode_data(obyt, Mode.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
if op_code == OpCode.NML:
|
||||
q.add_log_cmd("TMP1075: Set Mode Normal")
|
||||
mode_data = pack_mode_data(obyt, Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
if op_code == OpCode.ON:
|
||||
q.add_log_cmd("TMP1075: Set Mode On")
|
||||
mode_data = pack_mode_data(obyt, Mode.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
if op_code == OpCode.HK:
|
||||
q.add_log_cmd("TMP1075: Request One-Shot HK")
|
||||
q.add_pus_tc(create_request_one_hk_command(make_sid(obyt, SetId.TMEPERATURE)))
|
||||
return q
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_tmp_sens_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.OFF, Info.OFF)
|
||||
oce.add(OpCode.ON, Info.ON)
|
||||
oce.add(OpCode.NML, Info.NML)
|
||||
oce.add(OpCode.HK, Info.HK)
|
||||
defs.add_service(CustomServiceList.TMP1075.value, "TMP1075 Temperature Sensor", oce)
|
71
eive_tmtc/tmtc/time.py
Normal file
71
eive_tmtc/tmtc/time.py
Normal file
@ -0,0 +1,71 @@
|
||||
import enum
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from spacepackets.ecss import PusTelecommand, PusService
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
|
||||
|
||||
class Subservice(enum.IntEnum):
|
||||
SET_TIME = 128
|
||||
DUMP_TIME = 129
|
||||
|
||||
|
||||
class OpCode:
|
||||
SET_CURRENT_TIME = ["set_curr_time"]
|
||||
DUMP_TIME = ["dump_time"]
|
||||
|
||||
|
||||
class Info:
|
||||
SET_CURRENT_TIME = "Setting current time in ASCII format"
|
||||
DUMP_TIME = "Dump system time as event"
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.TIME.value)
|
||||
def pack_set_current_time_ascii_command(p: ServiceProviderParams):
|
||||
q = p.queue_helper
|
||||
o = p.op_code
|
||||
if o in OpCode.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}"
|
||||
)
|
||||
q.add_log_cmd(Info.SET_CURRENT_TIME)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=PusService.S9_TIME_MGMT,
|
||||
subservice=Subservice.SET_TIME,
|
||||
app_data=current_time_ascii,
|
||||
)
|
||||
)
|
||||
elif o in OpCode.DUMP_TIME:
|
||||
q.add_log_cmd(Info.DUMP_TIME)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=PusService.S9_TIME_MGMT, subservice=Subservice.DUMP_TIME
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_time_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(
|
||||
keys=OpCode.SET_CURRENT_TIME,
|
||||
info=Info.SET_CURRENT_TIME,
|
||||
)
|
||||
oce.add(keys=OpCode.DUMP_TIME, info=Info.DUMP_TIME)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.TIME.value,
|
||||
info="Time Service",
|
||||
op_code_entry=oce,
|
||||
)
|
@ -5,14 +5,14 @@
|
||||
@author J. Meier
|
||||
@date 13.02.2021
|
||||
"""
|
||||
import logging
|
||||
from typing import Tuple, Dict
|
||||
|
||||
from tmtccmd.logging import get_console_logger
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class InputHelper:
|
||||
def __init__(self, menu: dict):
|
||||
def __init__(self, menu: Dict[str, Tuple[str, ...]]):
|
||||
"""
|
||||
@brief Constructor
|
||||
@param menu The menu describing the input options
|
||||
@ -25,7 +25,7 @@ class InputHelper:
|
||||
"""
|
||||
key = self.menu_handler()
|
||||
while key not in self.menu:
|
||||
LOGGER.info("Invalid key specified, try again.")
|
||||
_LOGGER.info("Invalid key specified, try again.")
|
||||
key = self.menu_handler()
|
||||
return key
|
||||
|
||||
@ -36,11 +36,11 @@ class InputHelper:
|
||||
separator_string = separator_width * "-"
|
||||
key_string = "Key".ljust(key_column_width)
|
||||
description_string = "Description".ljust(description_column_width)
|
||||
LOGGER.info(f"{key_string} | {description_string}")
|
||||
LOGGER.info(separator_string)
|
||||
_LOGGER.info(f"{key_string} | {description_string}")
|
||||
_LOGGER.info(separator_string)
|
||||
for key in self.menu:
|
||||
key_string = key.ljust(key_column_width)
|
||||
description_string = self.menu[key][0].ljust(description_column_width)
|
||||
LOGGER.info(f"{key_string} | {description_string}")
|
||||
_LOGGER.info(f"{key_string} | {description_string}")
|
||||
key = input("Specify key: ")
|
||||
return key
|
||||
|
@ -27,8 +27,8 @@ classifiers =
|
||||
|
||||
[options]
|
||||
install_requires =
|
||||
# tmtccmd @ git+https://github.com/robamu-org/tmtccmd@v4.0.0a2
|
||||
tmtccmd @ git+https://github.com/robamu-org/tmtccmd@c978286a856a2f3a59efc96887dd15c2c17bac6e#egg=tmtccmd
|
||||
tmtccmd @ git+https://github.com/robamu-org/tmtccmd@v4.0.0rc0
|
||||
# tmtccmd @ git+https://github.com/robamu-org/tmtccmd@<gitRev>#egg=tmtccmd
|
||||
packages = find:
|
||||
python_requires = >=3.10
|
||||
include_package_data = True
|
||||
|
70
tmtcc.py
70
tmtcc.py
@ -6,7 +6,6 @@ import traceback
|
||||
from pathlib import Path
|
||||
from typing import cast
|
||||
|
||||
from spacepackets import SpacePacketHeader, SpacePacket
|
||||
from spacepackets.ccsds import SPACE_PACKET_HEADER_SIZE
|
||||
from spacepackets.cfdp import (
|
||||
ConditionCode,
|
||||
@ -17,6 +16,7 @@ from spacepackets.cfdp import (
|
||||
PduFactory,
|
||||
PduType,
|
||||
)
|
||||
from tmtccmd.logging import add_colorlog_console_logger
|
||||
from tmtccmd.cfdp import CfdpUserBase, TransactionId
|
||||
from tmtccmd.cfdp.defs import CfdpRequestType
|
||||
from tmtccmd.cfdp.handler import CfdpInCcsdsHandler
|
||||
@ -54,7 +54,7 @@ except ImportError as error:
|
||||
sys.exit(1)
|
||||
|
||||
from spacepackets.ecss import PusVerificator
|
||||
from tmtccmd import get_console_logger, TcHandlerBase, BackendBase
|
||||
from tmtccmd import TcHandlerBase, BackendBase
|
||||
from tmtccmd.util import FileSeqCountProvider, PusFileSeqCountProvider
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
@ -73,6 +73,7 @@ from tmtccmd.tc import (
|
||||
TcProcedureType,
|
||||
TcQueueEntryType,
|
||||
DefaultPusQueueHelper,
|
||||
QueueWrapper,
|
||||
)
|
||||
from tmtccmd.config import (
|
||||
default_json_path,
|
||||
@ -84,6 +85,7 @@ from tmtccmd.config.args import (
|
||||
PreArgsParsingWrapper,
|
||||
ProcedureParamsWrapper,
|
||||
)
|
||||
from eive_tmtc import APP_LOGGER
|
||||
from eive_tmtc import __version__
|
||||
from eive_tmtc.config.definitions import (
|
||||
PUS_APID,
|
||||
@ -95,7 +97,7 @@ from eive_tmtc.config.hook import EiveHookObject
|
||||
from eive_tmtc.pus_tm.factory_hook import pus_factory_hook
|
||||
from eive_tmtc.pus_tc.procedure_packer import handle_default_procedure
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = APP_LOGGER
|
||||
|
||||
# Put rotating file logger parameters here for quick changes
|
||||
ROTATING_TIMED_LOGGER_INTERVAL_WHEN = TimedLogWhen.PER_MINUTE
|
||||
@ -118,13 +120,13 @@ class EiveCfdpFaultHandler(DefaultFaultHandlerBase):
|
||||
|
||||
class EiveCfdpUser(CfdpUserBase):
|
||||
def transaction_indication(self, transaction_id: TransactionId):
|
||||
LOGGER.info(f"CFDP User: Start of File {transaction_id}")
|
||||
_LOGGER.info(f"CFDP User: Start of File {transaction_id}")
|
||||
|
||||
def eof_sent_indication(self, transaction_id: TransactionId):
|
||||
LOGGER.info(f"CFDP User: EOF sent for {transaction_id}")
|
||||
_LOGGER.info(f"CFDP User: EOF sent for {transaction_id}")
|
||||
|
||||
def transaction_finished_indication(self, params: TransactionFinishedParams):
|
||||
LOGGER.info(f"CFDP User: {params.transaction_id} finished")
|
||||
_LOGGER.info(f"CFDP User: {params.transaction_id} finished")
|
||||
|
||||
def metadata_recv_indication(self, params: MetadataRecvParams):
|
||||
pass
|
||||
@ -177,7 +179,7 @@ class PusHandler(SpecificApidHandlerBase):
|
||||
|
||||
class UnknownApidHandler(GenericApidHandlerBase):
|
||||
def handle_tm(self, apid: int, _packet: bytes, _user_args: any):
|
||||
LOGGER.warning(f"Packet with unknwon APID {apid} detected")
|
||||
_LOGGER.warning(f"Packet with unknwon APID {apid} detected")
|
||||
|
||||
|
||||
class CfdpInCcsdsWrapper(SpecificApidHandlerBase):
|
||||
@ -191,12 +193,12 @@ class CfdpInCcsdsWrapper(SpecificApidHandlerBase):
|
||||
pdu = packet[SPACE_PACKET_HEADER_SIZE:]
|
||||
pdu_base = PduFactory.from_raw(pdu)
|
||||
if pdu_base.pdu_type == PduType.FILE_DATA:
|
||||
LOGGER.info("Received File Data PDU TM")
|
||||
_LOGGER.info("Received File Data PDU TM")
|
||||
else:
|
||||
if pdu_base.directive_type == DirectiveType.FINISHED_PDU:
|
||||
LOGGER.info(f"Received Finished PDU TM")
|
||||
_LOGGER.info(f"Received Finished PDU TM")
|
||||
else:
|
||||
LOGGER.info(
|
||||
_LOGGER.info(
|
||||
f"Received File Directive PDU with type {pdu_base.directive_type!r} TM"
|
||||
)
|
||||
self.handler.pass_pdu_packet(pdu_base)
|
||||
@ -221,10 +223,11 @@ class TcHandler(TcHandlerBase):
|
||||
self.pus_raw_logger = raw_pus_logger
|
||||
self.gui = gui
|
||||
self.queue_helper = DefaultPusQueueHelper(
|
||||
queue_wrapper=None,
|
||||
pus_apid=PUS_APID,
|
||||
queue_wrapper=QueueWrapper.empty(),
|
||||
default_pus_apid=PUS_APID,
|
||||
seq_cnt_provider=seq_count_provider,
|
||||
pus_verificator=pus_verificator,
|
||||
tc_sched_timestamp_len=4,
|
||||
)
|
||||
self.cfdp_in_ccsds_wrapper = cfdp_in_ccsds_wrapper
|
||||
|
||||
@ -247,16 +250,11 @@ class TcHandler(TcHandlerBase):
|
||||
if entry_helper.is_tc:
|
||||
if entry_helper.entry_type == TcQueueEntryType.PUS_TC:
|
||||
pus_tc_wrapper = entry_helper.to_pus_tc_entry()
|
||||
pus_tc_wrapper.pus_tc.seq_count = (
|
||||
self.seq_count_provider.get_and_increment()
|
||||
)
|
||||
pus_tc_wrapper.pus_tc.apid = PUS_APID
|
||||
# Add TC after Sequence Count stamping
|
||||
self.pus_verificator.add_tc(pus_tc_wrapper.pus_tc)
|
||||
# pus_tc_wrapper.pus_tc.apid = PUS_APID
|
||||
raw_tc = pus_tc_wrapper.pus_tc.pack()
|
||||
self.pus_raw_logger.log_tc(pus_tc_wrapper.pus_tc)
|
||||
tc_info_string = f"Sent {pus_tc_wrapper.pus_tc}"
|
||||
LOGGER.info(tc_info_string)
|
||||
_LOGGER.info(tc_info_string)
|
||||
self.high_level_file_logger.info(
|
||||
f"{get_current_time_string(True)}: {tc_info_string}"
|
||||
)
|
||||
@ -276,7 +274,7 @@ class TcHandler(TcHandlerBase):
|
||||
# self.cfdp_counter += 1
|
||||
elif entry_helper.entry_type == TcQueueEntryType.LOG:
|
||||
log_entry = entry_helper.to_log_entry()
|
||||
LOGGER.info(log_entry.log_str)
|
||||
_LOGGER.info(log_entry.log_str)
|
||||
self.high_level_file_logger.info(log_entry.log_str)
|
||||
|
||||
def handle_cfdp_procedure(self, info: ProcedureWrapper):
|
||||
@ -288,7 +286,7 @@ class TcHandler(TcHandlerBase):
|
||||
):
|
||||
put_req = cfdp_procedure.request_wrapper.to_put_request()
|
||||
put_req.cfg.destination_id = self.cfdp_dest_id
|
||||
LOGGER.info(
|
||||
_LOGGER.info(
|
||||
f"CFDP: Starting file put request with parameters:\n{put_req}"
|
||||
)
|
||||
self.cfdp_in_ccsds_wrapper.handler.cfdp_handler.put_request(put_req)
|
||||
@ -322,31 +320,33 @@ class TcHandler(TcHandlerBase):
|
||||
if info is not None:
|
||||
if info.proc_type == TcQueueEntryType.PUS_TC:
|
||||
def_proc = info.to_def_procedure()
|
||||
LOGGER.info(
|
||||
_LOGGER.info(
|
||||
f"Finished queue for service {def_proc.service} and op code {def_proc.op_code}"
|
||||
)
|
||||
elif info.proc_type == TcProcedureType.CFDP:
|
||||
LOGGER.info(f"Finished CFDP queue")
|
||||
_LOGGER.info(f"Finished CFDP queue")
|
||||
|
||||
|
||||
def setup_params() -> SetupWrapper:
|
||||
print(f"-- eive tmtc v{__version__} --")
|
||||
print(f"-- spacepackets v{spacepackets.__version__} --")
|
||||
hook_obj = EiveHookObject(default_json_path())
|
||||
params = SetupParams()
|
||||
parser_wrapper = PreArgsParsingWrapper()
|
||||
parser_wrapper.create_default_parent_parser()
|
||||
parser_wrapper.create_default_parser()
|
||||
parser_wrapper.add_def_proc_and_cfdp_as_subparsers()
|
||||
post_arg_parsing_wrapper = parser_wrapper.parse(hook_obj)
|
||||
post_arg_parsing_wrapper = parser_wrapper.parse(
|
||||
setup_params=params, hook_obj=hook_obj
|
||||
)
|
||||
tmtccmd.init_printout(post_arg_parsing_wrapper.use_gui)
|
||||
use_prompts = not post_arg_parsing_wrapper.use_gui
|
||||
proc_param_wrapper = ProcedureParamsWrapper()
|
||||
if use_prompts:
|
||||
post_arg_parsing_wrapper.set_params_with_prompts(params, proc_param_wrapper)
|
||||
post_arg_parsing_wrapper.set_params_with_prompts(proc_param_wrapper)
|
||||
else:
|
||||
post_arg_parsing_wrapper.set_params_without_prompts(params, proc_param_wrapper)
|
||||
post_arg_parsing_wrapper.set_params_without_prompts(proc_param_wrapper)
|
||||
params.apid = PUS_APID
|
||||
if params.com_if is None:
|
||||
raise ValueError("could not determine a COM interface.")
|
||||
setup_wrapper = SetupWrapper(
|
||||
hook_obj=hook_obj, setup_params=params, proc_param_wrapper=proc_param_wrapper
|
||||
)
|
||||
@ -394,7 +394,9 @@ def setup_tmtc_handlers(
|
||||
gui: bool,
|
||||
) -> (CcsdsTmHandler, TcHandler):
|
||||
cfdp_in_ccsds_wrapper = setup_cfdp_handler()
|
||||
verification_wrapper = VerificationWrapper(verificator, LOGGER, printer.file_logger)
|
||||
verification_wrapper = VerificationWrapper(
|
||||
verificator, _LOGGER, printer.file_logger
|
||||
)
|
||||
pus_handler = PusHandler(verification_wrapper, printer, raw_logger)
|
||||
ccsds_handler = CcsdsTmHandler(generic_handler=UnknownApidHandler(None))
|
||||
ccsds_handler.add_apid_handler(pus_handler)
|
||||
@ -428,11 +430,15 @@ def setup_backend(
|
||||
|
||||
|
||||
def main():
|
||||
print(f"-- eive tmtc v{__version__} --")
|
||||
print(f"-- spacepackets v{spacepackets.__version__} --")
|
||||
add_colorlog_console_logger(_LOGGER)
|
||||
try:
|
||||
setup_wrapper = setup_params()
|
||||
except KeyboardInterrupt as e:
|
||||
LOGGER.info(f"{e}. Exiting")
|
||||
_LOGGER.info(f"{e}. Exiting")
|
||||
sys.exit(0)
|
||||
|
||||
tmtc_logger = RegularTmtcLogWrapper()
|
||||
printer = FsfwTmTcPrinter(tmtc_logger.logger)
|
||||
raw_logger = RawTmtcTimedLogWrapper(
|
||||
@ -455,11 +461,11 @@ def main():
|
||||
if state.request == BackendRequest.TERMINATION_NO_ERROR:
|
||||
sys.exit(0)
|
||||
elif state.request == BackendRequest.DELAY_IDLE:
|
||||
LOGGER.info("TMTC Client in IDLE mode")
|
||||
_LOGGER.info("TMTC Client in IDLE mode")
|
||||
time.sleep(3.0)
|
||||
elif state.request == BackendRequest.DELAY_LISTENER:
|
||||
if tc_handler.cfdp_done():
|
||||
LOGGER.info("CFDP transaction done, closing client")
|
||||
_LOGGER.info("CFDP transaction done, closing client")
|
||||
sys.exit(0)
|
||||
time.sleep(0.5)
|
||||
elif state.request == BackendRequest.DELAY_CUSTOM:
|
||||
|
Reference in New Issue
Block a user