Compare commits

...

61 Commits

Author SHA1 Message Date
muellerr d652c4663b and a new patch release 2023-01-12 17:12:16 +01:00
muellerr 677a0d70cc well this is annoying 2023-01-12 17:11:16 +01:00
muellerr 0390995773 small changelog bump 2023-01-12 16:21:47 +01:00
muellerr bb66d15d1f bump changelog 2023-01-12 16:19:14 +01:00
muellerr 1be338b272 bump eive-tmtc to v2.1.0 2023-01-12 16:17:14 +01:00
muellerr 5f3180dbc8 bump tmtccmd 2023-01-12 15:48:49 +01:00
muellerr b018784a11 use v4.0.0 alpha release 2023-01-12 14:19:08 +01:00
muellerr 7c5f21e83c that should be all required API 2023-01-12 14:18:18 +01:00
muellerr 9d42005816 Merge branch 'main' of https://egit.irs.uni-stuttgart.de/eive/eive-tmtc 2023-01-12 14:11:59 +01:00
muellerr ecae444ee3 some refactoring for PCDU cmds 2023-01-12 14:11:30 +01:00
muellerr a994e87f8a update changelog 2023-01-12 08:57:27 +01:00
muellerr 87607aa681 small refactoring 2023-01-11 14:28:45 +01:00
muellerr 7d2c639f01 small refactoring 2023-01-11 14:23:03 +01:00
muellerr d48e86f5fe unify core module 2023-01-11 14:19:47 +01:00
muellerr efa778c0e8 Merge branch 'main' of https://egit.irs.uni-stuttgart.de/eive/eive-tmtc 2023-01-11 14:17:02 +01:00
muellerr 1de02aab77 move core module 2023-01-11 14:16:52 +01:00
muellerr b032defa7c bump changelog 2023-01-10 15:39:55 +01:00
muellerr ef6a1bb263 make it easier to add seq files 2023-01-10 15:37:15 +01:00
muellerr 40831064d6 update seq file dict 2023-01-10 15:27:45 +01:00
muellerr dcd881bc14 bump changelog 2023-01-10 14:03:32 +01:00
muellerr ee2c4bb4c3 add reboot cmds for PCDU modules 2023-01-10 14:03:10 +01:00
muellerr c4dbf3d8be improve syrlinks commanding a bit 2023-01-10 10:27:00 +01:00
muellerr a7326b95c4 improve ploc mpsoc commanding 2023-01-10 09:56:18 +01:00
muellerr 5c675560ea minor fixes 2022-12-23 11:00:19 +01:00
muellerr 825a1972c4 implement PLOC SUPV fac reset cmd 2022-12-23 10:17:44 +01:00
muellerr 20c2f61555 update fac reset cmd 2022-12-23 10:12:30 +01:00
muellerr 00991b92f1 re-run black 2022-12-21 16:07:49 +01:00
meggert 6385a4a7db init 2022-12-21 15:15:55 +01:00
muellerr 383b32141c seq count filename correction 2022-12-15 11:10:33 +01:00
muellerr 486b203534 update .gitignore 2022-12-15 11:08:26 +01:00
muellerr e060b40b4b replace submodules with install scripts 2022-12-15 11:07:03 +01:00
muellerr f02a2d402c add clone script 2022-12-15 11:05:59 +01:00
muellerr 178b624784 update README 2022-12-15 11:02:54 +01:00
muellerr a3b77d2366 bump tmtccmd 2022-12-14 17:41:18 +01:00
muellerr 724abca8f1 bump tmtccmd 2022-12-14 17:09:08 +01:00
muellerr 30cf47365f Merge pull request 'ACS CTRL Set Handling' (#120) from mueller_acs_ctrl_sets into main
Reviewed-on: #120
2022-12-12 15:24:20 +01:00
muellerr 83e5b9ebeb Merge branch 'main' into mueller_acs_ctrl_sets 2022-12-12 15:24:09 +01:00
muellerr a55572db28 tag correction 2022-12-12 14:49:05 +01:00
muellerr febf29e8a7 update requirements.txt 2022-12-12 14:46:42 +01:00
muellerr 96e27e7163 bump deps 2022-12-12 09:00:41 +01:00
mkranz 21b57ab171 Merge pull request 'Fixes csv file distribution from config' (#122) from gaisser_fix_include_csv into main
Reviewed-on: #122
2022-12-08 11:41:30 +01:00
gaisser 8c959a0b7f csv files will now be distributed by pip install 2022-12-06 20:10:32 +01:00
muellerr faf34fa6a3 p60dock op code improvements 2022-12-06 10:43:32 +01:00
muellerr 20d72a40a7 Merge branch 'main' of https://egit.irs.uni-stuttgart.de/eive/eive-tmtc 2022-12-06 10:34:45 +01:00
muellerr 5745973d3d move bpx cmd defs 2022-12-06 10:34:12 +01:00
muellerr 622dfde84e add csvs to manifest file 2022-12-06 09:34:15 +01:00
muellerr 4bf3e2e5e2 improve MPSoC commands 2022-12-06 09:21:28 +01:00
muellerr ab42ec65ff bump deps 2022-12-06 09:07:47 +01:00
muellerr d67d4b07a2 Merge pull request 'Fix for install of tmtccmd dependency' (#121) from gaisser_fix_setup into main
Reviewed-on: #121
2022-12-05 15:04:16 +01:00
gaisser 9e68425058 Fix for install of tmtccmd dependency 2022-12-05 15:02:55 +01:00
muellerr 50db0eb28d update setup.cfg 2022-12-05 11:58:59 +01:00
muellerr eee3168712 bump changelog 2022-12-02 18:03:37 +01:00
muellerr c4a444b319 extended acs ctrl HK handling 2022-12-02 18:03:10 +01:00
muellerr c256da5b07 completed handling for all sets 2022-12-02 17:53:42 +01:00
muellerr 72230c613b sus data processing 2022-12-02 17:22:15 +01:00
muellerr 56d0f26cbf update TCS set 2022-12-02 16:16:19 +01:00
muellerr 56d163f710 some improvements 2022-12-02 16:13:18 +01:00
muellerr 15f7b23ac2 imtq update 2022-12-02 16:06:20 +01:00
muellerr 742a8a6ae4 bump tmtccmd 2022-12-02 15:16:11 +01:00
muellerr c761262112 Merge branch 'main' of https://egit.irs.uni-stuttgart.de/eive/eive-tmtc 2022-12-02 11:47:06 +01:00
muellerr a1cc1aef94 run black 2022-12-02 11:47:00 +01:00
35 changed files with 1136 additions and 277 deletions
-7
View File
@@ -1,7 +0,0 @@
[submodule "tmtccmd"]
path = deps/tmtccmd
url = https://github.com/robamu-org/tmtccmd.git
[submodule "spacepackets"]
path = deps/spacepackets
url = https://github.com/robamu-org/py-spacepackets.git
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="PLOC MPSoC" type="PythonConfigurationType" factoryName="Python" folderName="PLOC">
<configuration default="false" name="PLOC MPSoC with Listener" type="PythonConfigurationType" factoryName="Python" folderName="PLOC">
<module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
@@ -13,7 +13,7 @@
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s ploc_mpsoc -d 6" />
<option name="PARAMETERS" value="-s ploc_mpsoc -l" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
+13
View File
@@ -8,6 +8,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
The [milestone](https://egit.irs.uni-stuttgart.de/eive/eive-obsw/milestones)
list yields a list of all related PRs for each release.
# [v2.1.1] 12.01.2023
- Typo in `setup.cfg`, missing version prefix `v` for `tmtccmd`
# [v2.1.0] 12.01.2023
- Various refactoring and tweaks to allow easier integration into `eive-mib`.
- Handle ACS CTRL HK sets.
- Add reboot commands for PCDU modules.
- Extend MPSoC commands.
- Starting from now, more regular releases, especially on breaking changes. This is because
this is now also a library with dependents.
# [v2.0.2] 01.12.2022
- Bumped dependencies, small fix to allow working script if PyQt is not installed
+1
View File
@@ -0,0 +1 @@
recursive-include eive_tmtc/config *.csv
+1 -9
View File
@@ -68,18 +68,10 @@ Assuming you are running in a virtual environment:
1. Install `tmtccmd` for virtual environment. `-e` for interactive installation.
```sh
cd tmtccmd
cd deps/tmtccmd
pip install -e .[gui]
```
2. You can also install the `spacepackets` package locally/interactively
Normally, it will be installed as a `tmtccmd` dependency.
```sh
cd spacepackets
pip install -e .
```
Alternatively you can also install the packages from PyPI completely, but the risk of
incompatibilities will be high there
+4
View File
@@ -0,0 +1,4 @@
/*
!/*.sh
!/.gitignore
Vendored Executable
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
git clone https://github.com/us-irs/spacepackets-py.git
Vendored Executable
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
git clone https://github.com/robamu-org/tmtccmd.git
Submodule deps/spacepackets deleted from 83622451c3
-1
Submodule deps/tmtccmd deleted from 4ecbaee2a7
+3 -3
View File
@@ -2,10 +2,10 @@ from pathlib import Path
SW_NAME = "eive-tmtc"
VERSION_MAJOR = 2
VERSION_MINOR = 0
VERSION_REVISION = 2
VERSION_MINOR = 1
VERSION_REVISION = 1
__version__ = "2.0.2"
__version__ = "2.1.1"
EIVE_TMTC_ROOT = Path(__file__).parent
PACKAGE_ROOT = EIVE_TMTC_ROOT.parent
-19
View File
@@ -1,5 +1,3 @@
from eive_tmtc.pus_tc.devs.bpx_batt import BpxOpCodes
from eive_tmtc.config.definitions import CustomServiceList
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry, CoreServiceList
from tmtccmd.config.tmtc import (
@@ -121,23 +119,6 @@ def add_str_cmds(defs: TmtcDefinitionWrapper):
defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce)
@tmtc_definitions_provider
def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(keys=BpxOpCodes.HK, info="Request BPX HK")
oce.add(keys=BpxOpCodes.RST_BOOT_CNT, info="Reset Boot Count")
oce.add(keys=BpxOpCodes.REQUEST_CFG, info="Request Configuration Struct (Step 1)")
oce.add(
keys=BpxOpCodes.REQUEST_CFG_HK, info="Request Configuration Struct HK (Step 2)"
)
oce.add(keys=BpxOpCodes.REBOOT, info="Reboot Command")
defs.add_service(
name=CustomServiceList.BPX_BATTERY.value,
info="BPX Battery Handler",
op_code_entry=oce,
)
@tmtc_definitions_provider
def add_time_cmds(defs: TmtcDefinitionWrapper):
from eive_tmtc.pus_tc.system.time import OpCodes, Info
+50
View File
@@ -1,9 +1,18 @@
from spacepackets.ecss import PusTelecommand
from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.config.object_ids import BPX_HANDLER_ID
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_8_funccmd import make_fsfw_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, Modes
from tmtccmd.tc.pus_200_fsfw_modes import Subservices as ModeSubservices
class BpxSetIds:
@@ -20,12 +29,33 @@ class BpxActionIds:
class BpxOpCodes:
HK = ["0", "hk"]
OFF = ["off"]
ON = ["on"]
RST_BOOT_CNT = ["1", "rst_boot_cnt"]
REQUEST_CFG = ["2", "cfg"]
REQUEST_CFG_HK = ["3", "cfg_hk"]
REBOOT = ["4", "reboot"]
@tmtc_definitions_provider
def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(keys=BpxOpCodes.ON, info="On command")
oce.add(keys=BpxOpCodes.OFF, info="Off command")
oce.add(keys=BpxOpCodes.HK, info="Request BPX HK")
oce.add(keys=BpxOpCodes.RST_BOOT_CNT, info="Reset Boot Count")
oce.add(keys=BpxOpCodes.REQUEST_CFG, info="Request Configuration Struct (Step 1)")
oce.add(
keys=BpxOpCodes.REQUEST_CFG_HK, info="Request Configuration Struct HK (Step 2)"
)
oce.add(keys=BpxOpCodes.REBOOT, info="Reboot Command")
defs.add_service(
name=CustomServiceList.BPX_BATTERY.value,
info="BPX Battery Handler",
op_code_entry=oce,
)
@service_provider(CustomServiceList.BPX_BATTERY.value)
def pack_bpx_commands(p: ServiceProviderParams):
op_code = p.op_code
@@ -34,6 +64,26 @@ def pack_bpx_commands(p: ServiceProviderParams):
q.add_log_cmd("Requesting BPX battery HK set")
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_HK_SET)
q.add_pus_tc(generate_one_hk_command(sid=sid))
if op_code in BpxOpCodes.OFF:
q.add_log_cmd("Off mode")
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Modes.OFF, 0)
q.add_pus_tc(
PusTelecommand(
service=200,
subservice=ModeSubservices.TC_MODE_COMMAND,
app_data=mode_cmd,
)
)
if op_code in BpxOpCodes.ON:
q.add_log_cmd("On mode")
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Modes.ON, 0)
q.add_pus_tc(
PusTelecommand(
service=200,
subservice=ModeSubservices.TC_MODE_COMMAND,
app_data=mode_cmd,
)
)
if op_code in BpxOpCodes.RST_BOOT_CNT:
q.add_log_cmd("Resetting reboot counters")
q.add_pus_tc(
+33 -17
View File
@@ -29,8 +29,21 @@ class OpCodes:
OFF = "off"
ON = "on"
NORMAL = "nml"
STANDBY = "standby"
STANDBY = "set_tx_standby"
SET_CW = "set_tx_carrier_wave"
MODULATION = "modulation"
HK_RX_REGS = "hk_rx_regs"
HK_TX_REGS = "hk_tx_regs"
TX_STATUS = "tx_status"
RX_STATUS = "rx_status"
class Info:
HK_RX_REGS = "Request RX register set"
HK_TX_REGS = "Request TX register set"
TX_STATUS = "Read TX status (always read in normal mode)"
RX_STATUS = "Read RX status (always read in normal mode)"
SET_CW = "Set TX carrier wave"
class CommandIds:
@@ -59,13 +72,15 @@ def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCodes.NORMAL, "Syrlinks Handler: Set mode normal")
oce.add(OpCodes.STANDBY, "Syrlinks Handler: Set TX standby")
oce.add(OpCodes.MODULATION, "Syrlinks Handler: Set TX modulation")
oce.add("5", "Syrlinks Handler: Set TX carrier wave")
oce.add("6", "Syrlinks Handler: Read TX status")
oce.add(OpCodes.HK_RX_REGS, Info.HK_RX_REGS)
oce.add(OpCodes.HK_TX_REGS, Info.HK_TX_REGS)
oce.add(OpCodes.SET_CW, Info.SET_CW)
oce.add(OpCodes.TX_STATUS, Info.TX_STATUS)
oce.add(OpCodes.RX_STATUS, Info.RX_STATUS)
oce.add("7", "Syrlinks Handler: Read TX waveform")
oce.add("8", "Syrlinks Handler: Read TX AGC value high byte")
oce.add("9", "Syrlinks Handler: Read TX AGC value low byte")
oce.add("12", "Syrlinks Handler: Write LCL config")
oce.add("13", "Syrlinks Handler: Read RX status registers")
oce.add("14", "Syrlinks Handler: Read LCL config register")
oce.add("15", "Syrlinks Handler: Set waveform OQPSK")
oce.add("16", "Syrlinks Handler: Set waveform BPSK")
@@ -79,41 +94,42 @@ def pack_syrlinks_command(
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
):
obyt = object_id.as_bytes
prefix = "Syrlinks"
q.add_log_cmd(f"Testing Syrlinks with object id: {object_id.as_hex_string}")
if op_code == OpCodes.OFF:
q.add_log_cmd("Syrlinks: Set mode off")
q.add_log_cmd(f"{prefix}: Set mode off")
data = pack_mode_data(obyt, Modes.OFF, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if op_code == OpCodes.ON:
q.add_log_cmd("Syrlinks: Set mode on")
q.add_log_cmd(f"{prefix}: Set mode on")
data = pack_mode_data(obyt, Modes.ON, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if op_code == OpCodes.NORMAL:
q.add_log_cmd("Syrlinks: Mode Normal")
q.add_log_cmd(f"{prefix}: Mode Normal")
data = pack_mode_data(obyt, Modes.NORMAL, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if op_code == OpCodes.STANDBY:
q.add_log_cmd("syrlinks: Set TX mode standby")
q.add_log_cmd(f"{prefix}: Set TX mode standby")
data = obyt + struct.pack("!I", CommandIds.SET_TX_MODE_STANDBY)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == OpCodes.MODULATION:
q.add_log_cmd("syrlinks: Set TX mode modulation")
q.add_log_cmd(f"{prefix}: Set TX mode modulation")
data = obyt + struct.pack("!I", CommandIds.SET_TX_MODE_MODULATION)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "5":
q.add_log_cmd("syrlinks: Set TX mode CW")
if op_code in OpCodes.SET_CW:
q.add_log_cmd(f"{prefix}: {Info.SET_CW}")
data = obyt + struct.pack("!I", CommandIds.SET_TX_MODE_CW)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "6":
q.add_log_cmd("Syrlinks: Get RX Registers")
if op_code in OpCodes.HK_RX_REGS:
q.add_log_cmd(f"{prefix}: {Info.HK_RX_REGS}")
sid = make_sid(obyt, SetIds.RX_REGISTERS_DATASET)
q.add_pus_tc(generate_one_hk_command(sid))
if op_code == "7":
q.add_log_cmd("Syrlinks: Get TX Registers")
if op_code in OpCodes.HK_TX_REGS:
q.add_log_cmd(f"{prefix}: {Info.HK_TX_REGS}")
sid = make_sid(obyt, SetIds.TX_REGISTERS_DATASET)
q.add_pus_tc(generate_one_hk_command(sid))
if op_code == "8":
q.add_log_cmd("Syrlinks: Read TX status")
if op_code in OpCodes.TX_STATUS:
q.add_log_cmd(f"{prefix}: {Info.TX_STATUS}")
command = obyt + struct.pack("!I", CommandIds.READ_TX_STATUS)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "9":
+1 -1
View File
@@ -37,7 +37,7 @@ from eive_tmtc.tmtc.acs.reaction_wheels import (
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.pus_tc.devs.ccsds_handler import pack_ccsds_handler_test
from eive_tmtc.pus_tc.system.core import pack_core_commands
from eive_tmtc.tmtc.core import pack_core_commands
from eive_tmtc.pus_tc.devs.star_tracker import pack_star_tracker_commands
from eive_tmtc.pus_tc.devs.syrlinks_hk_handler import pack_syrlinks_command
from eive_tmtc.pus_tc.devs.gps import pack_gps_command
+2 -1
View File
@@ -8,7 +8,6 @@ from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
import eive_tmtc.config.object_ids as obj_ids
class OpCodes:
THERMAL_CONTROLLER = [obj_ids.THERMAL_CONTROLLER_ID.hex(), "ctrl-th"]
CORE_CONTROLLER = [obj_ids.CORE_CONTROLLER_ID.hex(), "ctrl-core"]
@@ -25,12 +24,14 @@ def pack_cmd_ctrl_to_prompted_mode(
from eive_tmtc.pus_tc.prompt_parameters import (
prompt_parameters_cli,
)
param_list = [
{"name": "Mode", "defaultValue": "2"},
{"name": "Submode", "defaultValue": "0"},
]
if gui:
from eive_tmtc.pus_tc.prompt_parameters import prompt_parameters_gui
parameters = prompt_parameters_gui(param_list)
else:
parameters = prompt_parameters_cli(param_list)
+2 -2
View File
@@ -21,8 +21,8 @@ from tmtccmd.tc.pus_3_fsfw_hk import *
import eive_tmtc.config.object_ids as oids
from eive_tmtc.pus_tc.system.tcs import OpCodes as TcsOpCodes
from eive_tmtc.pus_tc.devs.bpx_batt import BpxSetIds
from eive_tmtc.pus_tc.system.core import SetIds as CoreSetIds
from eive_tmtc.tmtc.power.common_power import SetIds as GsSetIds
from eive_tmtc.tmtc.core import SetIds as CoreSetIds
from eive_tmtc.tmtc.power.common_power import SetId as GsSetIds
from eive_tmtc.pus_tc.devs.rad_sensor import SetIds as RadSetIds
from eive_tmtc.pus_tc.devs.mgms import MgmLis3SetIds as MgmLis3SetIds_0_2
from eive_tmtc.pus_tc.devs.mgms import MgmRm3100SetIds as MgmRm3100SetIds_1_3
+15 -13
View File
@@ -5,6 +5,20 @@ 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 == BpxSetIds.GET_HK_SET:
@@ -22,18 +36,6 @@ def handle_bpx_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
reboot_cntr,
boot_cause,
) = struct.unpack(fmt_str, hk_data[0:inc_len])
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",
]
content_list = [
charge_current,
discharge_current,
@@ -47,7 +49,7 @@ def handle_bpx_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
boot_cause,
]
validity_buffer = hk_data[inc_len:]
pw.dlog(str(header_list))
pw.dlog(str(HEADER_LIST))
pw.dlog(str(content_list))
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=10)
elif set_id == BpxSetIds.GET_CFG_SET:
+3 -3
View File
@@ -1,6 +1,6 @@
"""HK Handling for EIVE OBSW"""
# from pus_tm.tcp_server_objects import TCP_SEVER_SENSOR_TEMPERATURES
from eive_tmtc.tmtc.acs.acs_ctrl import handle_acs_ctrl_mgm_data
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
@@ -32,7 +32,7 @@ from eive_tmtc.tmtc.acs.imtq import (
handle_raw_mtm_measurement,
)
from eive_tmtc.pus_tm.defs import FsfwTmTcPrinter
from eive_tmtc.pus_tm.system.core import handle_core_hk_data
from eive_tmtc.tmtc.core import handle_core_hk_data
from eive_tmtc.pus_tm.devs.mgms import handle_mgm_hk_data
import eive_tmtc.config.object_ids as obj_ids
@@ -175,7 +175,7 @@ def handle_regular_hk_print(
elif objb == obj_ids.PLOC_SUPV_ID:
handle_supv_hk_data(set_id=set_id, hk_data=hk_data, printer=printer)
elif objb == obj_ids.ACS_CONTROLLER:
handle_acs_ctrl_mgm_data(printer, hk_data)
handle_acs_ctrl_hk_data(printer, set_id, hk_data)
else:
LOGGER.info(
f"Service 3 TM: Parsing for object {object_id} and set ID {set_id} "
-21
View File
@@ -1,21 +0,0 @@
import struct
from eive_tmtc.pus_tm.defs import PrintWrapper
from eive_tmtc.pus_tc.system.core import SetIds
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
def handle_core_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
if set_id == SetIds.HK:
pw = PrintWrapper(printer)
fmt_str = "!fff"
inc_len = struct.calcsize(fmt_str)
(temperature, ps_voltage, pl_voltage) = struct.unpack(
fmt_str, hk_data[0 : 0 + inc_len]
)
printout = (
f"Chip Temperature [°C] {temperature} | PS Voltage [mV] {ps_voltage} | "
f"PL Voltage [mV] {pl_voltage}"
)
pw.dlog(printout)
printer.print_validity_buffer(validity_buffer=hk_data[inc_len:], num_vars=3)
+6 -3
View File
@@ -28,7 +28,7 @@ def handle_thermal_controller_hk_data(
pw.dlog("Received sensor temperature data")
# get all the floats
tm_data = struct.unpack("!ffffffffffffffffff", hk_data[: 18 * 4])
tm_data = struct.unpack("!fffffffffffffffffffff", hk_data[: 21 * 4])
parsed_data = {
"SENSOR_PLOC_HEATSPREADER": tm_data[0],
"SENSOR_PLOC_MISSIONBOARD": tm_data[1],
@@ -46,8 +46,11 @@ def handle_thermal_controller_hk_data(
"SENSOR_PLPCDU_HEATSPREADER": tm_data[13],
"SENSOR_TCS_BOARD": tm_data[14],
"SENSOR_MAGNETTORQUER": tm_data[15],
"TMP1075 1": tm_data[16],
"TMP1075 2": tm_data[17],
"TMP1075 TCS 0": tm_data[16],
"TMP1075 TCS 1": tm_data[17],
"TMP1075 PL PCDU 0": tm_data[18],
"TMP1075 PL PCDU 1": tm_data[19],
"TMP1075 IF BOARD": tm_data[20],
}
printer.file_logger.info(str(parsed_data))
pp = pprint.PrettyPrinter(depth=4)
+609 -25
View File
@@ -13,6 +13,7 @@ from tmtccmd.config.tmtc import (
TmtcDefinitionWrapper,
OpCodeEntry,
)
from tmtccmd.tc.pus_20_params import pack_scalar_boolean_parameter_app_data
from tmtccmd.tc import service_provider
from tmtccmd.tc.decorator import ServiceProviderParams
from tmtccmd.tc.pus_3_fsfw_hk import (
@@ -23,23 +24,87 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
)
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
LOGGER = get_console_logger()
class SetIds(enum.IntEnum):
MGM_SET = 0
MGM_RAW_SET = 0
MGM_PROC_SET = 1
SUS_RAW_SET = 2
SUS_PROC_SET = 3
GYR_RAW_SET = 4
GYR_PROC_SET = 5
GPS_PROC_SET = 6
MEKF_DATA = 7
CTRL_VAL_DATA = 8
ACTUATOR_CMD_DATA = 9
class OpCodes:
REQUEST_MGM_HK = ["0", "req-mgm-hk"]
ENABLE_MGM_HK = ["1", "enable-mgm-hk"]
DISABLE_MGM_HK = ["1", "disable-mgm-hk"]
REQUEST_RAW_MGM_HK = ["0", "mgm_raw_hk"]
ENABLE_RAW_MGM_HK = ["1", "enable_mgm_raw_hk"]
DISABLE_RAW_MGM_HK = ["2", "disable_mgm_raw_hk"]
REQUEST_PROC_MGM_HK = ["3", "mgm_proc_hk"]
ENABLE_PROC_MGM_HK = ["4", "enable_mgm_proc_hk"]
DISABLE_PROC_MGM_HK = ["5", "disable_mgm_proc_hk"]
REQUEST_RAW_SUS_HK = ["6", "sus_raw_hk"]
ENABLE_RAW_SUS_HK = ["7", "enable_sus_raw_hk"]
DISABLE_RAW_SUS_HK = ["8", "disable_sus_raw_hk"]
REQUEST_PROC_SUS_HK = ["9", "sus_proc_hk"]
ENABLE_PROC_SUS_HK = ["10", "enable_sus_proc_hk"]
DISABLE_PROC_SUS_HK = ["11", "disable_sus_proc_hk"]
REQUEST_RAW_GYR_HK = ["12", "gyr_raw_hk"]
ENABLE_RAW_GYR_HK = ["13", "enable_gyr_raw_hk"]
DISABLE_RAW_GYR_HK = ["14", "disable_gyr_raw_hk"]
REQUEST_PROC_GYR_HK = ["15", "gyr_proc_hk"]
ENABLE_PROC_GYR_HK = ["16", "enable_gyr_proc_hk"]
DISABLE_PROC_GYR_HK = ["17", "disable_gyr_proc_hk"]
REQUEST_PROC_GPS_HK = ["18", "gps_proc_hk"]
ENABLE_PROC_GPS_HK = ["19", "enable_gps_proc_hk"]
DISABLE_PROC_GPS_HK = ["20", "disable_gps_proc_hk"]
REQUEST_MEKF_HK = ["21", "mekf_hk"]
ENABLE_MEKF_HK = ["22", "enable_mekf_hk"]
DISABLE_MEKF_HK = ["23", "disable_mekf_hk"]
REQUEST_CTRL_VAL_HK = ["24", "ctrl_val_hk"]
ENABLE_CTRL_VAL_HK = ["25", "enable_ctrl_val_hk"]
DISABLE_CTRL_VAL_HK = ["26", "disable_ctrl_val_hk"]
REQUEST_ACT_CMD_HK = ["27", "act_cmd_hk"]
ENABLE_ACT_CMD_HK = ["28", "enable act_cmd_hk"]
DISABLE_ACT_CMD_HK = ["29", "disable act_cmd_hk"]
class Info:
REQUEST_MGM_HK = "Request MGM HK once"
ENABLE_MGM_HK = "Enable MGM HK data generation"
DISABLE_MGM_HK = "Disable MGM HK data generation"
REQUEST_RAW_MGM_HK = "Request Raw MGM HK once"
ENABLE_RAW_MGM_HK = "Enable Raw MGM HK data generation"
DISABLE_RAW_MGM_HK = "Disable Raw MGM HK data generation"
REQUEST_PROC_MGM_HK = "Request Processed MGM HK"
ENABLE_PROC_MGM_HK = "Enable Processed MGM HK data generation"
DISABLE_PROC_MGM_HK = "Disable Processed MGM HK data generation"
REQUEST_RAW_SUS_HK = "Request Raw SUS HK"
ENABLE_RAW_SUS_HK = "Enable Raw SUS HK data generation"
DISABLE_RAW_SUS_HK = "Disable Raw SUS HK data generation"
REQUEST_PROC_SUS_HK = "Request Processed SUS HK"
ENABLE_PROC_SUS_HK = "Enable Processed SUS HK data generation"
DISABLE_PROC_SUS_HK = "Disable Processed MGM HK data generation"
REQUEST_RAW_GYR_HK = "Request Raw GYR HK"
ENABLE_RAW_GYR_HK = "Enable Raw GYR HK data generation"
DISABLE_RAW_GYR_HK = "Disable Raw GYR HK data generation"
REQUEST_PROC_GYR_HK = "Request Processed GYR HK"
ENABLE_PROC_GYR_HK = "Enable Processed GYR HK data generation"
DISABLE_PROC_GYR_HK = "Disable Processed GYR HK data generation"
REQUEST_PROC_GPS_HK = "Request Processed GPS HK"
ENABLE_PROC_GPS_HK = "Enable Processed GPS HK data generation"
DISABLE_PROC_GPS_HK = "Disable Processed GPS HK data generation"
REQUEST_MEKF_HK = "Request MEKF HK"
ENABLE_MEKF_HK = "Enable MEKF HK data generation"
DISABLE_MEKF_HK = "Disable MEKF HK data generation"
REQUEST_CTRL_VAL_HK = "Request Control Values HK"
ENABLE_CTRL_VAL_HK = "Enable Control Values HK data generation"
DISABLE_CTRL_VAL_HK = "Disable Control Values HK data generation"
REQUEST_ACT_CMD_HK = "Request Actuator Commands HK"
ENABLE_ACT_CMD_HK = "Enable Actuator Commands HK data generation"
DISABLE_ACT_CMD_HK = "Disable Actuator Commands HK data generation"
PERFORM_MGM_CALIBRATION = False
@@ -57,9 +122,36 @@ if PERFORM_MGM_CALIBRATION:
@tmtc_definitions_provider
def acs_cmd_defs(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(keys=OpCodes.REQUEST_MGM_HK, info=Info.REQUEST_MGM_HK)
oce.add(keys=OpCodes.ENABLE_MGM_HK, info=Info.ENABLE_MGM_HK)
oce.add(keys=OpCodes.DISABLE_MGM_HK, info=Info.DISABLE_MGM_HK)
oce.add(keys=OpCodes.REQUEST_RAW_MGM_HK, info=Info.REQUEST_RAW_MGM_HK)
oce.add(keys=OpCodes.ENABLE_RAW_MGM_HK, info=Info.ENABLE_RAW_MGM_HK)
oce.add(keys=OpCodes.DISABLE_RAW_MGM_HK, info=Info.DISABLE_RAW_MGM_HK)
oce.add(keys=OpCodes.REQUEST_PROC_MGM_HK, info=Info.REQUEST_PROC_MGM_HK)
oce.add(keys=OpCodes.ENABLE_PROC_MGM_HK, info=Info.ENABLE_PROC_MGM_HK)
oce.add(keys=OpCodes.DISABLE_PROC_MGM_HK, info=Info.DISABLE_PROC_MGM_HK)
oce.add(keys=OpCodes.REQUEST_RAW_SUS_HK, info=Info.REQUEST_RAW_SUS_HK)
oce.add(keys=OpCodes.ENABLE_RAW_SUS_HK, info=Info.ENABLE_RAW_SUS_HK)
oce.add(keys=OpCodes.DISABLE_RAW_SUS_HK, info=Info.DISABLE_RAW_SUS_HK)
oce.add(keys=OpCodes.REQUEST_PROC_SUS_HK, info=Info.REQUEST_PROC_SUS_HK)
oce.add(keys=OpCodes.ENABLE_PROC_SUS_HK, info=Info.ENABLE_PROC_SUS_HK)
oce.add(keys=OpCodes.DISABLE_PROC_SUS_HK, info=Info.DISABLE_PROC_SUS_HK)
oce.add(keys=OpCodes.REQUEST_RAW_GYR_HK, info=Info.REQUEST_RAW_GYR_HK)
oce.add(keys=OpCodes.ENABLE_RAW_GYR_HK, info=Info.ENABLE_RAW_GYR_HK)
oce.add(keys=OpCodes.DISABLE_RAW_GYR_HK, info=Info.DISABLE_RAW_GYR_HK)
oce.add(keys=OpCodes.REQUEST_PROC_GYR_HK, info=Info.REQUEST_PROC_GYR_HK)
oce.add(keys=OpCodes.ENABLE_PROC_GYR_HK, info=Info.ENABLE_PROC_GYR_HK)
oce.add(keys=OpCodes.DISABLE_PROC_GYR_HK, info=Info.DISABLE_PROC_GYR_HK)
oce.add(keys=OpCodes.REQUEST_PROC_GPS_HK, info=Info.REQUEST_PROC_GPS_HK)
oce.add(keys=OpCodes.ENABLE_PROC_GPS_HK, info=Info.ENABLE_PROC_GPS_HK)
oce.add(keys=OpCodes.DISABLE_PROC_GPS_HK, info=Info.DISABLE_PROC_GPS_HK)
oce.add(keys=OpCodes.REQUEST_MEKF_HK, info=Info.REQUEST_MEKF_HK)
oce.add(keys=OpCodes.ENABLE_MEKF_HK, info=Info.ENABLE_MEKF_HK)
oce.add(keys=OpCodes.DISABLE_MEKF_HK, info=Info.DISABLE_MEKF_HK)
oce.add(keys=OpCodes.REQUEST_CTRL_VAL_HK, info=Info.REQUEST_CTRL_VAL_HK)
oce.add(keys=OpCodes.ENABLE_CTRL_VAL_HK, info=Info.ENABLE_CTRL_VAL_HK)
oce.add(keys=OpCodes.DISABLE_CTRL_VAL_HK, info=Info.DISABLE_CTRL_VAL_HK)
oce.add(keys=OpCodes.REQUEST_ACT_CMD_HK, info=Info.REQUEST_ACT_CMD_HK)
oce.add(keys=OpCodes.ENABLE_ACT_CMD_HK, info=Info.ENABLE_ACT_CMD_HK)
oce.add(keys=OpCodes.DISABLE_ACT_CMD_HK, info=Info.DISABLE_ACT_CMD_HK)
defs.add_service(
name=CustomServiceList.ACS_CTRL.value, info="ACS Controller", op_code_entry=oce
)
@@ -69,25 +161,287 @@ def acs_cmd_defs(defs: TmtcDefinitionWrapper):
def pack_acs_ctrl_command(p: ServiceProviderParams):
op_code = p.op_code
q = p.queue_helper
sid = make_sid(ACS_CONTROLLER, SetIds.MGM_SET)
if op_code in OpCodes.REQUEST_MGM_HK:
q.add_log_cmd(Info.REQUEST_MGM_HK)
q.add_pus_tc(generate_one_hk_command(sid))
elif op_code in OpCodes.ENABLE_MGM_HK:
q.add_log_cmd(Info.ENABLE_MGM_HK)
cmd_tuple = enable_periodic_hk_command_with_interval(False, sid, 2.0)
if op_code in OpCodes.REQUEST_RAW_MGM_HK:
q.add_log_cmd(Info.REQUEST_RAW_MGM_HK)
q.add_pus_tc(
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.MGM_RAW_SET))
)
elif op_code in OpCodes.ENABLE_RAW_MGM_HK:
q.add_log_cmd(Info.ENABLE_RAW_MGM_HK)
cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetIds.MGM_RAW_SET), 2.0
)
q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1])
elif op_code in OpCodes.DISABLE_MGM_HK:
q.add_log_cmd(Info.DISABLE_MGM_HK)
q.add_pus_tc(disable_periodic_hk_command(False, sid))
elif op_code in OpCodes.DISABLE_RAW_MGM_HK:
q.add_log_cmd(Info.DISABLE_RAW_MGM_HK)
q.add_pus_tc(
disable_periodic_hk_command(
False, make_sid(ACS_CONTROLLER, SetIds.MGM_RAW_SET)
)
)
elif op_code in OpCodes.REQUEST_PROC_MGM_HK:
q.add_log_cmd(Info.REQUEST_PROC_MGM_HK)
q.add_pus_tc(
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.MGM_PROC_SET))
)
elif op_code in OpCodes.ENABLE_PROC_MGM_HK:
q.add_log_cmd(Info.ENABLE_PROC_MGM_HK)
cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetIds.MGM_PROC_SET), 2.0
)
q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1])
elif op_code in OpCodes.DISABLE_PROC_MGM_HK:
q.add_log_cmd(Info.DISABLE_PROC_MGM_HK)
q.add_pus_tc(
disable_periodic_hk_command(
False, make_sid(ACS_CONTROLLER, SetIds.MGM_PROC_SET)
)
)
elif op_code in OpCodes.REQUEST_RAW_SUS_HK:
q.add_log_cmd(Info.REQUEST_RAW_SUS_HK)
q.add_pus_tc(
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.SUS_RAW_SET))
)
elif op_code in OpCodes.ENABLE_RAW_SUS_HK:
q.add_log_cmd(Info.ENABLE_RAW_SUS_HK)
cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetIds.SUS_RAW_SET), 2.0
)
q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1])
elif op_code in OpCodes.DISABLE_RAW_SUS_HK:
q.add_log_cmd(Info.DISABLE_RAW_SUS_HK)
q.add_pus_tc(
disable_periodic_hk_command(
False, make_sid(ACS_CONTROLLER, SetIds.SUS_RAW_SET)
)
)
elif op_code in OpCodes.REQUEST_PROC_SUS_HK:
q.add_log_cmd(Info.REQUEST_PROC_SUS_HK)
q.add_pus_tc(
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.SUS_PROC_SET))
)
elif op_code in OpCodes.ENABLE_PROC_SUS_HK:
q.add_log_cmd(Info.ENABLE_PROC_SUS_HK)
cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetIds.SUS_PROC_SET), 2.0
)
q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1])
elif op_code in OpCodes.DISABLE_PROC_SUS_HK:
q.add_log_cmd(Info.DISABLE_PROC_SUS_HK)
q.add_pus_tc(
disable_periodic_hk_command(
False, make_sid(ACS_CONTROLLER, SetIds.SUS_PROC_SET)
)
)
elif op_code in OpCodes.REQUEST_RAW_GYR_HK:
q.add_log_cmd(Info.REQUEST_RAW_GYR_HK)
q.add_pus_tc(
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.GYR_RAW_SET))
)
elif op_code in OpCodes.ENABLE_RAW_GYR_HK:
q.add_log_cmd(Info.ENABLE_RAW_GYR_HK)
cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetIds.GYR_RAW_SET), 2.0
)
q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1])
elif op_code in OpCodes.DISABLE_RAW_GYR_HK:
q.add_log_cmd(Info.DISABLE_RAW_GYR_HK)
q.add_pus_tc(
disable_periodic_hk_command(
False, make_sid(ACS_CONTROLLER, SetIds.GYR_RAW_SET)
)
)
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, SetIds.GYR_PROC_SET))
)
elif op_code in OpCodes.ENABLE_PROC_GYR_HK:
q.add_log_cmd(Info.ENABLE_PROC_GYR_HK)
cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetIds.GYR_PROC_SET), 2.0
)
q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1])
elif op_code in OpCodes.DISABLE_PROC_GYR_HK:
q.add_log_cmd(Info.DISABLE_PROC_GYR_HK)
q.add_pus_tc(
disable_periodic_hk_command(
False, make_sid(ACS_CONTROLLER, SetIds.GYR_PROC_SET)
)
)
elif op_code in OpCodes.REQUEST_PROC_GPS_HK:
q.add_log_cmd(Info.REQUEST_PROC_GPS_HK)
q.add_pus_tc(
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.GPS_PROC_SET))
)
elif op_code in OpCodes.ENABLE_PROC_GPS_HK:
q.add_log_cmd(Info.ENABLE_PROC_GPS_HK)
cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetIds.GPS_PROC_SET), 2.0
)
q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1])
elif op_code in OpCodes.DISABLE_PROC_GPS_HK:
q.add_log_cmd(Info.DISABLE_PROC_GPS_HK)
q.add_pus_tc(
disable_periodic_hk_command(
False, make_sid(ACS_CONTROLLER, SetIds.GPS_PROC_SET)
)
)
elif op_code in OpCodes.REQUEST_MEKF_HK:
q.add_log_cmd(Info.REQUEST_MEKF_HK)
q.add_pus_tc(
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.MEKF_DATA))
)
elif op_code in OpCodes.ENABLE_MEKF_HK:
q.add_log_cmd(Info.ENABLE_MEKF_HK)
cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetIds.MEKF_DATA), 2.0
)
q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1])
elif op_code in OpCodes.DISABLE_MEKF_HK:
q.add_log_cmd(Info.DISABLE_MEKF_HK)
q.add_pus_tc(
disable_periodic_hk_command(
False, make_sid(ACS_CONTROLLER, SetIds.MEKF_DATA)
)
)
elif op_code in OpCodes.REQUEST_CTRL_VAL_HK:
q.add_log_cmd(Info.REQUEST_CTRL_VAL_HK)
q.add_pus_tc(
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.CTRL_VAL_DATA))
)
elif op_code in OpCodes.ENABLE_CTRL_VAL_HK:
q.add_log_cmd(Info.ENABLE_CTRL_VAL_HK)
cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetIds.CTRL_VAL_DATA), 2.0
)
q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1])
elif op_code in OpCodes.DISABLE_CTRL_VAL_HK:
q.add_log_cmd(Info.DISABLE_CTRL_VAL_HK)
q.add_pus_tc(
disable_periodic_hk_command(
False, make_sid(ACS_CONTROLLER, SetIds.CTRL_VAL_DATA)
)
)
elif op_code in OpCodes.REQUEST_ACT_CMD_HK:
q.add_log_cmd(Info.REQUEST_ACT_CMD_HK)
q.add_pus_tc(
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetIds.ACTUATOR_CMD_DATA))
)
elif op_code in OpCodes.ENABLE_ACT_CMD_HK:
q.add_log_cmd(Info.ENABLE_ACT_CMD_HK)
cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetIds.ACTUATOR_CMD_DATA), 2.0
)
q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1])
elif op_code in OpCodes.DISABLE_ACT_CMD_HK:
q.add_log_cmd(Info.DISABLE_ACT_CMD_HK)
q.add_pus_tc(
disable_periodic_hk_command(
False, make_sid(ACS_CONTROLLER, SetIds.ACTUATOR_CMD_DATA)
)
)
else:
LOGGER.info(f"Unknown op code {op_code}")
def handle_acs_ctrl_mgm_data(printer: FsfwTmTcPrinter, hk_data: bytes):
current_idx = 0
def handle_acs_ctrl_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
pw = PrintWrapper(printer)
match set_id:
case SetIds.MGM_RAW_SET:
handle_raw_mgm_data(pw, hk_data)
case SetIds.MGM_PROC_SET:
handle_mgm_data_processed(pw, hk_data)
case SetIds.SUS_RAW_SET:
handle_acs_ctrl_sus_raw_data(pw, hk_data)
case SetIds.SUS_PROC_SET:
handle_acs_ctrl_sus_processed_data(pw, hk_data)
case SetIds.GYR_RAW_SET:
handle_gyr_data_raw(pw, hk_data)
case SetIds.GYR_PROC_SET:
handle_gyr_data_processed(pw, hk_data)
case SetIds.GPS_PROC_SET:
handle_gps_data_processed(pw, hk_data)
case SetIds.MEKF_DATA:
handle_mekf_data(pw, hk_data)
case SetIds.CTRL_VAL_DATA:
handle_ctrl_val_data(pw, hk_data)
case SetIds.ACTUATOR_CMD_DATA:
handle_act_cmd_data(pw, hk_data)
def handle_acs_ctrl_sus_raw_data(pw: PrintWrapper, hk_data: bytes):
if len(hk_data) < 6 * 2 * 12:
pw.dlog(
f"SUS Raw dataset with size {len(hk_data)} does not have expected size"
f" of {6 * 2 * 12} bytes"
)
return
current_idx = 0
vec_fmt = "["
for _ in range(5):
vec_fmt += "{:#06x}, "
vec_fmt += "{:#06x}]"
for idx in range(12):
fmt_str = "!HHHHHH"
length = struct.calcsize(fmt_str)
sus_list = struct.unpack(fmt_str, hk_data[current_idx : current_idx + length])
sus_list_formatted = vec_fmt.format(*sus_list)
current_idx += length
pw.dlog(f"SUS {idx} RAW: {sus_list_formatted}")
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=12)
def handle_acs_ctrl_sus_processed_data(pw: PrintWrapper, hk_data: bytes):
if len(hk_data) < 3 * 4 * 12:
pw.dlog(
f"SUS Raw dataset with size {len(hk_data)} does not have expected size"
f" of {3 * 4 * 12} bytes"
)
return
current_idx = 0
for idx in range(12):
fmt_str = "!fff"
length = struct.calcsize(fmt_str)
sus_list = struct.unpack(fmt_str, hk_data[current_idx : current_idx + length])
sus_list_formatted = [f"{val:8.3f}" for val in sus_list]
current_idx += length
pw.dlog(f"SUS {idx} CALIB: {sus_list_formatted}")
fmt_str = "!ddd"
inc_len = struct.calcsize(fmt_str)
sus_vec_tot = list(
struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
)
sus_vec_tot = [f"{val:8.3f}" for val in {sus_vec_tot}]
current_idx += inc_len
pw.dlog(f"SUS Vector Total: {sus_vec_tot}")
sus_vec_tot_deriv = struct.unpack(
fmt_str, hk_data[current_idx : current_idx + inc_len]
)
sus_vec_tot_deriv = [f"{val:8.3f}" for val in {sus_vec_tot_deriv}]
current_idx += inc_len
pw.dlog(f"SUS Vector Derivative: {sus_vec_tot_deriv}")
sun_ijk_model = list(
struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
)
sun_ijk_model = [f"{val:8.3f}" for val in {sun_ijk_model}]
current_idx += inc_len
pw.dlog(f"SUS ijk Model: {sun_ijk_model}")
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=12)
def handle_raw_mgm_data(pw: PrintWrapper, hk_data: bytes):
current_idx = 0
if len(hk_data) < 61:
pw.dlog(
@@ -131,8 +485,8 @@ def handle_acs_ctrl_mgm_data(printer: FsfwTmTcPrinter, hk_data: bytes):
"ACS Board MGM 1 RM3100",
"ACS Board MGM 2 LIS3MDL",
"ACS Board MGM 3 RM3100",
"IMTQ Actuation Status:",
"IMTQ MGM:",
"IMTQ Actuation Status:",
]
for entry in zip(print_str_list, formatted_list):
pw.dlog(f"{entry[0].ljust(28)}: {entry[1]}")
@@ -142,6 +496,234 @@ def handle_acs_ctrl_mgm_data(printer: FsfwTmTcPrinter, hk_data: bytes):
assert current_idx == 61
def handle_mgm_data_processed(pw: PrintWrapper, hk_data: bytes):
pw.dlog("Received Processed MGM Set")
fmt_str = "!fffffddd"
inc_len = struct.calcsize(fmt_str)
if len(hk_data) < inc_len:
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}")
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 = [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]
)
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]
)
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
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=8)
def handle_gyr_data_raw(pw: PrintWrapper, hk_data: bytes):
pw.dlog("Received GYR Raw Set with rotation rates in deg per second")
float_fmt = "!fff"
double_fmt = "!ddd"
inc_len_flt = struct.calcsize(float_fmt)
inc_len_double = struct.calcsize(double_fmt)
if len(hk_data) < 2 * inc_len_double + 2 * inc_len_flt:
pw.dlog("HK data too small")
return
current_idx = 0
float_str_fmt = "[{:8.3f}, {:8.3f}, {:8.3f}]"
gyr_0_adis = struct.unpack(
double_fmt, hk_data[current_idx : current_idx + inc_len_double]
)
current_idx += inc_len_double
gyr_1_l3 = struct.unpack(
float_fmt, hk_data[current_idx : current_idx + inc_len_flt]
)
current_idx += inc_len_flt
gyr_2_adis = struct.unpack(
double_fmt, hk_data[current_idx : current_idx + inc_len_double]
)
current_idx += inc_len_double
gyr_3_l3 = struct.unpack(
float_fmt, hk_data[current_idx : current_idx + inc_len_flt]
)
current_idx += inc_len_flt
pw.dlog(f"{'GYR 0 ADIS'.ljust(15)}: {float_str_fmt.format(*gyr_0_adis)}")
pw.dlog(f"{'GYR 1 L3'.ljust(15)}: {float_str_fmt.format(*gyr_1_l3)}")
pw.dlog(f"{'GYR 2 ADIS'.ljust(15)}: {float_str_fmt.format(*gyr_2_adis)}")
pw.dlog(f"{'GYR 3 L3'.ljust(15)}: {float_str_fmt.format(*gyr_3_l3)}")
pw.printer.print_validity_buffer(hk_data[current_idx:], 4)
GYR_NAMES = ["GYR 0 ADIS", "GYR 1 L3", "GYR 2 ADIS", "GYR 3 L3"]
def handle_gyr_data_processed(pw: PrintWrapper, hk_data: bytes):
pw.dlog("Received GYR Processed Set with rotation rates in deg per second")
fmt_str = "!ddd"
inc_len = struct.calcsize(fmt_str)
current_idx = 0
for i in range(4):
gyr_vec = [
f"{val:8.3f}"
for val in struct.unpack(
fmt_str, hk_data[current_idx : current_idx + inc_len]
)
]
pw.dlog(f"{GYR_NAMES[i]}: {gyr_vec}")
current_idx += inc_len
gyr_vec_tot = [
f"{val:8.3f}"
for val in struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
]
pw.dlog(f"GYR Vec Total: {gyr_vec_tot}")
current_idx += inc_len
def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
pw.dlog("Received GPS Processed Set")
fmt_scalar = "!d"
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:
pw.dlog("Received HK set too small")
return
current_idx = 0
lat = [
f"{val:8.3f}"
for val in struct.unpack(
fmt_scalar, hk_data[current_idx : current_idx + inc_len_scalar]
)
]
current_idx += inc_len_scalar
long = [
f"{val:8.3f}"
for val in struct.unpack(
fmt_scalar, hk_data[current_idx : current_idx + inc_len_scalar]
)
]
current_idx += inc_len_scalar
velo = [
f"{val:8.3f}"
for val in struct.unpack(
fmt_vec, hk_data[current_idx : current_idx + inc_len_vec]
)
]
pw.dlog(f"GPS Latitude: {lat} [rad]")
pw.dlog(f"GPS Longitude: {long} [rad]")
pw.dlog(f"GPS Velocity: {velo} [m/s]")
def handle_mekf_data(pw: PrintWrapper, hk_data: bytes):
pw.dlog("Received MEKF Set")
fmt_quat = "!dddd"
fmt_vec = "!ddd"
inc_len_quat = struct.calcsize(fmt_quat)
inc_len_vec = struct.calcsize(fmt_vec)
if len(hk_data) < inc_len_quat + inc_len_vec:
pw.dlog("Received HK set too small")
return
current_idx = 0
quat = [
f"{val:8.3f}"
for val in struct.unpack(
fmt_quat, hk_data[current_idx : current_idx + inc_len_quat]
)
]
current_idx += inc_len_quat
rate = [
f"{val:8.3f}"
for val in struct.unpack(
fmt_vec, hk_data[current_idx : current_idx + inc_len_vec]
)
]
pw.dlog(f"MEKF Quaternion: {quat}")
pw.dlog(f"MEKF Rotational Rate: {rate}")
def handle_ctrl_val_data(pw: PrintWrapper, hk_data: bytes):
pw.dlog("Received CTRL Values Set")
fmt_quat = "!dddd"
fmt_scalar = "!d"
inc_len_quat = struct.calcsize(fmt_quat)
inc_len_scalar = struct.calcsize(fmt_scalar)
if len(hk_data) < 2 * inc_len_quat + inc_len_scalar:
pw.dlog("Received HK set too small")
return
current_idx = 0
tgt_quat = [
f"{val:8.3f}"
for val in struct.unpack(
fmt_quat, hk_data[current_idx : current_idx + inc_len_quat]
)
]
current_idx += inc_len_quat
err_quat = [
f"{val:8.3f}"
for val in struct.unpack(
fmt_quat, hk_data[current_idx : current_idx + inc_len_quat]
)
]
current_idx += inc_len_quat
err_ang = [
f"{val:8.3f}"
for val in struct.unpack(
fmt_scalar, hk_data[current_idx : 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]")
def handle_act_cmd_data(pw: PrintWrapper, hk_data: bytes):
pw.dlog("Received Actuator Command Values Set")
fmt_vec4_double = "!dddd"
fmt_vec4_int32 = "!iiii"
fmt_vec3_int16 = "!hhh"
inc_len_vec4_double = struct.calcsize(fmt_vec4_double)
inc_len_vec4_int32 = struct.calcsize(fmt_vec4_int32)
inc_len_vec3_int16 = struct.calcsize(fmt_vec3_int16)
if len(hk_data) < inc_len_vec4_double + inc_len_vec4_int32 + inc_len_vec3_int16:
pw.dlog("Received HK set too small")
return
current_idx = 0
rw_tgt_torque = [
f"{val:8.3f}"
for val in struct.unpack(
fmt_vec4_double, hk_data[current_idx : current_idx + inc_len_vec4_double]
)
]
current_idx += inc_len_vec4_double
rw_tgt_speed = [
f"{val:d}"
for val in struct.unpack(
fmt_vec4_int32, hk_data[current_idx : current_idx + inc_len_vec4_int32]
)
]
current_idx += inc_len_vec4_int32
mtq_tgt_dipole = [
f"{val:d}"
for val in struct.unpack(
fmt_vec3_int16, hk_data[current_idx : 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}")
def perform_mgm_calibration(pw: PrintWrapper, mgm_tuple: Tuple):
global CALIBR_SOCKET, CALIBRATION_ADDR
try:
@@ -150,7 +732,8 @@ def perform_mgm_calibration(pw: PrintWrapper, mgm_tuple: Tuple):
reply = CALIBR_SOCKET.recv(1024)
if len(reply) != 2:
pw.dlog(
f"MGM calibration: Reply received command {declare_api_cmd} has invalid length {len(reply)}"
f"MGM calibration: Reply received command {declare_api_cmd} has"
f" invalid length {len(reply)}"
)
return
else:
@@ -167,7 +750,8 @@ def perform_mgm_calibration(pw: PrintWrapper, mgm_tuple: Tuple):
reply = CALIBR_SOCKET.recv(1024)
if len(reply) != 2:
pw.dlog(
f"MGM calibration: Reply received command magnetometer_field has invalid length {len(reply)}"
f"MGM calibration: Reply received command magnetometer_field has invalid "
f"length {len(reply)}"
)
return
else:
+27 -19
View File
@@ -6,6 +6,7 @@
@date 25.03.2021
"""
import struct
from typing import List
from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.pus_tm.defs import PrintWrapper
@@ -265,21 +266,22 @@ def raise_dipole_error(dipole_str: str, value: int):
)
def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes):
pw = PrintWrapper(printer)
header_list = [
"Digital Voltage [mV]",
"Analog Voltage [mV]",
"Digital Current [mA]",
"Analog Current [mA]",
"Coil Current X [mA]",
"Coil Current Y [mA]",
"Coil Current Z [mA]",
"Coil X Temperature [°C]",
"Coil Y Temperature [°C]",
"Coil Z Temperature [°C]",
"MCU Temperature [°C]",
]
ENG_HK_HEADERS = [
"Digital Voltage [mV]",
"Analog Voltage [mV]",
"Digital Current [mA]",
"Analog Current [mA]",
"Coil Current X [mA]",
"Coil Current Y [mA]",
"Coil Current Z [mA]",
"Coil X Temperature [°C]",
"Coil Y Temperature [°C]",
"Coil Z Temperature [°C]",
"MCU Temperature [°C]",
]
def unpack_eng_hk(hk_data: bytes) -> List:
digital_voltage = struct.unpack("!H", hk_data[0:2])[0]
analog_voltage = struct.unpack("!H", hk_data[2:4])[0]
digital_current = struct.unpack("!f", hk_data[4:8])[0]
@@ -291,8 +293,6 @@ def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes):
coil_y_temperature = struct.unpack("!h", hk_data[26:28])[0]
coil_z_temperature = struct.unpack("!h", hk_data[28:30])[0]
mcu_temperature = struct.unpack("!h", hk_data[30:32])[0]
validity_buffer = hk_data[32:]
content_list = [
digital_voltage,
analog_voltage,
@@ -306,8 +306,16 @@ def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes):
coil_z_temperature,
mcu_temperature,
]
num_of_vars = len(header_list)
pw.dlog(str(header_list))
return content_list
def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes):
pw = PrintWrapper(printer)
content_list = unpack_eng_hk(hk_data)
validity_buffer = hk_data[32:]
num_of_vars = len(ENG_HK_HEADERS)
pw.dlog(str(ENG_HK_HEADERS))
pw.dlog(str(content_list))
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
@@ -1,4 +1,7 @@
import enum
import struct
from eive_tmtc.pus_tm.defs import PrintWrapper
from eive_tmtc.config.definitions import CustomServiceList
from spacepackets.ecss import PusTelecommand
@@ -10,7 +13,7 @@ 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()
@@ -141,7 +144,7 @@ def add_core_controller_definitions(defs: TmtcDefinitionWrapper):
def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
if op_code in OpCodes.REBOOT_XSC:
reboot_self, chip_select, copy_select = determine_reboot_params()
perform_reboot_cmd(
add_xsc_reboot_cmd(
q=q,
reboot_self=reboot_self,
chip=chip_select,
@@ -149,30 +152,26 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
)
if op_code in OpCodes.REBOOT_FULL:
q.add_log_cmd(f"Core Command: {Info.REBOOT_FULL}")
q.add_pus_tc(
make_fsfw_action_cmd(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.FULL_REBOOT
)
)
q.add_pus_tc(create_full_reboot_cmds())
if op_code in OpCodes.XSC_REBOOT_SELF:
perform_reboot_cmd(q=q, reboot_self=True)
add_xsc_reboot_cmd(q=q, reboot_self=True)
if op_code in OpCodes.XSC_REBOOT_0_0:
perform_reboot_cmd(
add_xsc_reboot_cmd(
q=q, reboot_self=False, chip=Chip.CHIP_0, copy=Copy.COPY_0_NOM
)
if op_code in OpCodes.XSC_REBOOT_0_1:
perform_reboot_cmd(
add_xsc_reboot_cmd(
q=q,
reboot_self=False,
chip=Chip.CHIP_0,
copy=Copy.COPY_1_GOLD,
)
if op_code in OpCodes.XSC_REBOOT_1_0:
perform_reboot_cmd(
add_xsc_reboot_cmd(
q=q, reboot_self=False, chip=Chip.CHIP_1, copy=Copy.COPY_0_NOM
)
if op_code in OpCodes.XSC_REBOOT_1_1:
perform_reboot_cmd(
add_xsc_reboot_cmd(
q=q,
reboot_self=False,
chip=Chip.CHIP_1,
@@ -268,6 +267,12 @@ def reset_specific_boot_counter(q: DefaultPusQueueHelper, chip: int, copy: int):
)
def create_full_reboot_cmds() -> PusTelecommand:
return make_fsfw_action_cmd(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.FULL_REBOOT
)
def determine_reboot_params() -> (bool, Chip, Copy):
chip_select = -1
copy_select = -1
@@ -311,25 +316,47 @@ def pack_obsw_update_cmd(action_id: int) -> PusTelecommand:
)
def perform_reboot_cmd(
def add_xsc_reboot_cmd(
q: DefaultPusQueueHelper,
reboot_self: bool,
chip: Chip = Chip.NONE,
copy: Copy = Copy.NONE,
):
tc_data = bytearray()
if reboot_self:
q.add_log_cmd("Packing reboot command for current image")
else:
q.add_log_cmd(f"Packing reboot command for chip {chip} and copy {copy}")
q.add_pus_tc(create_xsc_reboot_cmds(reboot_self, chip, copy))
def create_xsc_reboot_cmds(
reboot_self: bool,
chip: Chip = Chip.NONE,
copy: Copy = Copy.NONE,
) -> PusTelecommand:
tc_data = bytearray()
if reboot_self:
tc_data.append(True)
else:
tc_data.append(False)
tc_data.append(chip)
tc_data.append(copy)
q.add_log_cmd(f"Packing reboot command for chip {chip} and copy {copy}")
q.add_pus_tc(
make_fsfw_action_cmd(
object_id=CORE_CONTROLLER_ID,
action_id=ActionIds.XSC_REBOOT,
user_data=tc_data,
)
return make_fsfw_action_cmd(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.XSC_REBOOT, user_data=tc_data
)
def handle_core_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
if set_id == SetIds.HK:
pw = PrintWrapper(printer)
fmt_str = "!fff"
inc_len = struct.calcsize(fmt_str)
(temperature, ps_voltage, pl_voltage) = struct.unpack(
fmt_str, hk_data[0 : 0 + inc_len]
)
printout = (
f"Chip Temperature [°C] {temperature} | PS Voltage [mV] {ps_voltage} | "
f"PL Voltage [mV] {pl_voltage}"
)
pw.dlog(printout)
printer.print_validity_buffer(validity_buffer=hk_data[inc_len:], num_vars=3)
+60 -31
View File
@@ -23,6 +23,7 @@ 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, Modes
LOGGER = get_console_logger()
MANUAL_INPUT = "1"
@@ -37,12 +38,15 @@ mpsoc_file_dict = {
"2": ["0:/flash", "0:/flash"],
}
sequence_file_dict = {
SEQ_FILE_NAMES = ["0:/EM16/231", "0:/EQ04/E-75", "0:/EQ01/E130"]
SEQ_FILE_DICT = {
MANUAL_INPUT: ["manual input", ""],
"2": ["0:/EM16/231", "0:/EM16/231"],
"3": ["0:/EQ04/E-75", "0:/EQ04/E-75"],
"2": [f"16QRM On Carrier 200 MBd ({SEQ_FILE_NAMES[0]})", f"{SEQ_FILE_NAMES[0]}"],
"3": [f"QPSK On Carrier 780 MBd ({SEQ_FILE_NAMES[1]})", f"{SEQ_FILE_NAMES[1]}"],
"4": [f"Maximum Bandwidth QPSK ({SEQ_FILE_NAMES[2]})", f"{SEQ_FILE_NAMES[2]}"],
}
CARRIAGE_RETURN = 0xD
@@ -64,6 +68,30 @@ class CommandIds(enum.IntEnum):
RELEASE_UART_TX = 21
class OpCodes:
ON = ["on"]
OFF = ["off"]
NORMAL = ["normal"]
VERIFY_BOOT = ["verify_boot"]
MODE_REPLAY = ["mode_replay"]
MODE_IDLE = ["mode_idle"]
REPLAY_WRITE_SEQ = ["replay_write"]
DOWNLINK_PWR_ON = ["downlink_pwr_on"]
REPLAY_START = ["replay_start"]
class Info:
ON = "On"
OFF = "Off"
NORMAL = "Normal"
VERIFY_BOOT = "Verify boot by reading 0xdeadbeef from DEADBEEF address"
MODE_REPLAY = "Switch to REPLAY mode"
MODE_IDLE = "Switch to IDLE mode"
REPLAY_WRITE_SEQ = "Replay write sequence"
DOWNLINK_PWR_ON = "Downlink Power On"
REPLAY_START = "Replay Start"
class MemAddresses(enum.IntEnum):
DEADBEEF = 0x40000004
@@ -76,22 +104,22 @@ class PlocReplyIds(enum.IntEnum):
@tmtc_definitions_provider
def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add("0", "Ploc MPSoC: Set mode off")
oce.add("1", "Ploc MPSoC: Set mode on")
oce.add("2", "Ploc MPSoC: Set mode normal")
oce.add(OpCodes.OFF, Info.OFF)
oce.add(OpCodes.ON, Info.ON)
oce.add(OpCodes.NORMAL, Info.NORMAL)
oce.add("3", "Ploc MPSoC: Memory write")
oce.add("4", "Ploc MPSoC: Memory read")
oce.add("5", "Ploc MPSoC: Flash write")
oce.add("6", "Ploc MPSoC: Flash delete")
oce.add("7", "Ploc MPSoC: Replay start")
oce.add(OpCodes.REPLAY_START, Info.REPLAY_START)
oce.add("8", "Ploc MPSoC: Replay stop")
oce.add("9", "Ploc MPSoC: Downlink pwr on")
oce.add(OpCodes.DOWNLINK_PWR_ON, Info.DOWNLINK_PWR_ON)
oce.add("10", "Ploc MPSoC: Downlink pwr off")
oce.add("11", "Ploc MPSoC: Replay write sequence")
oce.add(OpCodes.REPLAY_WRITE_SEQ, Info.REPLAY_WRITE_SEQ)
oce.add("12", "Ploc MPSoC: OBSW reset sequence count")
oce.add("13", "Ploc MPSoC: Read DEADBEEF address")
oce.add("14", "Ploc MPSoC: Mode replay")
oce.add("15", "Ploc MPSoC: Mode idle")
oce.add(OpCodes.VERIFY_BOOT, "Ploc MPSoC: Read DEADBEEF address")
oce.add(OpCodes.MODE_REPLAY, Info.MODE_REPLAY)
oce.add(OpCodes.MODE_IDLE, Info.MODE_IDLE)
oce.add("16", "Ploc MPSoC: Tc cam command send")
oce.add("17", "Ploc MPSoC: Set UART TX tristate")
oce.add("18", "Ploc MPSoC: Relesase UART TX")
@@ -102,21 +130,22 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
object_id = get_object_ids().get(PLOC_MPSOC_ID)
q = p.queue_helper
prefix = "PLOC MPSoC"
op_code = p.op_code
q.add_log_cmd(
f"Generate command for PLOC MPSoC with object id: {object_id.as_hex_string}"
)
obyt = object_id.as_bytes
if op_code == "0":
q.add_log_cmd("PLOC MPSoC: Set mode off")
if op_code in OpCodes.OFF:
q.add_log_cmd(f"{prefix}: {Info.OFF}")
command = pack_mode_data(obyt, Modes.OFF, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
if op_code == "1":
q.add_log_cmd("PLOC MPSoC: Set mode on")
if op_code in OpCodes.ON:
q.add_log_cmd(f"{prefix}: {Info.ON}")
data = pack_mode_data(obyt, Modes.ON, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if op_code == "2":
q.add_log_cmd("PLOC MPSoC: Mode Normal")
if op_code in OpCodes.NORMAL:
q.add_log_cmd(f"{prefix}: {Info.NORMAL}")
data = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if op_code == "3":
@@ -143,33 +172,33 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
q.add_log_cmd("PLOC MPSoC: Flash delete")
data = prepare_flash_delete_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "7":
q.add_log_cmd("PLOC MPSoC: Replay start")
if op_code in OpCodes.REPLAY_START:
q.add_log_cmd(f"{prefix}: {Info.REPLAY_START}")
data = prepare_replay_start_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "8":
q.add_log_cmd("PLOC MPSoC: Replay stop")
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_REPLAY_STOP)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "9":
q.add_log_cmd("PLOC MPSoC: Downlink pwr on")
if op_code in OpCodes.DOWNLINK_PWR_ON:
q.add_log_cmd(f"{prefix}: {OpCodes.DOWNLINK_PWR_ON}")
data = prepare_downlink_pwr_on_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "10":
q.add_log_cmd("PLOC MPSoC: Downlink pwr off")
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_DOWNLINK_PWR_OFF)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "11":
q.add_log_cmd("PLOC MPSoC: Replay write sequence")
if op_code in OpCodes.REPLAY_WRITE_SEQ:
q.add_log_cmd(f"{prefix}: {Info.REPLAY_WRITE_SEQ}")
data = prepare_replay_write_sequence_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "12":
q.add_log_cmd("PLOC MPSoC: Reset OBSW sequence count")
data = object_id.as_bytes + struct.pack("!I", CommandIds.OBSW_RESET_SEQ_COUNT)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "13":
if op_code in OpCodes.VERIFY_BOOT:
num_words = 1
q.add_log_cmd("PLOC MPSoC: Read DEADBEEF address")
q.add_log_cmd(f"{prefix} {Info.VERIFY_BOOT}")
data = (
object_id.as_bytes
+ struct.pack("!I", CommandIds.TC_MEM_READ)
@@ -177,11 +206,11 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
+ struct.pack("!H", num_words)
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "14":
if op_code in OpCodes.MODE_REPLAY:
q.add_log_cmd("PLOC MPSoC: Tc mode replay")
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_MODE_REPLAY)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "15":
if op_code in OpCodes.MODE_IDLE:
q.add_log_cmd("PLOC MPSoC: Tc mode idle")
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_MODE_IDLE)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
@@ -282,7 +311,6 @@ def prepare_downlink_pwr_on_cmd(object_id: bytes) -> bytearray:
def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
null_terminator = 0
use_decoding = int(input("Use decoding (set to 1): "))
file = get_sequence_file()
command = (
@@ -290,6 +318,7 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
+ struct.pack("!I", CommandIds.TC_REPLAY_WRITE_SEQUENCE)
+ struct.pack("!B", use_decoding)
+ bytearray(file, "utf-8")
# + bytes([0])
)
return bytearray(command)
@@ -318,10 +347,10 @@ def get_mpsoc_file() -> str:
def get_sequence_file() -> str:
LOGGER.info("Specify sequence file")
input_helper = InputHelper(sequence_file_dict)
input_helper = InputHelper(SEQ_FILE_DICT)
key = input_helper.get_key()
if key == MANUAL_INPUT:
file = input("Ploc MPSoC: Specify absolute name file: ")
else:
file = sequence_file_dict[key][1]
file = SEQ_FILE_DICT[key][1]
return file
+41 -25
View File
@@ -64,6 +64,25 @@ event_buffer_path_dict = {
}
FACTORY_RESET_OPS = {
0x00: "CLEAR_MRAM_EVENT_BUF",
0x01: "CLEAR_MRAM_ADC_BUF",
0x02: "FACTORY_DEFAULT_MRAM_SYS_CFG",
0x03: "FACTORY_DEFAULT_MRAM_DBG_CFG",
0x04: "FACTORY_DEFAULT_BOOTMAN_CFG",
0x05: "FACTORY_DEFAULT_DATA_LOGGER",
0x06: "DATA_LOGGER_OP_DATA_TO_ZERO",
0x07: "FACTORY_DEFAULT_MRAM_LATCHUP_MON",
0x08: "FACTORY_DEFAULT_ADC_MON_CFG",
0x09: "FACTORY_DEFAULT_WATCHDOG_MON_CFG",
0x0A: "FACTORY_DEFAULT_HK_CFG",
0x0B: "FACTORY_DEFAULT_MEM_MAN_CFG",
0x10: "REDWIRE_TASK_1",
0x11: "REDWIRE_TASK_2",
0x12: "REDWIRE_TASK_3",
}
class SupvActionIds:
HK_REPORT = 1
START_MPSOC = 3
@@ -92,11 +111,8 @@ class SupvActionIds:
SET_GPIO = 34
READ_GPIO = 35
RESTART_SUPERVISOR = 36
FACTORY_RESET_CLEAR_ALL = 37
LOGGING_REQUEST_COUNTERS = 38
UPDATE_IMAGE_DATA = 39
FACTORY_RESET_CLEAR_MIRROR = 40
FACTORY_RESET_CLEAR_CIRCULAR = 41
FACTORY_RESET = 39
START_MPSOC_QUIET = 45
SET_SHUTDOWN_TIMEOUT = 46
FACTORY_FLASH = 47
@@ -133,6 +149,7 @@ class OpCodes:
REQ_BOOT_STATUS_REPORT = ["13", "boot_report"]
START_UPDATE = ["42", "start_update"]
PERFORM_UPDATE = ["update"]
FACTORY_RESET = ["factory_reset"]
MEM_CHECK = ["mem_check"]
@@ -147,6 +164,7 @@ class Info(str, enum.Enum):
FACTORY_FLASH = "Factory Flash Mode"
PERFORM_UPDATE = "Start or continue MPSoC SW update at starting bytes"
START_UPDATE = "Start new MPSoC SW update"
FACTORY_RESET = "Factory Reset of loggers"
REQ_BOOT_STATUS_REPORT = "Request boot status report and HK"
MEM_CHECK = "Memory Check"
SEL_NVM = "Select NVM"
@@ -165,6 +183,7 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCodes.SHUTDOWN_MPSOC, "PLOC Supervisor: Shutdown MPSoC")
oce.add(OpCodes.SEL_NVM, Info.SEL_NVM)
oce.add(OpCodes.SET_TIME_REF, Info.SET_TIME_REF)
oce.add(OpCodes.FACTORY_RESET, Info.FACTORY_RESET)
oce.add("8", "PLOC Supervisor: Set max restart tries")
oce.add("9", "PLOC Supervisor: Reset MPSoC")
oce.add("11", "PLOC Supervisor: Set boot timeout")
@@ -183,9 +202,6 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
oce.add("35", "PLOC Supervisor: Set GPIO")
oce.add("36", "PLOC Supervisor: Read GPIO")
oce.add("37", "PLOC Supervisor: Restart supervisor")
oce.add("38", "PLOC Supervisor: Factory reset clear all")
oce.add("39", "PLOC Supervisor: Factory reset clear mirror entries")
oce.add("40", "PLOC Supervisor: Factory reset clear circular entries")
oce.add(OpCodes.PERFORM_UPDATE, Info.PERFORM_UPDATE)
oce.add(OpCodes.START_UPDATE, Info.START_UPDATE)
oce.add("43", "PLOC Supervisor: Terminate supervisor process")
@@ -251,6 +267,24 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
bp2 = int(input("BP2 (0 or 1): "))
command = pack_sel_boot_image_cmd(object_id.as_bytes, mem, bp0, bp1, bp2)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code in OpCodes.FACTORY_RESET:
q.add_log_cmd(f"{prefix}: {Info.FACTORY_RESET}")
key = -1
while True:
print("Please select the key for a factory reset operation")
for key, val in FACTORY_RESET_OPS.items():
print(f"{key}: {val}")
key = int(input("Key Select: "))
if key not in FACTORY_RESET_OPS:
print("Key invalid!")
break
q.add_pus_tc(
make_fsfw_action_cmd(
object_id=PLOC_SUPV_ID,
action_id=SupvActionIds.FACTORY_RESET,
user_data=bytes([key]),
)
)
if op_code == "8":
q.add_log_cmd("PLOC Supervisor: Set max restart tries")
restart_tries = int(input("Specify maximum restart tries: "))
@@ -349,24 +383,6 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
"!I", SupvActionIds.RESTART_SUPERVISOR
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "38":
q.add_log_cmd("PLOC Supervisor: Factory reset clear all")
command = object_id.as_bytes + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_ALL
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "39":
q.add_log_cmd("PLOC Supervisor: Factory reset clear mirror entries")
command = object_id.as_bytes + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_MIRROR
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "40":
q.add_log_cmd("PLOC Supervisor: Factory reset clear circular entries")
command = object_id.as_bytes + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_CIRCULAR
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code in OpCodes.START_UPDATE:
q.add_log_cmd("PLOC Supversior: Start new MPSoC SW update")
command = pack_update_command(object_id.as_bytes, True)
+2 -2
View File
@@ -12,7 +12,7 @@ from eive_tmtc.tmtc.power.common_power import (
add_gomspace_cmd_defs,
req_hk_cmds,
pack_common_power_cmds,
SetIds,
SetId,
OBC_ENDIANNESS,
unpack_array_in_data,
)
@@ -72,7 +72,7 @@ def pack_acu_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
def acu_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
req_hk_cmds("ACU", q, op_code, ACU_HANDLER_ID, [SetIds.CORE, SetIds.AUX])
req_hk_cmds("ACU", q, op_code, ACU_HANDLER_ID, [SetId.CORE, SetId.AUX])
class ACUTestProcedure:
+27 -15
View File
@@ -10,6 +10,7 @@ from eive_tmtc.gomspace.gomspace_common import (
pack_request_config_command,
pack_gnd_wdt_reset_command,
ParamTypes,
pack_reboot_command,
)
from eive_tmtc.gomspace.gomspace_pdu_definitions import OUT_ENABLE_LIST
from spacepackets.ecss import PusTelecommand
@@ -33,6 +34,7 @@ class GomspaceOpCodes:
RESET_GND_WATCHDOG = ["reset_gnd_wdt"]
SAVE_TABLE_DEFAULT = ["save_table_default"]
LOAD_TABLE = ["load_table"]
REBOOT = ["reboot"]
REQUEST_CONFIG_TABLE = ["cfg_table"]
@@ -44,6 +46,7 @@ class GsInfo:
SAVE_TABLE = "Save table non-volatile (file)"
SAVE_TABLE_DEFAULT = "Save table non-volatile (default)"
LOAD_TABLE = "Load Table"
REBOOT = "Reboot PCDU module"
class PowerInfo:
@@ -96,6 +99,7 @@ class PowerOpCodes:
PL_CAM_ON = ["cam_on"]
PL_CAM_OFF = ["cam_off"]
REBOOT = ["reboot"]
INFO_CORE = ["info"]
ENABLE_INFO_HK = ["info_hk_on"]
DISABLE_INFO_HK = ["info_hk_off"]
@@ -109,7 +113,7 @@ class PowerOpCodes:
PRINT_LATCHUPS = ["print_latchups"]
class SetIds:
class SetId:
CORE = 1
AUX = 2
CONFIG = 3
@@ -123,13 +127,13 @@ def pack_common_power_cmds(
interval = float(input("Specify HK interval in floating point seconds: "))
q.add_log_cmd(f"{prefix}: {PowerInfo.ENABLE_INFO_HK} with interval {interval}")
cmds = enable_periodic_hk_command_with_interval(
True, make_sid(objb, SetIds.CORE), interval
True, make_sid(objb, SetId.CORE), interval
)
for cmd in cmds:
q.add_pus_tc(cmd)
if op_code in PowerOpCodes.DISABLE_INFO_HK:
q.add_log_cmd(f"{prefix}: {PowerInfo.DISABLE_INFO_HK}")
q.add_pus_tc(disable_periodic_hk_command(True, make_sid(objb, SetIds.CORE)))
q.add_pus_tc(disable_periodic_hk_command(True, make_sid(objb, SetId.CORE)))
def pack_common_gomspace_cmds(
@@ -143,6 +147,9 @@ def pack_common_gomspace_cmds(
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
)
)
if op_code in PowerOpCodes.REBOOT:
q.add_log_cmd(f"{prefix}: {GsInfo.REBOOT}")
q.add_pus_tc(pack_reboot_command(object_id))
if op_code in PowerOpCodes.PRINT_LATCHUPS:
q.add_log_cmd(f"{prefix}: {PowerInfo.PRINT_LATCHUPS}")
q.add_pus_tc(
@@ -266,12 +273,14 @@ def generic_on_cmd(
object_id: bytes, q: DefaultPusQueueHelper, info_str: str, out_idx: int
):
q.add_log_cmd(info_str + " on")
q.add_pus_tc(
pack_set_u8_param_command(
object_id,
OUT_ENABLE_LIST[out_idx].parameter_address,
Channel.on,
)
q.add_pus_tc(create_generic_on_cmd(object_id, out_idx))
def create_generic_on_cmd(object_id: bytes, out_idx: int):
return pack_set_u8_param_command(
object_id,
OUT_ENABLE_LIST[out_idx].parameter_address,
Channel.on,
)
@@ -279,12 +288,14 @@ def generic_off_cmd(
object_id: bytes, q: DefaultPusQueueHelper, info_str: str, out_idx: int
):
q.add_log_cmd(info_str + " off")
q.add_pus_tc(
pack_set_u8_param_command(
object_id,
OUT_ENABLE_LIST[out_idx].parameter_address,
Channel.off,
)
q.add_pus_tc(create_generic_off_cmd(object_id, out_idx))
def create_generic_off_cmd(object_id: bytes, out_idx: int):
return pack_set_u8_param_command(
object_id,
OUT_ENABLE_LIST[out_idx].parameter_address,
Channel.off,
)
@@ -306,6 +317,7 @@ def add_gomspace_cmd_defs(oce: OpCodeEntry):
)
oce.add(keys=PowerOpCodes.PRINT_LATCHUPS, info=PowerInfo.PRINT_LATCHUPS)
oce.add(keys=GomspaceOpCodes.GET_PARAM, info=GsInfo.GET_PARAMETER)
oce.add(keys=GomspaceOpCodes.REBOOT, info=GsInfo.REBOOT)
oce.add(keys=GomspaceOpCodes.SET_INTEGER_PARAM, info=GsInfo.SET_PARAMETER)
oce.add(keys=GomspaceOpCodes.REQUEST_CONFIG_TABLE, info=GsInfo.REQUEST_CONFIG_TABLE)
oce.add(keys=GomspaceOpCodes.SAVE_TABLE, info=GsInfo.SAVE_TABLE)
+6 -6
View File
@@ -9,7 +9,7 @@ from eive_tmtc.tmtc.power.common_power import (
pack_common_gomspace_cmds,
req_hk_cmds,
pack_common_power_cmds,
SetIds,
SetId,
)
from tmtccmd.tc import DefaultPusQueueHelper
from eive_tmtc.gomspace.gomspace_common import (
@@ -28,10 +28,10 @@ from tmtccmd.util import ObjectIdU32
class P60OpCodes:
STACK_3V3_ON = ["stack-3v3-on", "1"]
STACK_3V3_OFF = ["stack-3v3-off", "2"]
STACK_5V_ON = ["stack-5v-on", "3"]
STACK_5V_OFF = ["stack-5v-off", "4"]
STACK_3V3_ON = ["stack_3v3_on", "1"]
STACK_3V3_OFF = ["stack_3v3_off", "2"]
STACK_5V_ON = ["stack_5v_on", "3"]
STACK_5V_OFF = ["stack_5v_off", "4"]
TEST = ["test", "0"]
@@ -238,4 +238,4 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
def p60_dock_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
req_hk_cmds("P60 Dock", q, op_code, P60_DOCK_HANDLER, [SetIds.CORE, SetIds.AUX])
req_hk_cmds("P60 Dock", q, op_code, P60_DOCK_HANDLER, [SetId.CORE, SetId.AUX])
+103 -18
View File
@@ -12,12 +12,14 @@ from eive_tmtc.tmtc.power.common_power import (
generic_on_cmd,
generic_off_cmd,
add_gomspace_cmd_defs,
create_generic_on_cmd,
create_generic_off_cmd,
pack_common_power_cmds,
GomspaceOpCodes,
GsInfo,
PowerInfo,
add_common_power_defs,
SetIds,
SetId,
)
from eive_tmtc.gomspace.gomspace_common import *
@@ -89,7 +91,7 @@ def pack_pdu1_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
def pdu1_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
req_hk_cmds("PDU1", q, op_code, PDU_1_HANDLER_ID, [SetIds.CORE, SetIds.AUX])
req_hk_cmds("PDU1", q, op_code, PDU_1_HANDLER_ID, [SetId.CORE, SetId.AUX])
def info_on_pdu1(base: str) -> str:
@@ -173,65 +175,148 @@ def add_pdu1_cmds(defs: TmtcDefinitionWrapper):
)
PDU1_DICT = {
Pdu1ChIndex.TCS: Pdu1InfoBase.TCS,
Pdu1ChIndex.STR: Pdu1InfoBase.STR,
Pdu1ChIndex.SYRLINKS: Pdu1InfoBase.SYRLINKS,
Pdu1ChIndex.MGT: Pdu1InfoBase.MGT,
Pdu1ChIndex.SCEX: Pdu1InfoBase.SCEX,
Pdu1ChIndex.ACS_A: Pdu1InfoBase.ACS_A,
Pdu1ChIndex.SUS_N: Pdu1InfoBase.SUS_N,
}
def pdu1_on_cmd(idx: Pdu1ChIndex, q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, PDU1_DICT[idx], idx)
def pdu1_off_cmd(idx: Pdu1ChIndex, q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, PDU1_DICT[idx], idx)
def tcs_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.TCS, Pdu1ChIndex.TCS)
pdu1_on_cmd(Pdu1ChIndex.TCS, q)
def create_tcs_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.TCS)
def tcs_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.TCS, Pdu1ChIndex.TCS)
pdu1_off_cmd(Pdu1ChIndex.TCS, q)
def create_tcs_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.TCS)
def syrlinks_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SYRLINKS, Pdu1ChIndex.SYRLINKS)
pdu1_on_cmd(Pdu1ChIndex.SYRLINKS, q)
def create_syrlinks_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SYRLINKS)
def syrlinks_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SYRLINKS, Pdu1ChIndex.SYRLINKS)
pdu1_off_cmd(Pdu1ChIndex.SYRLINKS, q)
def create_syrlinks_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SYRLINKS)
def startracker_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.STR, Pdu1ChIndex.STR)
pdu1_on_cmd(Pdu1ChIndex.STR, q)
def create_startracker_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.STR)
def startracker_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.STR, Pdu1ChIndex.STR)
pdu1_on_cmd(Pdu1ChIndex.STR, q)
def create_startracker_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.STR)
def mgt_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.MGT, Pdu1ChIndex.MGT)
pdu1_on_cmd(Pdu1ChIndex.MGT, q)
def create_mgt_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.MGT)
def mgt_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.MGT, Pdu1ChIndex.MGT)
pdu1_off_cmd(Pdu1ChIndex.MGT, q)
def create_mgt_off_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.MGT)
def sun_sensor_nominal_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SUS_N, Pdu1ChIndex.SUS_N)
pdu1_on_cmd(Pdu1ChIndex.SUS_N, q)
def create_sun_sensor_nominal_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SUS_N)
def sun_sensor_nominal_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SUS_N, Pdu1ChIndex.SUS_N)
pdu1_off_cmd(Pdu1ChIndex.SUS_N, q)
def create_sun_sensor_nominal_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SUS_N)
def solar_cell_experiment_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SCEX, Pdu1ChIndex.SCEX)
pdu1_on_cmd(Pdu1ChIndex.SCEX, q)
def create_solar_cell_experiment_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SCEX)
def solar_cell_experiment_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SCEX, Pdu1ChIndex.SCEX)
pdu1_off_cmd(Pdu1ChIndex.SCEX, q)
def create_solar_cell_experiment_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.SCEX)
def ploc_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.PLOC, Pdu1ChIndex.PLOC)
pdu1_on_cmd(Pdu1ChIndex.PLOC, q)
def create_ploc_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.PLOC)
def ploc_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.PLOC, Pdu1ChIndex.PLOC)
pdu1_off_cmd(Pdu1ChIndex.PLOC, q)
def create_ploc_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.PLOC)
def acs_board_a_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.ACS_A, Pdu1ChIndex.ACS_A)
pdu1_on_cmd(Pdu1ChIndex.ACS_A, q)
def create_acs_board_a_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.ACS_A)
def acs_board_a_off_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.ACS_A, Pdu1ChIndex.ACS_A)
pdu1_off_cmd(Pdu1ChIndex.ACS_A, q)
def create_acs_board_a_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_1_HANDLER_ID, Pdu1ChIndex.ACS_A)
+60 -2
View File
@@ -15,7 +15,9 @@ from eive_tmtc.tmtc.power.common_power import (
generic_off_cmd,
add_gomspace_cmd_defs,
pack_common_power_cmds,
SetIds,
create_generic_on_cmd,
create_generic_off_cmd,
SetId,
add_common_power_defs,
)
from eive_tmtc.gomspace.gomspace_common import *
@@ -238,7 +240,7 @@ def add_pdu2_common_defs(oce: OpCodeEntry):
def pdu2_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
req_hk_cmds("PDU2", q, op_code, PDU_2_HANDLER_ID, [SetIds.CORE, SetIds.AUX])
req_hk_cmds("PDU2", q, op_code, PDU_2_HANDLER_ID, [SetId.CORE, SetId.AUX])
def pl_pcdu_bat_nom_on_cmd(q: DefaultPusQueueHelper):
@@ -257,61 +259,117 @@ def reaction_wheel_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.RW, Pdu2ChIndex.RW)
def create_reaction_wheel_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.RW)
def reaction_wheel_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.RW, Pdu2ChIndex.RW)
def create_reaction_wheel_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.RW)
def heater_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.HEATER, Pdu2ChIndex.HEATER)
def create_heater_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.HEATER)
def heater_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.HEATER, Pdu2ChIndex.HEATER)
def create_heater_off_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.HEATER)
def sus_red_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.SUS_R, Pdu2ChIndex.SUS_R)
def create_sus_red_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.SUS_R)
def sus_red_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.SUS_R, Pdu2ChIndex.SUS_R)
def create_sus_red_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.SUS_R)
def solar_array_deployment_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.SOLAR_ARRAY_DEPL, Pdu2ChIndex.SOLAR_ARRAY_DEPL
)
def create_solar_array_deployment_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.SOLAR_ARRAY_DEPL)
def solar_array_deployment_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.SOLAR_ARRAY_DEPL, Pdu2ChIndex.SOLAR_ARRAY_DEPL
)
def create_solar_array_deployment_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.SOLAR_ARRAY_DEPL)
def pl_pcdu_bat_red_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_PCDU_BAT_RED, Pdu2ChIndex.PL_PCDU_BAT_RED
)
def create_pl_pcdu_bat_red_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.PL_PCDU_BAT_RED)
def pl_pcdu_bat_red_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_PCDU_BAT_RED, Pdu2ChIndex.PL_PCDU_BAT_RED
)
def create_pl_pcdu_bat_red_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.PL_PCDU_BAT_RED)
def acs_board_b_side_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.ACS_B, Pdu2ChIndex.ACS_B)
def create_acs_board_b_side_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.ACS_B)
def acs_board_b_side_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.ACS_B, Pdu2ChIndex.ACS_B)
def create_acs_board_b_side_off_cmd() -> PusTelecommand:
return create_generic_off_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.ACS_B)
def payload_camera_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_CAM, Pdu2ChIndex.PL_CAM)
def create_payload_camera_on_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.PL_CAM)
def payload_camera_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_CAM, Pdu2ChIndex.PL_CAM)
def create_payload_camera_off_cmd() -> PusTelecommand:
return create_generic_on_cmd(PDU_2_HANDLER_ID, Pdu2ChIndex.PL_CAM)
+7 -7
View File
@@ -3,7 +3,7 @@ from typing import List, Tuple
from eive_tmtc.tmtc.power.acu import acu_config_table_handler
from eive_tmtc.tmtc.power.common_power import (
SetIds,
SetId,
unpack_array_in_data,
OBC_ENDIANNESS,
)
@@ -151,7 +151,7 @@ def handle_pdu_data(
pw = PrintWrapper(printer=printer)
current_idx = 0
priv_idx = pdu_idx - 1
if set_id == SetIds.AUX or set_id == SetIds.AUX:
if set_id == SetId.AUX or set_id == SetId.AUX:
fmt_str = "!hhBBBIIH"
inc_len = struct.calcsize(fmt_str)
(
@@ -188,7 +188,7 @@ def handle_pdu_data(
wdt.print()
pw.dlog(f"PDU Device Types: 0:FRAM|1:ADC|2:ADC|3:TempSens|4,5,6,7:Reserved")
dev_parser.print(pw=pw)
if set_id == SetIds.CORE or set_id == SetIds.CORE:
if set_id == SetId.CORE or set_id == SetId.CORE:
pw.dlog(f"Received PDU HK from PDU {pdu_idx}")
current_list = []
for idx in range(len(PDU1_CHANNELS_NAMES)):
@@ -229,7 +229,7 @@ def handle_pdu_data(
def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
pw = PrintWrapper(printer=printer)
if set_id == SetIds.CORE:
if set_id == SetId.CORE:
pw.dlog("Received P60 Core HK. Voltages in mV, currents in mA")
current_idx = 0
current_list = []
@@ -276,7 +276,7 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
pw.dlog(temps)
pw.dlog(batt_info)
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=9)
if set_id == SetIds.AUX:
if set_id == SetId.AUX:
pw.dlog("Received P60 AUX HK. Voltages in mV, currents in mA")
current_idx = 0
latchup_list = []
@@ -355,7 +355,7 @@ def gen_six_entry_u16_list(hk_data: bytes, current_idx: int) -> Tuple[int, List[
def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
pw = PrintWrapper(printer=printer)
if set_id == SetIds.CORE:
if set_id == SetId.CORE:
mppt_mode = hk_data[0]
current_idx = 1
current_idx, currents = gen_six_entry_u16_list(
@@ -399,7 +399,7 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
printer.print_validity_buffer(
validity_buffer=hk_data[current_idx:], num_vars=12
)
if set_id == SetIds.AUX:
if set_id == SetId.AUX:
current_idx = 0
fmt_str = "!BBB"
inc_len = struct.calcsize(fmt_str)
+1 -1
View File
@@ -1 +1 @@
tmtccmd >= 3.0.0rc2
.
+2 -1
View File
@@ -27,9 +27,10 @@ classifiers =
[options]
install_requires =
tmtccmd >= 3.0.0rc3
tmtccmd @ git+https://github.com/robamu-org/tmtccmd@v4.0.0a1
packages = find:
python_requires = >=3.8
include_package_data = True
[options.extras_require]
mib =
+1 -1
View File
@@ -373,7 +373,7 @@ def setup_cfdp_handler() -> CfdpInCcsdsWrapper:
max_bit_width=16, file_name=Path("seqcnt_cfdp_transaction.txt")
)
cfdp_ccsds_seq_count_provider = PusFileSeqCountProvider(
file_name=Path("seqcnt_cfdp_ccsds_.txt")
file_name=Path("seqcnt_cfdp_in_ccsds.txt")
)
cfdp_user = EiveCfdpUser()
cfdp_in_ccsds_handler = CfdpInCcsdsHandler(