Update tmtccmd #21
@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="tmtcc Listener Mode" type="PythonConfigurationType" factoryName="Python" folderName="PUS">
|
||||
<configuration default="false" name="tmtccmd Listener Mode" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="tmtc" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
@ -19,6 +19,8 @@ SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x41, 0x10, 0xA2])
|
||||
SYRLINKS_HANDLER = bytes([0x44, 0x53, 0x00, 0xA3])
|
||||
IMTQ_HANDLER_ID = bytes([0x44, 0x14, 0x00, 0x14])
|
||||
PLOC_MPSOC_ID = bytes([0x44, 0x33, 0x00, 0x15])
|
||||
GPS_HANDLER_0_ID = bytes([0x44, 0x13, 0x00, 0x45])
|
||||
GPS_HANDLER_1_ID = bytes([0x44, 0x13, 0x01, 0x46])
|
||||
RW1_ID = bytes([0x44, 0x12, 0x00, 0x1])
|
||||
RW2_ID = bytes([0x44, 0x12, 0x00, 0x2])
|
||||
RW3_ID = bytes([0x44, 0x12, 0x00, 0x3])
|
||||
|
@ -1,9 +1,4 @@
|
||||
"""
|
||||
@brief This file transfers control of housekeeping handling (PUS service 3) to the
|
||||
developer
|
||||
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
||||
it to your needs.
|
||||
"""
|
||||
"""HK Handling for EIVE OBSW"""
|
||||
import struct
|
||||
from typing import Tuple
|
||||
|
||||
@ -11,30 +6,13 @@ from tmtccmd.tm.service_3_housekeeping import Service3Base
|
||||
from tmtccmd.utility.logger import get_console_logger
|
||||
from pus_tc.syrlinks_hk_handler import SetIds
|
||||
from pus_tc.imtq import ImtqSetIds
|
||||
from config.object_ids import SYRLINKS_HANDLER, IMTQ_HANDLER_ID
|
||||
from config.object_ids import SYRLINKS_HANDLER, IMTQ_HANDLER_ID, GPS_HANDLER_0_ID, GPS_HANDLER_1_ID
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
def handle_user_hk_packet(object_id: bytes, set_id: int, hk_data: bytearray,
|
||||
service3_packet: Service3Base) -> Tuple[list, list, bytearray, int]:
|
||||
"""
|
||||
This function is called when a Service 3 Housekeeping packet is received.
|
||||
|
||||
Please note that the object IDs should be compared by value because direct comparison of
|
||||
enumerations does not work in Python. For example use:
|
||||
|
||||
if object_id.value == ObjectIds.TEST_OBJECT.value
|
||||
|
||||
to test equality based on the object ID list.
|
||||
|
||||
@param object_id:
|
||||
@param set_id:
|
||||
@param hk_data:
|
||||
@param service3_packet:
|
||||
@return: Expects a tuple, consisting of two lists, a bytearray and an integer
|
||||
The first list contains the header columns, the second list the list with
|
||||
the corresponding values. The bytearray is the validity buffer, which is usually appended
|
||||
at the end of the housekeeping packet. The last value is the number of parameters.
|
||||
"""This function is called when a Service 3 Housekeeping packet is received.
|
||||
"""
|
||||
if object_id == SYRLINKS_HANDLER:
|
||||
if set_id == SetIds.RX_REGISTERS_DATASET:
|
||||
@ -50,6 +28,8 @@ def handle_user_hk_packet(object_id: bytes, set_id: int, hk_data: bytearray,
|
||||
else:
|
||||
LOGGER.info("Serive 3 TM: Syrlinks handler reply with unknown set id")
|
||||
return [], [], bytearray(), 0
|
||||
elif object_id == GPS_HANDLER_0_ID or object_id == GPS_HANDLER_1_ID
|
||||
return handle_gps_data(hk_data=hk_data)
|
||||
else:
|
||||
LOGGER.info("Service 3 TM: Parsing for this SID has not been implemented.")
|
||||
return [], [], bytearray(), 0
|
||||
@ -90,16 +70,18 @@ def handle_self_test_data(hk_data: bytearray) -> Tuple[list, list, bytearray, in
|
||||
hk_header = []
|
||||
hk_content = []
|
||||
validity_buffer = bytearray()
|
||||
hk_header = ["Init Err", "Init Raw Mag X [nT]", "Init Raw Mag Y [nT]", "Init Raw Mag Z [nT]", "Init Cal Mag X [nT]",
|
||||
"Init Cal Mag Y [nT]", "Init Cal Mag Z [nT]", "Init Coil X Current [mA]", "Init Coil Y Current [mA]",
|
||||
"Init Coil Z Current [mA]", "Init Coil X Temperature [°C]", "Init Coil Y Temperature [°C]",
|
||||
"Init Coil Z Temperature [°C]", "Err", "Raw Mag X [nT]", "Raw Mag Y [nT]", "Raw Mag Z [nT]",
|
||||
"Cal Mag X [nT]", "Cal Mag Y [nT]", "Cal Mag Z [nT]", "Coil X Current [mA]", "Coil Y Current [mA]",
|
||||
"Coil Z Current [mA]", "Coil X Temperature [°C]", "Coil Y Temperature [°C]", "Coil Z Temperature [°C]",
|
||||
"Fina Err", "Fina Raw Mag X [nT]", "Fina Raw Mag Y [nT]", "Fina Raw Mag Z [nT]", "Fina Cal Mag X [nT]",
|
||||
"Fina Cal Mag Y [nT]", "Fina Cal Mag Z [nT]", "Fina Coil X Current [mA]", "Fina Coil Y Current [mA]",
|
||||
"Fina Coil Z Current [mA]", "Fina Coil X Temperature [°C]", "Fina Coil Y Temperature [°C]",
|
||||
"Fina Coil Z Temperature [°C]"]
|
||||
hk_header = [
|
||||
"Init Err", "Init Raw Mag X [nT]", "Init Raw Mag Y [nT]", "Init Raw Mag Z [nT]", "Init Cal Mag X [nT]",
|
||||
"Init Cal Mag Y [nT]", "Init Cal Mag Z [nT]", "Init Coil X Current [mA]", "Init Coil Y Current [mA]",
|
||||
"Init Coil Z Current [mA]", "Init Coil X Temperature [°C]", "Init Coil Y Temperature [°C]",
|
||||
"Init Coil Z Temperature [°C]", "Err", "Raw Mag X [nT]", "Raw Mag Y [nT]", "Raw Mag Z [nT]",
|
||||
"Cal Mag X [nT]", "Cal Mag Y [nT]", "Cal Mag Z [nT]", "Coil X Current [mA]", "Coil Y Current [mA]",
|
||||
"Coil Z Current [mA]", "Coil X Temperature [°C]", "Coil Y Temperature [°C]", "Coil Z Temperature [°C]",
|
||||
"Fina Err", "Fina Raw Mag X [nT]", "Fina Raw Mag Y [nT]", "Fina Raw Mag Z [nT]", "Fina Cal Mag X [nT]",
|
||||
"Fina Cal Mag Y [nT]", "Fina Cal Mag Z [nT]", "Fina Coil X Current [mA]", "Fina Coil Y Current [mA]",
|
||||
"Fina Coil Z Current [mA]", "Fina Coil X Temperature [°C]", "Fina Coil Y Temperature [°C]",
|
||||
"Fina Coil Z Temperature [°C]"
|
||||
]
|
||||
# INIT step (no coil actuation)
|
||||
init_err = hk_data[0]
|
||||
init_raw_mag_x = struct.unpack('!f', hk_data[1:5])[0]
|
||||
@ -145,13 +127,19 @@ def handle_self_test_data(hk_data: bytearray) -> Tuple[list, list, bytearray, in
|
||||
fina_coil_y_temperature = struct.unpack('!H', hk_data[125:127])[0]
|
||||
fina_coil_z_temperature = struct.unpack('!H', hk_data[127:129])[0]
|
||||
|
||||
hk_content = [init_err, init_raw_mag_x, init_raw_mag_y, init_raw_mag_z, init_cal_mag_x, init_cal_mag_y,
|
||||
init_cal_mag_z, init_coil_x_current, init_coil_y_current, init_coil_z_current,
|
||||
init_coil_x_temperature, init_coil_y_temperature, init_coil_z_temperature, err, raw_mag_x,
|
||||
init_raw_mag_y, raw_mag_z, cal_mag_x, cal_mag_y, cal_mag_z, coil_x_current, coil_y_current,
|
||||
coil_z_current, coil_x_temperature, coil_y_temperature, coil_z_temperature, fina_err, fina_raw_mag_x,
|
||||
fina_raw_mag_y, fina_raw_mag_z, fina_cal_mag_x, fina_cal_mag_y, fina_cal_mag_z, fina_coil_x_current,
|
||||
fina_coil_y_current, fina_coil_z_current, fina_coil_x_temperature, fina_coil_y_temperature,
|
||||
fina_coil_z_temperature]
|
||||
hk_content = [
|
||||
init_err, init_raw_mag_x, init_raw_mag_y, init_raw_mag_z, init_cal_mag_x, init_cal_mag_y,
|
||||
init_cal_mag_z, init_coil_x_current, init_coil_y_current, init_coil_z_current,
|
||||
init_coil_x_temperature, init_coil_y_temperature, init_coil_z_temperature, err, raw_mag_x,
|
||||
init_raw_mag_y, raw_mag_z, cal_mag_x, cal_mag_y, cal_mag_z, coil_x_current, coil_y_current,
|
||||
coil_z_current, coil_x_temperature, coil_y_temperature, coil_z_temperature, fina_err, fina_raw_mag_x,
|
||||
fina_raw_mag_y, fina_raw_mag_z, fina_cal_mag_x, fina_cal_mag_y, fina_cal_mag_z, fina_coil_x_current,
|
||||
fina_coil_y_current, fina_coil_z_current, fina_coil_x_temperature, fina_coil_y_temperature,
|
||||
fina_coil_z_temperature
|
||||
]
|
||||
|
||||
return hk_header, hk_content, validity_buffer, len(hk_header)
|
||||
|
||||
|
||||
def handle_gps_data(hk_data: bytearray):
|
||||
LOGGER.info('Received GPS data')
|
||||
|
2
tmtccmd
2
tmtccmd
@ -1 +1 @@
|
||||
Subproject commit d1312fce4bbd40b0b594a519b98cb51e61bc784f
|
||||
Subproject commit 51619f4724b443a1ce0b5949dd1c1eb9c9eaead0
|
Loading…
Reference in New Issue
Block a user