device temperature set parsing
This commit is contained in:
parent
210ec8805c
commit
38b8f2a02f
@ -13,7 +13,7 @@
|
|||||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcgui.py" />
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcgui.py" />
|
||||||
<option name="PARAMETERS" value="-l" />
|
<option name="PARAMETERS" value="" />
|
||||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
<option name="EMULATE_TERMINAL" value="false" />
|
<option name="EMULATE_TERMINAL" value="false" />
|
||||||
<option name="MODULE_MODE" value="false" />
|
<option name="MODULE_MODE" value="false" />
|
||||||
|
@ -286,7 +286,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
|||||||
|
|
||||||
if op_code in OpCodes.TV_SETUP_TCS_FT_ON:
|
if op_code in OpCodes.TV_SETUP_TCS_FT_ON:
|
||||||
# Enable scheduling
|
# Enable scheduling
|
||||||
tc_queue.appendleft(generate_enable_tc_sched_cmd(22).pack_command_tuple())
|
tc_queue.appendleft(generate_enable_tc_sched_cmd(ssc=22).pack_command_tuple())
|
||||||
# check whether tcs_assembly also has to be commanded to NORMAL Mode
|
# check whether tcs_assembly also has to be commanded to NORMAL Mode
|
||||||
pack_tcs_sys_commands(
|
pack_tcs_sys_commands(
|
||||||
tc_queue=tc_queue, op_code=TcsOpCodes.TCS_BOARD_ASS_NORMAL[0]
|
tc_queue=tc_queue, op_code=TcsOpCodes.TCS_BOARD_ASS_NORMAL[0]
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
"""HK Handling for EIVE OBSW"""
|
"""HK Handling for EIVE OBSW"""
|
||||||
import struct
|
|
||||||
|
|
||||||
from pus_tm.devs.plpcdu import handle_plpcdu_hk
|
from pus_tm.devs.plpcdu import handle_plpcdu_hk
|
||||||
from pus_tm.devs.rad_sensor import handle_rad_sensor_data
|
from pus_tm.devs.rad_sensor import handle_rad_sensor_data
|
||||||
from pus_tm.devs.sus import handle_sus_hk
|
from pus_tm.devs.sus import handle_sus_hk
|
||||||
from pus_tm.system.tcs import handle_thermal_controller_hk_data, TM_TCP_SERVER
|
from pus_tm.system.tcs import handle_thermal_controller_hk_data
|
||||||
from tmtccmd.config.definitions import HkReplyUnpacked
|
|
||||||
from tmtccmd.tm.pus_3_fsfw_hk import (
|
from tmtccmd.tm.pus_3_fsfw_hk import (
|
||||||
Service3Base,
|
Service3Base,
|
||||||
HkContentType,
|
HkContentType,
|
||||||
@ -27,9 +25,10 @@ from pus_tm.devs.pcdu import handle_pdu_data, handle_p60_hk_data, handle_acu_hk_
|
|||||||
from pus_tm.devs.syrlinks import handle_syrlinks_hk_data
|
from pus_tm.devs.syrlinks import handle_syrlinks_hk_data
|
||||||
from pus_tc.devs.imtq import ImtqSetIds
|
from pus_tc.devs.imtq import ImtqSetIds
|
||||||
from pus_tm.devs.reaction_wheels import handle_rw_hk_data
|
from pus_tm.devs.reaction_wheels import handle_rw_hk_data
|
||||||
from pus_tm.defs import FsfwTmTcPrinter, log_to_both
|
from pus_tm.defs import FsfwTmTcPrinter
|
||||||
from pus_tm.system.core import handle_core_hk_data
|
from pus_tm.system.core import handle_core_hk_data
|
||||||
from pus_tm.devs.mgms import handle_mgm_hk_data
|
from pus_tm.devs.mgms import handle_mgm_hk_data
|
||||||
|
from pus_tm.tcp_server_objects import tcp_server_sensor_temperatures
|
||||||
import config.object_ids as obj_ids
|
import config.object_ids as obj_ids
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +46,7 @@ def handle_hk_packet(
|
|||||||
named_obj_id = tm_packet.object_id
|
named_obj_id = tm_packet.object_id
|
||||||
if tm_packet.subservice == 25 or tm_packet.subservice == 26:
|
if tm_packet.subservice == 25 or tm_packet.subservice == 26:
|
||||||
hk_data = tm_packet.tm_data[8:]
|
hk_data = tm_packet.tm_data[8:]
|
||||||
TM_TCP_SERVER.report_raw_hk_data(
|
tcp_server_sensor_temperatures.report_raw_hk_data(
|
||||||
object_id=named_obj_id, set_id=tm_packet.set_id, hk_data=hk_data
|
object_id=named_obj_id, set_id=tm_packet.set_id, hk_data=hk_data
|
||||||
)
|
)
|
||||||
printer.generic_hk_tm_print(
|
printer.generic_hk_tm_print(
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
import struct
|
import struct
|
||||||
|
|
||||||
from pus_tm.defs import PrintWrapper
|
from pus_tm.defs import PrintWrapper
|
||||||
from pus_tm.tm_tcp_server import TmTcpServer
|
from pus_tm.tcp_server_objects import *
|
||||||
from tmtccmd.utility import ObjectId
|
from tmtccmd.utility import ObjectId
|
||||||
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
|
|
||||||
TM_TCP_SERVER = TmTcpServer.get_instance()
|
|
||||||
|
|
||||||
|
|
||||||
def handle_thermal_controller_hk_data(
|
def handle_thermal_controller_hk_data(
|
||||||
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
||||||
):
|
):
|
||||||
if set_id == 0:
|
if set_id == 0:
|
||||||
pw = PrintWrapper(printer)
|
pw = PrintWrapper(printer)
|
||||||
pw.dlog("Received Sensor Temperature data")
|
pw.dlog("Received sensor temperature data")
|
||||||
|
|
||||||
# get all the floats
|
# get all the floats
|
||||||
tm_data = struct.unpack("!ffffffffffffffffff", hk_data[: 18 * 4])
|
tm_data = struct.unpack("!ffffffffffffffffff", hk_data[:18 * 4])
|
||||||
parsed_data = {"SENSOR_PLOC_HEATSPREADER": tm_data[0], "SENSOR_PLOC_MISSIONBOARD": tm_data[1],
|
parsed_data = {"SENSOR_PLOC_HEATSPREADER": tm_data[0], "SENSOR_PLOC_MISSIONBOARD": tm_data[1],
|
||||||
"SENSOR_4K_CAMERA": tm_data[2], "SENSOR_DAC_HEATSPREADER": tm_data[3],
|
"SENSOR_4K_CAMERA": tm_data[2], "SENSOR_DAC_HEATSPREADER": tm_data[3],
|
||||||
"SENSOR_STARTRACKER": tm_data[4], "SENSOR_RW1": tm_data[5], "SENSOR_DRO": tm_data[6],
|
"SENSOR_STARTRACKER": tm_data[4], "SENSOR_RW1": tm_data[5], "SENSOR_DRO": tm_data[6],
|
||||||
@ -27,5 +24,40 @@ def handle_thermal_controller_hk_data(
|
|||||||
"SENSOR_MAGNETTORQUER": tm_data[15], "TMP1075 1": tm_data[16], "TMP1075 2": tm_data[17]}
|
"SENSOR_MAGNETTORQUER": tm_data[15], "TMP1075 1": tm_data[16], "TMP1075 2": tm_data[17]}
|
||||||
|
|
||||||
print(parsed_data)
|
print(parsed_data)
|
||||||
|
tcp_server_sensor_temperatures.report_parsed_hk_data(object_id, set_id, parsed_data)
|
||||||
|
elif set_id == 1:
|
||||||
|
pw = PrintWrapper(printer)
|
||||||
|
pw.dlog("Received device temperature data")
|
||||||
|
|
||||||
TM_TCP_SERVER.report_parsed_hk_data(object_id, set_id, parsed_data)
|
fmt_str = "!fffffiiiiffffhhhhhhhfffffff"
|
||||||
|
tm_data = struct.unpack(fmt_str, hk_data[:90])
|
||||||
|
parsed_data = {
|
||||||
|
"Q7S_TEMPERATURE": tm_data[0],
|
||||||
|
"BATTERY_TEMPERATURE_1": tm_data[1],
|
||||||
|
"BATTERY_TEMPERATURE_2": tm_data[2],
|
||||||
|
"BATTERY_TEMPERATURE_3": tm_data[3],
|
||||||
|
"BATTERY_TEMPERATURE_4": tm_data[4],
|
||||||
|
"RW_1_TEMPERATURE": tm_data[5],
|
||||||
|
"RW_2_TEMPERATURE": tm_data[6],
|
||||||
|
"RW_3_TEMPERATURE": tm_data[7],
|
||||||
|
"RW_4_TEMPERATURE": tm_data[8],
|
||||||
|
"STARTRACKER_TEMPERATURE": tm_data[9],
|
||||||
|
"SYRLINKS_POWER_AMPLIFIER_TEMPERATURE": tm_data[10],
|
||||||
|
"SYRLINKS_BASEBAND_BOARD_TEMPERATURE": tm_data[11],
|
||||||
|
"MGT_TEMPERATURE": tm_data[12],
|
||||||
|
"ACU_TEMPERATURE_1": tm_data[13],
|
||||||
|
"ACU_TEMPERATURE_2": tm_data[14],
|
||||||
|
"ACU_TEMPERATURE_3": tm_data[15],
|
||||||
|
"PDU1_TEMPERATURE": tm_data[16],
|
||||||
|
"PDU2_TEMPERATURE": tm_data[17],
|
||||||
|
"P60DOCK_TEMPERATURE_1": tm_data[18],
|
||||||
|
"P60DOCK_TEMPERATURE_2": tm_data[19],
|
||||||
|
"GYRO_0_TEMPERATURE": tm_data[20],
|
||||||
|
"GYRO_1_TEMPERATURE": tm_data[21],
|
||||||
|
"GYRO_2_TEMPERATURE": tm_data[22],
|
||||||
|
"GYRO_3_TEMPERATURE": tm_data[23],
|
||||||
|
"MGM_0_TEMPERATURE": tm_data[24],
|
||||||
|
"MGM_1_TEMPERATURE": tm_data[25],
|
||||||
|
"ADC_PL_PCDU_TEMPERATURE": tm_data[26],
|
||||||
|
}
|
||||||
|
tcp_server_device_temperatures.report_parsed_hk_data(object_id, set_id, parsed_data)
|
||||||
|
4
pus_tm/tcp_server_objects.py
Normal file
4
pus_tm/tcp_server_objects.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
from pus_tm.tm_tcp_server import TmTcpServer
|
||||||
|
|
||||||
|
tcp_server_sensor_temperatures = TmTcpServer("localhost", 7305)
|
||||||
|
tcp_server_device_temperatures = TmTcpServer("localhost", 7306)
|
@ -7,21 +7,16 @@ from tmtccmd.logging import get_console_logger
|
|||||||
from tmtccmd.utility.obj_id import ObjectId
|
from tmtccmd.utility.obj_id import ObjectId
|
||||||
from dle_encoder import DleEncoder
|
from dle_encoder import DleEncoder
|
||||||
|
|
||||||
# TODO add to configuration parameters
|
|
||||||
SERVER_HOST = "localhost"
|
|
||||||
SERVER_PORT = 7305
|
|
||||||
|
|
||||||
LOGGER = get_console_logger()
|
LOGGER = get_console_logger()
|
||||||
|
|
||||||
|
|
||||||
class TmTcpServer:
|
class TmTcpServer:
|
||||||
_Instance = None
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, ip_address: str, port: int):
|
||||||
|
|
||||||
self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
|
||||||
self.server_socket.bind((SERVER_HOST, SERVER_PORT))
|
self.server_socket.bind((ip_address, port))
|
||||||
|
|
||||||
# for now, only accept one connection
|
# for now, only accept one connection
|
||||||
self.server_socket.listen(0)
|
self.server_socket.listen(0)
|
||||||
@ -43,12 +38,6 @@ class TmTcpServer:
|
|||||||
if self.client_connection is not None:
|
if self.client_connection is not None:
|
||||||
self.client_connection.close()
|
self.client_connection.close()
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_instance():
|
|
||||||
if TmTcpServer._Instance is None:
|
|
||||||
TmTcpServer._Instance = TmTcpServer()
|
|
||||||
return TmTcpServer._Instance
|
|
||||||
|
|
||||||
def _send_dictionary_over_socket(self, dictionary):
|
def _send_dictionary_over_socket(self, dictionary):
|
||||||
# keep listeners current
|
# keep listeners current
|
||||||
if self.client_connection is None:
|
if self.client_connection is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user