Merge branch 'main' into acs-ctrl-updates-v2
This commit is contained in:
commit
fd692c901d
35
CHANGELOG.md
35
CHANGELOG.md
@ -10,6 +10,41 @@ list yields a list of all related PRs for each release.
|
||||
|
||||
# [unreleased]
|
||||
|
||||
# [v2.17.3] 2023-03-09
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fixed the heater object ID names completely. Also,
|
||||
the HPA heater is now the Syrlinks heater.
|
||||
|
||||
# [v2.17.2] 2023-03-07
|
||||
|
||||
- Updated CSVs
|
||||
- New events for core controller
|
||||
|
||||
# [v2.17.1] 2023-03-07
|
||||
|
||||
## Added
|
||||
|
||||
- `MGT_ASSEMBLY` object ID
|
||||
|
||||
# [v2.17.0] 2023-03-07
|
||||
|
||||
## Added
|
||||
|
||||
- Health set and health announce commands
|
||||
- Camera Switcher, Syrlinks Assembly, IMTQ assembly and Star Tracker assembly object IDs added
|
||||
|
||||
## Changed
|
||||
|
||||
- Breaking typo fix in TMP1075 `SetId`
|
||||
|
||||
# [v2.16.4] 2023-03-04
|
||||
|
||||
## Added
|
||||
|
||||
- Some more IMTQ commands
|
||||
|
||||
# [v2.16.3] 2023-03-03
|
||||
|
||||
## Added
|
||||
|
@ -1,11 +1,11 @@
|
||||
__version__ = "2.16.3"
|
||||
__version__ = "2.17.3"
|
||||
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
SW_NAME = "eive-tmtc"
|
||||
VERSION_MAJOR = 2
|
||||
VERSION_MINOR = 16
|
||||
VERSION_MINOR = 17
|
||||
VERSION_REVISION = 3
|
||||
|
||||
EIVE_TMTC_ROOT = Path(__file__).parent
|
||||
|
@ -250,12 +250,14 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
13904;0x3650;WRITE_CONFIGFILE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
|
||||
13905;0x3651;READ_CONFIGFILE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
|
||||
14000;0x36b0;ALLOC_FAILURE;MEDIUM;No description;bsp_q7s/core/CoreController.h
|
||||
14001;0x36b1;REBOOT_SW;MEDIUM; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h
|
||||
14001;0x36b1;REBOOT_SW;LOW; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h
|
||||
14002;0x36b2;REBOOT_MECHANISM_TRIGGERED;MEDIUM;The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots;bsp_q7s/core/CoreController.h
|
||||
14003;0x36b3;REBOOT_HW;MEDIUM;No description;bsp_q7s/core/CoreController.h
|
||||
14004;0x36b4;NO_SD_CARD_ACTIVE;HIGH;No SD card was active. Core controller will attempt to re-initialize a SD card.;bsp_q7s/core/CoreController.h
|
||||
14005;0x36b5;VERSION_INFO;INFO;P1: Byte 0: Major, Byte 1: Minor, Byte 2: Patch, Byte 3: Has Git Hash P2: First four letters of Git SHA is the last byte of P1 is set.;bsp_q7s/core/CoreController.h
|
||||
14006;0x36b6;CURRENT_IMAGE_INFO;INFO;P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h
|
||||
14007;0x36b7;REBOOT_COUNTER;INFO;Total reboot counter, which is the sum of the boot count of all individual images.;bsp_q7s/core/CoreController.h
|
||||
14008;0x36b8;INDIVIDUAL_BOOT_COUNTS;INFO;Get the boot count of the individual images. P1: First 16 bits boot count of image 0 0, last 16 bits boot count of image 0 1. P2: First 16 bits boot count of image 1 0, last 16 bits boot count of image 1 1.;bsp_q7s/core/CoreController.h
|
||||
14100;0x3714;NO_VALID_SENSOR_TEMPERATURE;MEDIUM;No description;mission/controller/ThermalController.h
|
||||
14101;0x3715;NO_HEALTHY_HEATER_AVAILABLE;MEDIUM;No description;mission/controller/ThermalController.h
|
||||
14102;0x3716;SYRLINKS_OVERHEATING;HIGH;No description;mission/controller/ThermalController.h
|
||||
|
|
@ -71,14 +71,14 @@ PLOC_MPSOC_ID = bytes([0x44, 0x33, 0x00, 0x15])
|
||||
PL_PCDU_ID = bytes([0x44, 0x30, 0x00, 0x00])
|
||||
|
||||
# Other
|
||||
HEATER_0_OBC_BRD = bytes([0x60, 0x00, 0x00, 0x00])
|
||||
HEATER_1_PLOC_PROC_BRD = bytes([0x60, 0x00, 0x00, 0x01])
|
||||
HEATER_0_PLOC_PROC_BRD = bytes([0x60, 0x00, 0x00, 0x00])
|
||||
HEATER_1_PCDU_BRD = bytes([0x60, 0x00, 0x00, 0x01])
|
||||
HEATER_2_ACS_BRD = bytes([0x60, 0x00, 0x00, 0x02])
|
||||
HEATER_3_PCDU_BRD = bytes([0x60, 0x00, 0x00, 0x03])
|
||||
HEATER_3_OBC_BRD = bytes([0x60, 0x00, 0x00, 0x03])
|
||||
HEATER_4_CAMERA = bytes([0x60, 0x00, 0x00, 0x04])
|
||||
HEATER_5_STR = bytes([0x60, 0x00, 0x00, 0x05])
|
||||
HEATER_6_DRO = bytes([0x60, 0x00, 0x00, 0x06])
|
||||
HEATER_7_HPA = bytes([0x60, 0x00, 0x00, 0x07])
|
||||
HEATER_7_SYRLINKS = bytes([0x60, 0x00, 0x00, 0x07])
|
||||
|
||||
# RTDs
|
||||
RTD_0_PLOC_HSPD = bytes([0x44, 0x42, 0x00, 0x16])
|
||||
@ -132,10 +132,21 @@ PL_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x02])
|
||||
TCS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x03])
|
||||
COM_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x04])
|
||||
|
||||
# Legacy names, kept for backwards compatibility
|
||||
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])
|
||||
SUS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x02])
|
||||
IMTQ_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x08])
|
||||
|
||||
ACS_BOARD_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x01])
|
||||
SUS_BOARD_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x02])
|
||||
TCS_BOARD_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x03])
|
||||
RW_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x04])
|
||||
CAM_SWITCHER = bytes([0x73, 0x00, 0x00, 0x06])
|
||||
SYRLINKS_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x07])
|
||||
# To be removed soon..
|
||||
MGT_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x08])
|
||||
STR_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x09])
|
||||
|
||||
# Controllers
|
||||
TCS_CONTROLLER = bytes([0x43, 0x40, 0x00, 0x01])
|
||||
|
@ -142,6 +142,8 @@
|
||||
0x73000004;RW_ASSY
|
||||
0x73000006;CAM_SWITCHER
|
||||
0x73000007;SYRLINKS_ASSY
|
||||
0x73000008;IMTQ_ASSY
|
||||
0x73000009;STR_ASSY
|
||||
0x73000100;TM_FUNNEL
|
||||
0x73000101;PUS_TM_FUNNEL
|
||||
0x73000102;CFDP_TM_FUNNEL
|
||||
|
|
@ -1,7 +1,7 @@
|
||||
Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
|
||||
0x0000;OK;System-wide code for ok.;0;HasReturnvaluesIF;fsfw/returnvalues/returnvalue.h
|
||||
0x0001;Failed;Unspecified system-wide code for failed.;1;HasReturnvaluesIF;fsfw/returnvalues/returnvalue.h
|
||||
0x63a0;NVMB_KeyNotExists;Specified key does not exist in json file;160;NVM_PARAM_BASE;mission/memory/NVMParameterBase.h
|
||||
0x63a0;NVMB_KeyNotExists;Specified key does not exist in json file;160;NVM_PARAM_BASE;mission/memory/NvmParameterBase.h
|
||||
0x5100;IMTQ_InvalidCommandCode;No description;0;IMTQ_HANDLER;mission/devices/devicedefinitions/imtqHelpers.h
|
||||
0x5101;IMTQ_MgmMeasurementLowLevelError;No description;1;IMTQ_HANDLER;mission/devices/devicedefinitions/imtqHelpers.h
|
||||
0x5102;IMTQ_ActuateCmdLowLevelError;No description;2;IMTQ_HANDLER;mission/devices/devicedefinitions/imtqHelpers.h
|
||||
|
|
@ -166,6 +166,8 @@ def handle_regular_hk_print(
|
||||
return handle_thermal_controller_hk_data(
|
||||
object_id=object_id, printer=printer, set_id=set_id, hk_data=hk_data
|
||||
)
|
||||
elif objb == obj_ids.STAR_TRACKER_ID:
|
||||
return handle_str_hk_data(set_id=set_id, hk_data=hk_data, printer=printer)
|
||||
elif objb == obj_ids.PLOC_SUPV_ID:
|
||||
return handle_supv_hk_data(set_id=set_id, hk_data=hk_data, printer=printer)
|
||||
elif objb == obj_ids.ACS_CONTROLLER:
|
||||
|
@ -41,7 +41,8 @@ class OpCode:
|
||||
NORMAL = "normal"
|
||||
OFF = "off"
|
||||
SET_DIPOLE = "set_dipole"
|
||||
REQUEST_ENG_HK_NO_TORQUE = "hk_os_eng_hk"
|
||||
REQUEST_ENG_HK_NO_TORQUE = "hk_os_eng_hk_no_torque"
|
||||
REQUEST_ENG_HK_WITH_TORQUE = "hk_os_eng_hk_with_torque"
|
||||
REQUEST_MGM_RAW_NO_TORQUE = "hk_os_mgm_raw_no_torque"
|
||||
ENABLE_MGM_RAW_NO_TORQUE = "enb_mgm_raw_no_torque"
|
||||
DISABLE_MGM_RAW_NO_TORQUE = "dis_mgm_raw_no_torque"
|
||||
@ -50,6 +51,8 @@ class OpCode:
|
||||
DISABLE_MGM_RAW_WITH_TORQUE = "dis_mgm_raw_with_torque"
|
||||
ENABLE_ENG_HK_NO_TORQUE = "enb_eng_hk_no_torque"
|
||||
DISABLE_ENG_HK_NO_TORQUE = "dis_eng_hk_no_torque"
|
||||
ENABLE_ENG_HK_WITH_TORQUE = "enb_eng_hk_with_torque"
|
||||
DISABLE_ENG_HK_WITH_TORQUE = "dis_eng_hk_with_torque"
|
||||
POS_X_SELF_TEST = "self_test_pos_x"
|
||||
NEG_X_SELF_TEST = "self_test_neg_x"
|
||||
POS_Y_SELF_TEST = "self_test_pos_y"
|
||||
@ -96,6 +99,14 @@ def add_imtq_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce.add(OpCode.ON, "Mode On")
|
||||
oce.add(OpCode.NORMAL, "Mode Normal")
|
||||
oce.add(OpCode.REQUEST_ENG_HK_NO_TORQUE, "Request Engineering HK One Shot")
|
||||
oce.add(
|
||||
OpCode.REQUEST_ENG_HK_WITH_TORQUE,
|
||||
"Request Engineering HK One Shot during Torque",
|
||||
)
|
||||
oce.add(OpCode.ENABLE_ENG_HK_NO_TORQUE, "Enable ENG HK not torque")
|
||||
oce.add(OpCode.ENABLE_ENG_HK_WITH_TORQUE, "Enable ENG HK with torque")
|
||||
oce.add(OpCode.DISABLE_ENG_HK_NO_TORQUE, "Disable ENG HK not torque")
|
||||
oce.add(OpCode.DISABLE_ENG_HK_WITH_TORQUE, "Disable ENG HK with torque")
|
||||
oce.add(
|
||||
OpCode.REQUEST_MGM_RAW_NO_TORQUE, "Request MGM Raw Without Torque HK One Shot"
|
||||
)
|
||||
@ -250,8 +261,35 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
|
||||
True, make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_NO_TORQUE)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.REQUEST_ENG_HK_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Get engineering hk set with torque")
|
||||
q.add_pus_tc(
|
||||
create_request_one_diag_command(
|
||||
sid=make_sid(
|
||||
object_id=object_id.as_bytes,
|
||||
set_id=ImtqSetId.ENG_HK_SET_WITH_TORQUE,
|
||||
)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.ENABLE_ENG_HK_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Enable ENG HK with torque")
|
||||
interval = float(input("Please enter collection interval in seconds: "))
|
||||
cmds = create_enable_periodic_hk_command_with_interval(
|
||||
diag=True,
|
||||
sid=make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_SET_WITH_TORQUE),
|
||||
interval_seconds=interval,
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code == OpCode.DISABLE_ENG_HK_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Disable ENG HK with Torque")
|
||||
q.add_pus_tc(
|
||||
create_disable_periodic_hk_command(
|
||||
True, make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_SET_WITH_TORQUE)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.REQUEST_ENG_HK_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Get engineering hk set")
|
||||
q.add_log_cmd("IMTQ: Get engineering hk set (no torque)")
|
||||
q.add_pus_tc(
|
||||
generate_one_diag_command(
|
||||
sid=make_sid(
|
||||
@ -392,19 +430,17 @@ def handle_imtq_hk(printer: FsfwTmTcPrinter, hk_data: bytes, set_id: int):
|
||||
if (set_id >= ImtqSetId.POSITIVE_X_TEST) and (set_id <= ImtqSetId.NEGATIVE_Z_TEST):
|
||||
return handle_self_test_data(printer, hk_data)
|
||||
elif set_id == ImtqSetId.ENG_HK_NO_TORQUE:
|
||||
_LOGGER.info("Found engineering HK without torque")
|
||||
return handle_eng_set(printer, hk_data)
|
||||
return handle_eng_set(printer, hk_data, False)
|
||||
elif set_id == ImtqSetId.ENG_HK_SET_WITH_TORQUE:
|
||||
_LOGGER.info("Found engineering HK during torque")
|
||||
return handle_eng_set(printer, hk_data)
|
||||
return handle_eng_set(printer, hk_data, True)
|
||||
elif set_id == ImtqSetId.CAL_MTM_SET:
|
||||
return handle_calibrated_mtm_measurement(printer, hk_data)
|
||||
elif set_id == ImtqSetId.RAW_MTM_NO_TORQUE:
|
||||
_LOGGER.info("Found raw MTM measurement without torque")
|
||||
return handle_raw_mtm_measurement(printer, hk_data)
|
||||
return handle_raw_mtm_measurement(printer, hk_data, False)
|
||||
elif set_id == ImtqSetId.RAW_MTM_WITH_TORQUE:
|
||||
_LOGGER.info("Found raw MTM measurement during torque")
|
||||
return handle_raw_mtm_measurement(printer, hk_data)
|
||||
return handle_raw_mtm_measurement(printer, hk_data, True)
|
||||
elif set_id == ImtqSetId.DIPOLES:
|
||||
return handle_dipole_set(printer, hk_data)
|
||||
elif set_id == ImtqSetId.STATUS_SET:
|
||||
return handle_status_set(printer, hk_data)
|
||||
else:
|
||||
@ -421,6 +457,21 @@ def unpack_status_set(hk_data: bytes) -> List:
|
||||
return [status_mode, status_error, status_conf, status_uptime]
|
||||
|
||||
|
||||
def handle_dipole_set(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog("Received iMTQ dipole set")
|
||||
fmt_str = "!hhhH"
|
||||
fmt_len = struct.calcsize(fmt_str)
|
||||
(dipole_x, dipole_y, dipole_z, current_torque_duration) = struct.unpack(
|
||||
fmt_str, hk_data[0:8]
|
||||
)
|
||||
pw.dlog(f"Dipole X: {dipole_x}")
|
||||
pw.dlog(f"Dipole Y: {dipole_y}")
|
||||
pw.dlog(f"Dipole Z: {dipole_z}")
|
||||
pw.dlog(f"Current torque duration: {current_torque_duration}")
|
||||
pw.printer.print_validity_buffer(hk_data[fmt_len:], 2)
|
||||
|
||||
|
||||
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]
|
||||
@ -449,8 +500,9 @@ def unpack_eng_hk(hk_data: bytes) -> List:
|
||||
return content_list
|
||||
|
||||
|
||||
def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes, torque_on: bool):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Found engineering HK. Torque Status: {torque_on}")
|
||||
content_list = unpack_eng_hk(hk_data)
|
||||
validity_buffer = hk_data[32:]
|
||||
|
||||
@ -491,8 +543,11 @@ def handle_calibrated_mtm_measurement(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
||||
|
||||
|
||||
def handle_raw_mtm_measurement(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
def handle_raw_mtm_measurement(
|
||||
printer: FsfwTmTcPrinter, hk_data: bytes, torque_status: bool
|
||||
):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Found raw MTM measurement. Torque Status: {torque_status}")
|
||||
header_list = [
|
||||
"Raw MTM X [nT]",
|
||||
"Raw MTM Y [nT]",
|
||||
|
@ -5,11 +5,13 @@
|
||||
@author J. Meier
|
||||
@date 14.08.2021
|
||||
"""
|
||||
import datetime
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
@ -18,7 +20,7 @@ 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
|
||||
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -677,6 +679,80 @@ def get_upload_image() -> str:
|
||||
return image
|
||||
|
||||
|
||||
def handle_str_hk_data(set_id: int, hk_data: bytes, printer: FsfwTmTcPrinter):
|
||||
pw = PrintWrapper(printer)
|
||||
pw.dlog(f"Received STR HK set with set ID {set_id}")
|
||||
if set_id == SetId.SOLUTION:
|
||||
handle_solution_set(hk_data, pw)
|
||||
else:
|
||||
_LOGGER.warning(f"HK parsing for Star Tracker set ID {set_id} unimplemented")
|
||||
|
||||
|
||||
def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
||||
pw.dlog("Received solution set")
|
||||
ticks_time_fmt = "!IQ"
|
||||
current_idx = 0
|
||||
fmt_len = struct.calcsize(ticks_time_fmt)
|
||||
(ticks, unix_time) = struct.unpack(
|
||||
ticks_time_fmt, hk_data[current_idx : current_idx + fmt_len]
|
||||
)
|
||||
unix_as_dt = datetime.datetime.fromtimestamp(unix_time, tz=datetime.timezone.utc)
|
||||
pw.dlog(f"Ticks: {ticks} | UNIX time: {unix_time}")
|
||||
pw.dlog(f"UNIX as datetime: {unix_as_dt}")
|
||||
current_idx += fmt_len
|
||||
calib_quaternions_fmt = "!ffff"
|
||||
fmt_len = struct.calcsize(calib_quaternions_fmt)
|
||||
(calib_q_w, calib_q_x, calib_q_y, calib_q_z) = struct.unpack(
|
||||
calib_quaternions_fmt, hk_data[current_idx : current_idx + fmt_len]
|
||||
)
|
||||
pw.dlog("Calibrated Quaternions")
|
||||
pw.dlog(f"Quaternion w: {calib_q_w}")
|
||||
pw.dlog(f"Quaternion x: {calib_q_x}")
|
||||
pw.dlog(f"Quaternion y: {calib_q_y}")
|
||||
pw.dlog(f"Quaternion z: {calib_q_z}")
|
||||
current_idx += fmt_len
|
||||
track_fmt = "!fffff"
|
||||
fmt_len = struct.calcsize(track_fmt)
|
||||
(track_confidence, track_q_w, track_q_x, track_q_y, track_q_z) = struct.unpack(
|
||||
track_fmt, hk_data[current_idx : current_idx + fmt_len]
|
||||
)
|
||||
pw.dlog(f"Track Confidence: {track_confidence}")
|
||||
pw.dlog(f"Track QW: {track_q_w}")
|
||||
pw.dlog(f"Track QX: {track_q_x}")
|
||||
pw.dlog(f"Track QY: {track_q_y}")
|
||||
pw.dlog(f"Track QZ: {track_q_z}")
|
||||
current_idx += fmt_len
|
||||
track_removed = hk_data[current_idx]
|
||||
pw.dlog(f"Number of stars removed from tracking solution: {track_removed}")
|
||||
current_idx += 1
|
||||
stars_centroided = hk_data[current_idx]
|
||||
pw.dlog(f"Centroided stars: {stars_centroided}")
|
||||
current_idx += 1
|
||||
stars_matched_database = hk_data[current_idx]
|
||||
pw.dlog(f"Stars matched: {stars_matched_database}")
|
||||
current_idx += 1
|
||||
# Result of LISA: Lost in space algorithm
|
||||
lisa_fmt = "!fffffB"
|
||||
fmt_len = struct.calcsize(track_fmt)
|
||||
(lisa_q_w, lisa_q_x, lisa_q_y, lisa_q_z) = struct.unpack(
|
||||
lisa_fmt, hk_data[current_idx : current_idx + fmt_len]
|
||||
)
|
||||
pw.dlog(f"LISA QW: {lisa_q_w}")
|
||||
pw.dlog(f"LISA QX: {lisa_q_x}")
|
||||
pw.dlog(f"LISA QY: {lisa_q_y}")
|
||||
pw.dlog(f"LISA QZ: {lisa_q_z}")
|
||||
current_idx += fmt_len
|
||||
is_trusworthy = hk_data[current_idx]
|
||||
pw.dlog(f"Trustworthy solution: {is_trusworthy}")
|
||||
current_idx += 1
|
||||
stable_count = struct.unpack("!I", hk_data[current_idx : current_idx + 4])
|
||||
pw.dlog(f"Stable count: {stable_count}")
|
||||
current_idx += 4
|
||||
solution_strategy = hk_data[current_idx]
|
||||
pw.dlog(f"Solution strategy: {solution_strategy}")
|
||||
pw.printer.print_validity_buffer(hk_data[current_idx:], 23)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_str_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
|
@ -1,4 +1,7 @@
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.tmtc.obj_prompt import prompt_object
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
@ -6,32 +9,57 @@ from tmtccmd.config.tmtc import (
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.pus.s201_fsfw_health import Subservice
|
||||
from tmtccmd.pus.s201_fsfw_health import Subservice, FsfwHealth
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
|
||||
|
||||
class OpCode:
|
||||
SET_HEALTH = "set_health"
|
||||
ANNOUNCE_HEALTH_ALL = "read_health_all"
|
||||
ANNOUNCE_HEALTH = "read_health"
|
||||
|
||||
|
||||
class Info:
|
||||
SET_HEALTH = "Set health of specific object"
|
||||
ANNOUNCE_HEALTH_ALL = "Read all health states"
|
||||
ANNOUNCE_HEALTH = "Read health state of one object"
|
||||
|
||||
|
||||
def prompt_health() -> FsfwHealth:
|
||||
for item in FsfwHealth:
|
||||
print(f"{item}: {item.name}")
|
||||
health_idx = int(input("Please enter health by index: "))
|
||||
return FsfwHealth(health_idx)
|
||||
|
||||
|
||||
@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()
|
||||
if o == OpCode.SET_HEALTH:
|
||||
app_data = bytearray(prompt_object())
|
||||
health = prompt_health()
|
||||
app_data.append(health)
|
||||
q.add_log_cmd(Info.SET_HEALTH)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=201, subservice=Subservice.TC_SET_HEALTH, app_data=app_data
|
||||
)
|
||||
)
|
||||
elif o == OpCode.ANNOUNCE_HEALTH:
|
||||
app_data = bytearray(prompt_object())
|
||||
q.add_log_cmd(Info.ANNOUNCE_HEALTH)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=201, subservice=Subservice.TC_ANNOUNCE_HEALTH, app_data=app_data
|
||||
)
|
||||
)
|
||||
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
|
||||
else:
|
||||
raise ValueError(f"unknown op code {o} for service {CustomServiceList.HEALTH}")
|
||||
|
||||
|
||||
@ -40,4 +68,5 @@ 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)
|
||||
oce.add(OpCode.SET_HEALTH, Info.SET_HEALTH)
|
||||
defs.add_service(CustomServiceList.HEALTH, info="Health Service", op_code_entry=oce)
|
||||
|
43
eive_tmtc/tmtc/obj_prompt.py
Normal file
43
eive_tmtc/tmtc/obj_prompt.py
Normal file
@ -0,0 +1,43 @@
|
||||
from eive_tmtc.config.object_ids import (
|
||||
ACS_SUBSYSTEM_ID,
|
||||
ACS_CONTROLLER,
|
||||
IMTQ_HANDLER_ID,
|
||||
GYRO_0_ADIS_HANDLER_ID,
|
||||
GYRO_1_L3G_HANDLER_ID,
|
||||
ACS_BOARD_ASS_ID,
|
||||
RW_ASSEMBLY,
|
||||
SUS_BOARD_ASS_ID,
|
||||
)
|
||||
|
||||
SUBSYSTEM_DICT = {
|
||||
0: "acs",
|
||||
1: "tcs",
|
||||
2: "com",
|
||||
}
|
||||
|
||||
ACS_OBJ_DICT = {
|
||||
0: ("Subsystem", ACS_SUBSYSTEM_ID),
|
||||
1: ("SUS Assembly", SUS_BOARD_ASS_ID),
|
||||
2: ("ACS Board Assembly", ACS_BOARD_ASS_ID),
|
||||
3: ("RW Assembly", RW_ASSEMBLY),
|
||||
4: ("iMTQ MGT", IMTQ_HANDLER_ID),
|
||||
5: ("GYR 0 ADIS", GYRO_0_ADIS_HANDLER_ID),
|
||||
6: ("GYR 1 L3G", GYRO_1_L3G_HANDLER_ID),
|
||||
}
|
||||
|
||||
|
||||
def prompt_object() -> bytes:
|
||||
for k, v in SUBSYSTEM_DICT.items():
|
||||
print(f"{k}: {v}")
|
||||
subsystem_key = int(input("Please specify target subsystem by key: "))
|
||||
subsystem = SUBSYSTEM_DICT[subsystem_key]
|
||||
if subsystem is None:
|
||||
raise ValueError("invalid key")
|
||||
if subsystem == "acs":
|
||||
for k, v in ACS_OBJ_DICT.items():
|
||||
print(f"{k}: {v[0]}")
|
||||
obj_key = int(input("Please specify target object by key: "))
|
||||
acs_obj = ACS_OBJ_DICT[obj_key]
|
||||
if acs_obj is None:
|
||||
raise ValueError("invalid key")
|
||||
return acs_obj[1]
|
@ -21,26 +21,26 @@ from spacepackets.ecss.tc import PusTelecommand
|
||||
|
||||
|
||||
class Heater(enum.IntEnum):
|
||||
HEATER_0_OBC_BRD = 0
|
||||
HEATER_1_PLOC_PROC_BRD = 1
|
||||
HEATER_0_PLOC_PROC_BRD = 0
|
||||
HEATER_1_PCDU_BRD = 1
|
||||
HEATER_2_ACS_BRD = 2
|
||||
HEATER_3_PCDU_PDU = 3
|
||||
HEATER_3_OBC_BRD = 3
|
||||
HEATER_4_CAMERA = 4
|
||||
HEATER_5_STR = 5
|
||||
HEATER_6_DRO = 6
|
||||
HEATER_7_HPA = 7
|
||||
HEATER_7_SYRLINKS = 7
|
||||
NUMBER_OF_SWITCHES = 8
|
||||
|
||||
|
||||
HEATER_LOCATION = [
|
||||
"OBC Board",
|
||||
"PLOC Processing Board",
|
||||
"ACS Board",
|
||||
"PCDU PDU",
|
||||
"ACS Board",
|
||||
"OBC Board",
|
||||
"Camera",
|
||||
"Startracker",
|
||||
"DRO",
|
||||
"HPA",
|
||||
"Syrlinks",
|
||||
]
|
||||
|
||||
|
||||
@ -135,25 +135,25 @@ def pack_heater_cmds(object_id: bytearray, op_code: str, q: DefaultPusQueueHelpe
|
||||
|
||||
def heater_idx_to_obj(heater: int) -> ObjectIdU32:
|
||||
from eive_tmtc.config.object_ids import (
|
||||
HEATER_0_OBC_BRD,
|
||||
HEATER_1_PLOC_PROC_BRD,
|
||||
HEATER_0_PLOC_PROC_BRD,
|
||||
HEATER_1_PCDU_BRD,
|
||||
HEATER_2_ACS_BRD,
|
||||
HEATER_3_PCDU_BRD,
|
||||
HEATER_3_OBC_BRD,
|
||||
HEATER_4_CAMERA,
|
||||
HEATER_5_STR,
|
||||
HEATER_6_DRO,
|
||||
HEATER_7_HPA,
|
||||
HEATER_7_SYRLINKS,
|
||||
)
|
||||
|
||||
obj_id_array = [
|
||||
HEATER_0_OBC_BRD,
|
||||
HEATER_1_PLOC_PROC_BRD,
|
||||
HEATER_0_PLOC_PROC_BRD,
|
||||
HEATER_1_PCDU_BRD,
|
||||
HEATER_2_ACS_BRD,
|
||||
HEATER_3_PCDU_BRD,
|
||||
HEATER_3_OBC_BRD,
|
||||
HEATER_4_CAMERA,
|
||||
HEATER_5_STR,
|
||||
HEATER_6_DRO,
|
||||
HEATER_7_HPA,
|
||||
HEATER_7_SYRLINKS,
|
||||
]
|
||||
obj_dict = get_object_ids()
|
||||
obj_id_obj = obj_dict.get(obj_id_array[heater])
|
||||
|
@ -40,7 +40,7 @@ class Tmp1075ActionId(enum.IntEnum):
|
||||
|
||||
|
||||
class SetId:
|
||||
TMEPERATURE = 1
|
||||
TEMPERATURE = 1
|
||||
|
||||
|
||||
def pack_tmp1075_test_into(
|
||||
@ -64,7 +64,7 @@ def pack_tmp1075_test_into(
|
||||
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)))
|
||||
q.add_pus_tc(create_request_one_hk_command(make_sid(obyt, SetId.TEMPERATURE)))
|
||||
return q
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user