some more cleaning up

This commit is contained in:
Robin Müller 2022-10-18 17:26:43 +02:00
parent f3ccbf0418
commit b2bab4c964
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
9 changed files with 65 additions and 33 deletions

24
.run/IMTQ Dipole.run.xml Normal file
View File

@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IMTQ Dipole" type="PythonConfigurationType" factoryName="Python" folderName="ACS">
<module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<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 imtq -o set_dipole -l" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
</component>

View File

@ -185,26 +185,6 @@ def add_time_cmds(defs: TmtcDefinitionWrapper):
)
@tmtc_definitions_provider
def add_imtq_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add("0", "Mode Off")
oce.add("1", "Mode On")
oce.add("2", "Mode Normal")
oce.add("3", "IMTQ perform pos X self test")
oce.add("4", "IMTQ perform neg X self test")
oce.add("5", "IMTQ perform pos Y self test")
oce.add("6", "IMTQ perform neg Y self test")
oce.add("7", "IMTQ perform pos Z self test")
oce.add("8", "IMTQ perform neg Z self test")
oce.add("9", "IMTQ command dipole")
oce.add("10", "IMTQ get commanded dipole")
oce.add("11", "IMTQ get engineering hk set")
oce.add("12", "IMTQ get calibrated MTM measurement one shot")
oce.add("13", "IMTQ get raw MTM measurement one shot")
defs.add_service(CustomServiceList.IMTQ.value, "IMQT Device", oce)
@tmtc_definitions_provider
def add_system_cmds(defs: TmtcDefinitionWrapper):
from pus_tc.system.acs import AcsOpCodes, SusOpCodes

View File

@ -27,10 +27,10 @@ from tmtc.power.p60dock import pack_p60dock_cmds
from tmtc.power.pdu2 import pack_pdu2_commands
from tmtc.power.pdu1 import pack_pdu1_commands
from tmtc.power.acu import pack_acu_commands
from pus_tc.devs.imtq import pack_imtq_test_into
from tmtc.acs.imtq import pack_imtq_test_into
from pus_tc.devs.tmp1075 import pack_tmp1075_test_into
from pus_tc.devs.heater import pack_heater_cmds
from tmtc.reaction_wheels import pack_single_rw_test_into, pack_rw_ass_cmds
from tmtc.acs.reaction_wheels import pack_single_rw_test_into, pack_rw_ass_cmds
from pus_tc.devs.rad_sensor import pack_rad_sensor_test_into
from tmtc.ploc_memory_dumper import pack_ploc_memory_dumper_cmd
from pus_tc.devs.ccsds_handler import pack_ccsds_handler_test

View File

@ -2,7 +2,6 @@ from __future__ import annotations
import time
from datetime import timedelta
from typing import List
from config.definitions import CustomServiceList
from config.object_ids import get_object_ids
@ -30,15 +29,15 @@ from pus_tc.devs.gyros import AdisGyroSetIds as AdisGyroSetIds_0_2
from pus_tc.devs.gyros import L3gGyroSetIds as L3gGyroSetIds_1_3
from pus_tc.devs.syrlinks_hk_handler import SetIds as SyrlinksSetIds
from pus_tc.devs.gps import SetIds as GpsSetIds
from pus_tc.devs.imtq import ImtqSetIds
from tmtc.acs.imtq import ImtqSetIds
from pus_tc.devs.sus import SetIds
from pus_tc.devs.star_tracker import SetIds as StrSetIds
from tmtc.reaction_wheels import RwSetIds, rw_speed_up_cmd_consec
from tmtc.acs.reaction_wheels import RwSetIds, rw_speed_up_cmd_consec
from pus_tc.system.controllers import pack_cmd_ctrl_to_off, pack_cmd_ctrl_to_nml
from pus_tc.system.acs import pack_acs_command, pack_sus_cmds
from pus_tc.devs.imtq import pack_imtq_test_into, pack_dipole_command
from tmtc.acs.imtq import pack_imtq_test_into, pack_dipole_command
from pus_tc.devs.star_tracker import pack_star_tracker_commands
from tmtc.reaction_wheels import pack_rw_ass_cmds, pack_set_speed_command
from tmtc.acs.reaction_wheels import pack_rw_ass_cmds, pack_set_speed_command
class OpCodes:

View File

