This commit is contained in:
Robin Müller 2022-05-23 18:33:35 +02:00
parent 623e1cc37e
commit c9f5a5652e
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 42 additions and 32 deletions

View File

@ -1,5 +1,11 @@
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QGroupBox, QGridLayout, QLineEdit QDialog,
QDialogButtonBox,
QVBoxLayout,
QLabel,
QGroupBox,
QGridLayout,
QLineEdit,
) )
from PyQt5 import QtCore from PyQt5 import QtCore
@ -16,12 +22,13 @@ class Parameter:
self.widget = widget self.widget = widget
self.value = self.defaultValue self.value = self.defaultValue
self.widget.setPlaceholderText(self.defaultValue) self.widget.setPlaceholderText(self.defaultValue)
def reset(self): def reset(self):
self.value = self.defaultValue self.value = self.defaultValue
self.widget.setPlaceholderText(self.defaultValue) self.widget.setPlaceholderText(self.defaultValue)
self.widget.setText("") self.widget.setText("")
class ParameterDialog(QDialog): class ParameterDialog(QDialog):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
@ -42,7 +49,7 @@ class ParameterDialog(QDialog):
self.rootLayout.addWidget(self.group) self.rootLayout.addWidget(self.group)
self.rootLayout.addWidget(self.buttonBox) self.rootLayout.addWidget(self.buttonBox)
self.setLayout(self.rootLayout) self.setLayout(self.rootLayout)
self.groupLayout = QGridLayout() self.groupLayout = QGridLayout()
self.group.setLayout(self.groupLayout) self.group.setLayout(self.groupLayout)
@ -59,7 +66,6 @@ class ParameterDialog(QDialog):
self.parameters[name] = parameter self.parameters[name] = parameter
def _reset(self): def _reset(self):
for value in self.parameters.values(): for value in self.parameters.values():
value.reset() value.reset()
@ -80,14 +86,13 @@ class ParameterDialog(QDialog):
super().reject() super().reject()
"""Prompt the user to specify additional Parameters """Prompt the user to specify additional Parameters
:param parameterList: array of dictionaries with name and defaultValue attributes :param parameterList: array of dictionaries with name and defaultValue attributes
:return: dict with all names as key and user supplied input as value string :return: dict with all names as key and user supplied input as value string
""" """
def prompt_parameters(parameterList): def prompt_parameters(parameterList):
gui = get_global(CoreGlobalIds.GUI) gui = get_global(CoreGlobalIds.GUI)
mode = get_global(CoreGlobalIds.MODE) mode = get_global(CoreGlobalIds.MODE)
@ -95,9 +100,10 @@ def prompt_parameters(parameterList):
# gui only works in cont mode right now # gui only works in cont mode right now
if gui and mode == CoreModeList.CONTINUOUS_MODE: if gui and mode == CoreModeList.CONTINUOUS_MODE:
return _gui_prompt(parameterList) return _gui_prompt(parameterList)
else: else:
return _cli_prompt(parameterList) return _cli_prompt(parameterList)
def _gui_prompt(parameterList): def _gui_prompt(parameterList):
dialog = ParameterDialog() dialog = ParameterDialog()
for parameter in parameterList: for parameter in parameterList:
@ -105,11 +111,14 @@ def _gui_prompt(parameterList):
dialog.exec_() dialog.exec_()
return dialog.getParameters() return dialog.getParameters()
def _cli_prompt(parameterList): def _cli_prompt(parameterList):
result = {} result = {}
for parameter in parameterList: for parameter in parameterList:
userInput = input("Specify {} [{}]: ".format(parameter["name"], parameter["defaultValue"])) userInput = input(
"Specify {} [{}]: ".format(parameter["name"], parameter["defaultValue"])
)
if userInput == "": if userInput == "":
userInput = parameter["defaultValue"] userInput = parameter["defaultValue"]
result[parameter["name"]] = userInput result[parameter["name"]] = userInput
return result return result

View File

@ -18,8 +18,12 @@ class Info:
def pack_controller_commands(tc_queue: TcQueueT, op_code: str): def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
parameters = prompt_parameters([{"name": "Mode", "defaultValue": "2"}, { parameters = prompt_parameters(
"name": "Submode", "defaultValue": "0"}]) [
{"name": "Mode", "defaultValue": "2"},
{"name": "Submode", "defaultValue": "0"},
]
)
mode = int(parameters["Mode"]) mode = int(parameters["Mode"])
if mode < 0 or mode > 2: if mode < 0 or mode > 2:
print("Invalid Mode, defaulting to OFF") print("Invalid Mode, defaulting to OFF")

