update tmtc

This commit is contained in:
Robin Müller 2022-08-18 11:09:35 +02:00
parent 8ead0b06d6
commit 2d2702381a
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
11 changed files with 69 additions and 35 deletions

View File

@ -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 17 -o 0 -d 3" />
<option name="PARAMETERS" value="-s test -o ping -d 3" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />

View File

@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Service 17 w Listener" type="PythonConfigurationType" factoryName="Python" folderName="PUS">
<configuration default="false" name="Test Service w Listener" type="PythonConfigurationType" factoryName="Python" folderName="PUS">
<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 17 -l" />
<option name="PARAMETERS" value="-s test -l" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />

View File

@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Service 17" type="PythonConfigurationType" factoryName="Python" folderName="PUS">
<configuration default="false" name="Test Service" type="PythonConfigurationType" factoryName="Python" folderName="PUS">
<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 17" />
<option name="PARAMETERS" value="-s test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />

View File

@ -11,7 +11,9 @@ PUS_APID = 0x65
SPACE_PACKET_IDS = (0x08 << 8 | PUS_APID,)
class CustomServiceList(enum.Enum):
class CustomServiceList(str, enum.Enum):
value: str
TEST_DEVICE = "test"
P60DOCK = "p60dock"
PDU1 = "pdu1"

2
deps/tmtccmd vendored

@ -1 +1 @@
Subproject commit d042315e4cc0b5d0b13ceaaf5e3f36e8ad455740
Subproject commit 9bea7dc80f855965eb8466419bcb03eb58acc162

View File