@ -1,6 +1,6 @@
import struct
from config.object_ids import *
from pus_tc.devs.imtq import ImtqActionIds
from tmtc.acs.imtq import ImtqActionIds
from pus_tm.defs import PrintWrapper
from tmtc.ploc_mpsoc import PlocReplyIds
from tmtc.ploc_supervisor import SupvActionIds

View File

@ -6,7 +6,7 @@ from pus_tm.devs.rad_sensor import handle_rad_sensor_data
from pus_tm.devs.sus import handle_sus_hk
from pus_tm.system.tcs import handle_thermal_controller_hk_data
from tmtc.ploc_supervisor import handle_supv_hk_data
from tmtc.reaction_wheels import handle_rw_hk_data
from tmtc.acs.reaction_wheels import handle_rw_hk_data
from tmtccmd.tm.pus_3_fsfw_hk import (
Service3Base,
HkContentType,
@ -26,7 +26,7 @@ from pus_tm.devs.imtq_mgt import (
)
from tmtc.power.tm import handle_pdu_data, handle_p60_hk_data, handle_acu_hk_data
from pus_tm.devs.syrlinks import handle_syrlinks_hk_data
from pus_tc.devs.imtq import ImtqSetIds
from tmtc.acs.imtq import ImtqSetIds
from pus_tm.defs import FsfwTmTcPrinter
from pus_tm.system.core import handle_core_hk_data
from pus_tm.devs.mgms import handle_mgm_hk_data

0
tmtc/acs/__init__.py Normal file
View File

View File

@ -7,7 +7,13 @@
"""
import struct
from config.definitions import CustomServiceList
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.config.tmtc import (
tmtc_definitions_provider,
OpCodeEntry,
TmtcDefinitionWrapper,
)
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_3_fsfw_hk import (
make_sid,
@ -22,6 +28,7 @@ class OpCodes:
ON = ["on"]
NORMAL = ["normal"]
OFF = ["off"]
SET_DIPOLE = ["set_dipole"]
class ImtqSetIds:
@ -50,6 +57,26 @@ class ImtqActionIds:
read_self_test_results = bytearray([0x0, 0x0, 0x0, 0x0D])
@tmtc_definitions_provider
def add_imtq_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(OpCodes.OFF, "Mode Off")
oce.add(OpCodes.ON, "Mode On")
oce.add(OpCodes.NORMAL, "Mode Normal")
oce.add("3", "IMTQ perform pos X self test")
oce.add("4", "IMTQ perform neg X self test")
oce.add("5", "IMTQ perform pos Y self test")
oce.add("6", "IMTQ perform neg Y self test")
oce.add("7", "IMTQ perform pos Z self test")
oce.add("8", "IMTQ perform neg Z self test")
oce.add(OpCodes.SET_DIPOLE, "IMTQ command dipole")
oce.add("10", "IMTQ get commanded dipole")
oce.add("11", "IMTQ get engineering hk set")
oce.add("12", "IMTQ get calibrated MTM measurement one shot")
oce.add("13", "IMTQ get raw MTM measurement one shot")
defs.add_service(CustomServiceList.IMTQ.value, "IMQT Device", oce)
def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
q.add_log_cmd(
f"Testing ISIS IMTQ handler with object id: {object_id.as_hex_string}"
@ -140,9 +167,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
sid = make_sid(object_id.as_bytes, ImtqSetIds.NEGATIVE_Z_TEST)
q.add_pus_tc(generate_one_hk_command(sid))
if op_code == "9":
q.add_log_cmd("IMTQ: Commanding dipole")
if op_code in OpCodes.SET_DIPOLE:
x_dipole = int(input("Specify X dipole [range [0, 2000] * 10^-4 * Am^2]: "))
y_dipole = int(input("Specify Y dipole [range [0, 2000] * 10^-4 * Am^2]: "))
z_dipole = int(input("Specify Z dipole [range [0, 2000] * 10^-4 * Am^2]: "))
@ -152,6 +177,10 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
f"0 for continuous generation until update]: "
)
)
dur_str = "infinite" if duration == 0 else str(duration)
q.add_log_cmd(
f"IMTQ: Commanding dipole X={x_dipole}, Y={y_dipole}, Z={y_dipole}, duration={dur_str}"
)
q.add_pus_tc(
pack_dipole_command(
object_id.as_bytes, x_dipole, y_dipole, z_dipole, duration