View File

@ -1,6 +1,7 @@
from tmtccmd.config import QueueCommands from tmtccmd.config import QueueCommands
from tmtccmd.tc.definitions import TcQueueT from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.pus_3_fsfw_hk import * from tmtccmd.tc.pus_3_fsfw_hk import *
""" """
from config.object_ids import ( from config.object_ids import (
BPX_HANDLER_ID, BPX_HANDLER_ID,
@ -66,8 +67,6 @@ PROC_INFO_DICT = {
KAI.TCS_FT_ON[0]: [OpCodes.TCS_FT_ON, KAI.TCS_FT_ON[1], 120.0, 10.0], KAI.TCS_FT_ON[0]: [OpCodes.TCS_FT_ON, KAI.TCS_FT_ON[1], 120.0, 10.0],
KAI.TCS_FT_OFF[0]: [OpCodes.TCS_FT_OFF, KAI.TCS_FT_OFF[1], 120.0, 10.0], KAI.TCS_FT_OFF[0]: [OpCodes.TCS_FT_OFF, KAI.TCS_FT_OFF[1], 120.0, 10.0],
KAI.ACS_FT[0]: [OpCodes.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0], KAI.ACS_FT[0]: [OpCodes.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0],
} }
@ -159,7 +158,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_acs_command(tc_queue=tc_queue, op_code="acs-a") pack_acs_command(tc_queue=tc_queue, op_code="acs-a")
# MGMs # MGMs
sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK)
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -168,7 +167,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
) )
# Gyros # Gyros
sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK)
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -181,7 +180,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
) )
# GNSS0 # GNSS0
sid = make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK) sid = make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK)
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -191,7 +190,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft((QueueCommands.WAIT, 5.0)) tc_queue.appendleft((QueueCommands.WAIT, 5.0))
pack_acs_command(tc_queue=tc_queue, op_code="acs-b") pack_acs_command(tc_queue=tc_queue, op_code="acs-b")
# MGMs # MGMs
sid = make_sid(oids.MGM_2_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) sid = make_sid(oids.MGM_2_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK)
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -200,7 +199,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
) )
# Gyros # Gyros
sid = make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) sid = make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK)
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -213,7 +212,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
) )
#GNSS1 # GNSS1
sid = make_sid(oids.GPS_HANDLER_1_ID, GnssSetIds_1.CORE_HK) sid = make_sid(oids.GPS_HANDLER_1_ID, GnssSetIds_1.CORE_HK)
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -223,7 +222,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft((QueueCommands.WAIT, 5.0)) tc_queue.appendleft((QueueCommands.WAIT, 5.0))
pack_acs_command(tc_queue=tc_queue, op_code="acs-d") pack_acs_command(tc_queue=tc_queue, op_code="acs-d")
# MGMs # MGMs
sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK)
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -240,7 +239,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
) )
# Gyros # Gyros
sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK)
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -265,7 +264,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
) )
# GNSS0+1 # GNSS0+1
sid = make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK) sid = make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK)
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -293,15 +292,13 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
) )
# mgt 1: imtq und hk
# mgt 1: imtq und hk # mgt 2.: imtq + dual side + dipole
# mgt 2.: imtq + dual side + dipole
if op_code in OpCodes.MGT_FT_DP: if op_code in OpCodes.MGT_FT_DP:
key = KAI.MGT_FT[0] key = KAI.MGT_FT[0]
pack_acs_command(tc_queue=tc_queue, op_code="acs-a") pack_acs_command(tc_queue=tc_queue, op_code="acs-a")
sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET) sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET)
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
@ -315,7 +312,6 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
) )
pack_acs_command(tc_queue=tc_queue, op_code="acs-off") pack_acs_command(tc_queue=tc_queue, op_code="acs-off")

View File

@ -2,10 +2,11 @@
"""TMTC commander for EIVE""" """TMTC commander for EIVE"""
from tmtcc import tmtcc_post_args, tmtcc_pre_args from tmtcc import tmtcc_post_args, tmtcc_pre_args
from tmtccmd.config.args import ( from tmtccmd.config.args import (
create_default_args_parser, create_default_args_parser,
add_gui_tmtccmd_args, add_gui_tmtccmd_args,
parse_gui_input_arguments, parse_gui_input_arguments,
) )
def main(): def main():
hook_obj = tmtcc_pre_args() hook_obj = tmtcc_pre_args()