@ -1,7 +1,7 @@
from pus_tc.devs.bpx_batt import BpxOpCodes
from config.definitions import CustomServiceList
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry, CoreServiceList
from tmtccmd.config.tmtc import (
tmtc_definitions_provider,
call_all_definitions_providers,
@ -14,6 +14,20 @@ def get_eive_service_op_code_dict() -> TmtcDefinitionWrapper:
the :py:func:`tmtc_definitions_provider` decorator.
"""
def_wrapper = get_default_tmtc_defs()
srv_5 = OpCodeEntry()
srv_5.add("0", "Event Test")
def_wrapper.add_service(
name=CoreServiceList.SERVICE_5.value,
info="PUS Service 5 Event",
op_code_entry=srv_5,
)
srv_17 = OpCodeEntry()
srv_17.add("0", "Ping Test")
def_wrapper.add_service(
name=CoreServiceList.SERVICE_17_ALT,
info="PUS Service 17 Test",
op_code_entry=srv_17,
)
call_all_definitions_providers(def_wrapper)
return def_wrapper

View File

@ -0,0 +1 @@
from . import power

View File

@ -274,25 +274,6 @@ def pdu2_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
q.add_pus_tc(generate_one_hk_command(sid=hk_sid))
def pack_power_commands(q: DefaultPusQueueHelper, op_code: str):
pdu1_cmds(q, op_code)
pdu2_cmds(q, op_code)
if op_code in PowerOpCodes.INFO_CORE:
pdu1_req_hk_cmds(q, GomspaceOpCodes.REQUEST_CORE_HK_ONCE[0])
pdu2_req_hk_cmds(q, GomspaceOpCodes.REQUEST_CORE_HK_ONCE[0])
q.add_wait_seconds(3.0)
elif op_code in PowerOpCodes.INFO_AUX:
pdu1_req_hk_cmds(q, GomspaceOpCodes.REQUEST_AUX_HK_ONCE[0])
pdu2_req_hk_cmds(q, GomspaceOpCodes.REQUEST_AUX_HK_ONCE[0])
q.add_wait_seconds(3.0)
elif op_code in PowerOpCodes.INFO_ALL:
pdu1_req_hk_cmds(q, GomspaceOpCodes.REQUEST_CORE_HK_ONCE[0])
pdu2_req_hk_cmds(q, GomspaceOpCodes.REQUEST_CORE_HK_ONCE[0])
pdu1_req_hk_cmds(q, GomspaceOpCodes.REQUEST_AUX_HK_ONCE[0])
pdu2_req_hk_cmds(q, GomspaceOpCodes.REQUEST_AUX_HK_ONCE[0])
q.add_wait_seconds(3.0)
def tcs_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.TCS, Pdu1ChIndex.TCS)

View File

@ -1,18 +1,46 @@
from gomspace.gomspace_common import GsInfo
from pus_tc.devs.common_power import (
PowerOpCodes,
Pdu1InfoBase,
Pdu2InfoBase,
add_pdu1_common_defs,
add_pdu2_common_defs,
PowerInfo,
pdu1_cmds,
pdu2_cmds,
pdu1_req_hk_cmds,
pdu2_req_hk_cmds,
)
from config.definitions import CustomServiceList
from tmtccmd import get_console_logger
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
from pus_tc.devs.p60dock import P60OpCodes, GomspaceOpCodes, P60Info
from pus_tc.devs.acu import add_acu_cmds
from tmtccmd.config.tmtc import tmtc_definitions_provider
from tmtccmd.tc import DefaultPusQueueHelper
LOGGER = get_console_logger()
def pack_power_commands(q: DefaultPusQueueHelper, op_code: str):
pdu1_cmds(q, op_code)
pdu2_cmds(q, op_code)
if op_code in PowerOpCodes.INFO_CORE:
pdu1_req_hk_cmds(q, GomspaceOpCodes.REQUEST_CORE_HK_ONCE[0])
pdu2_req_hk_cmds(q, GomspaceOpCodes.REQUEST_CORE_HK_ONCE[0])
q.add_wait_seconds(3.0)
elif op_code in PowerOpCodes.INFO_AUX:
pdu1_req_hk_cmds(q, GomspaceOpCodes.REQUEST_AUX_HK_ONCE[0])
pdu2_req_hk_cmds(q, GomspaceOpCodes.REQUEST_AUX_HK_ONCE[0])
q.add_wait_seconds(3.0)
elif op_code in PowerOpCodes.INFO_ALL:
pdu1_req_hk_cmds(q, GomspaceOpCodes.REQUEST_CORE_HK_ONCE[0])
pdu2_req_hk_cmds(q, GomspaceOpCodes.REQUEST_CORE_HK_ONCE[0])
pdu1_req_hk_cmds(q, GomspaceOpCodes.REQUEST_AUX_HK_ONCE[0])
pdu2_req_hk_cmds(q, GomspaceOpCodes.REQUEST_AUX_HK_ONCE[0])
q.add_wait_seconds(3.0)
if q.empty():
LOGGER.info(f"Queue is empty, no stack for op code {op_code}")
@tmtc_definitions_provider

View File

@ -2,7 +2,7 @@
"""
from typing import cast
from pus_tc.devs.common_power import pack_power_commands
from pus_tc.devs.power import pack_power_commands
from pus_tc.devs.rtd import pack_rtd_commands
from pus_tc.devs.scex import pack_scex_cmds
from pus_tc.system.controllers import (
@ -85,7 +85,10 @@ def handle_default_procedure(
obj_id_man = get_object_ids()
if service == CoreServiceList.SERVICE_5.value:
return pack_generic_service_5_test_into(q=queue_helper)
if service == CoreServiceList.SERVICE_17.value:
if (
service == CoreServiceList.SERVICE_17
or service == CoreServiceList.SERVICE_17_ALT
):
return queue_helper.add_pus_tc(pack_service_17_ping_command())
if service == CoreServiceList.SERVICE_200.value:
return pack_service_200_test_into(q=queue_helper)
@ -188,8 +191,9 @@ def handle_default_procedure(
object_id=PDEC_HANDLER_ID, q=queue_helper, op_code=op_code
)
if service == CustomServiceList.SYRLINKS.value:
object_id = cast(ObjectIdU32, obj_id_man.get(SYRLINKS_HANDLER_ID))
return pack_syrlinks_command(
object_id=SYRLINKS_HANDLER_ID, q=queue_helper, op_code=op_code
object_id=object_id, q=queue_helper, op_code=op_code
)
if service == CustomServiceList.SA_DEPLYOMENT.value:
return pack_solar_array_deployment_test_into(

View File

@ -41,7 +41,7 @@ class Info:
DISABLE_MGM_HK = "Disable MGM HK data generation"
PERFORM_MGM_CALIBRATION = True
PERFORM_MGM_CALIBRATION = False
CALIBRATION_SOCKET_HOST = "localhost"
CALIBRATION_SOCKET_PORT = 6677
CALIBRATION_ADDR = (CALIBRATION_SOCKET_HOST, CALIBRATION_SOCKET_PORT)
@ -153,7 +153,9 @@ def perform_mgm_calibration(pw: PrintWrapper, mgm_tuple: Tuple):
CALIBR_SOCKET.sendall(f"{declare_api_cmd}\n".encode())
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)}")
pw.dlog(
f"MGM calibration: Reply received command {declare_api_cmd} has invalid length {len(reply)}"
)
return
else:
if str(reply[0]) == "0":
@ -168,7 +170,9 @@ def perform_mgm_calibration(pw: PrintWrapper, mgm_tuple: Tuple):
CALIBR_SOCKET.sendall(command)
reply = CALIBR_SOCKET.recv(1024)
if len(reply) != 2:
pw.dlog(f"MGM calibration: Reply received command magnetometer_field has invalid length {len(reply)}")
pw.dlog(
f"MGM calibration: Reply received command magnetometer_field has invalid length {len(reply)}"
)
return
else:
if str(reply[0]) == "0":