update RW commands

This commit is contained in:
Robin Müller 2022-10-18 14:08:12 +02:00
parent 6088239226
commit 7957ed844e
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 49 additions and 4 deletions

24
.run/RW1.run.xml Normal file
View File

@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="RW1" 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 rw_1 -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

@ -16,6 +16,8 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
generate_one_hk_command,
generate_one_diag_command,
make_sid,
enable_periodic_hk_command_with_interval,
disable_periodic_hk_command
)
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices
@ -31,6 +33,8 @@ class OpCodesDevs:
OFF = ["3", "off"]
GET_STATUS = ["4", "status"]
GET_TM = ["5", "tm"]
ENABLE_STATUS_HK = ["6", "enable_status_hk"]
DISABLE_STATUS_HK = ["7", "disable_status_hk"]
class InfoDevs:
@ -40,6 +44,8 @@ class InfoDevs:
OFF = "Set Off"
GET_STATUS = "Get Status HK"
GET_TM = "Get TM HK"
ENABLE_STATUS_HK = "Enable Status HK"
DISABLE_STATUS_HK = "Disable Status HK"
class OpCodesAss:
@ -94,6 +100,8 @@ def add_rw_cmds(defs: TmtcDefinitionWrapper):
oce.add(info=InfoDevs.NML, keys=OpCodesDevs.NML)
oce.add(info=InfoDevs.GET_STATUS, keys=OpCodesDevs.GET_STATUS)
oce.add(info=InfoDevs.GET_TM, keys=OpCodesDevs.GET_TM)
oce.add(info=InfoDevs.ENABLE_STATUS_HK, keys=OpCodesDevs.ENABLE_STATUS_HK)
oce.add(info=InfoDevs.DISABLE_STATUS_HK, keys=OpCodesDevs.DISABLE_STATUS_HK)
defs.add_service(
name=CustomServiceList.REACTION_WHEEL_1.value,
info="Reaction Wheel 1",
@ -129,8 +137,8 @@ def pack_single_rw_test_into(
object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, op_code: str
):
if op_code in OpCodesDevs.SPEED:
speed = int(input("Specify speed [0.1 RPM]: "))
ramp_time = int(input("Specify ramp time [ms]: "))
speed = int(input("Specify speed [0.1 RPM, 0 or range [-65000, -1000] and [1000, 65000]: "))
ramp_time = int(input("Specify ramp time [ms, range [10, 20000]]: "))
q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.SPEED}")
q.add_pus_tc(pack_set_speed_command(object_id, speed, ramp_time))
@ -163,6 +171,19 @@ def pack_single_rw_test_into(
sid=make_sid(object_id=object_id, set_id=RwSetIds.STATUS_SET_ID)
)
)
if op_code in OpCodesDevs.ENABLE_STATUS_HK:
q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.ENABLE_STATUS_HK}")
interval = float(input("Please enter HK interval in floating point seconds: "))
cmds = enable_periodic_hk_command_with_interval(
True,
make_sid(object_id, RwSetIds.STATUS_SET_ID),
interval
)
for cmd in cmds:
q.add_pus_tc(cmd)
if op_code in OpCodesDevs.DISABLE_STATUS_HK:
q.add_log_cmd(f"RW {rw_idx}: {InfoDevs.DISABLE_STATUS_HK}")
q.add_pus_tc(disable_periodic_hk_command(True, make_sid(object_id, RwSetIds.STATUS_SET_ID)))
def pack_rw_ass_cmds(q: DefaultPusQueueHelper, object_id: bytes, op_code: str):
@ -198,10 +219,10 @@ def pack_set_speed_command(
) -> PusTelecommand:
"""With this function a command is packed to set the speed of a reaction wheel
:param object_id: The object id of the reaction wheel handler.
:param speed: Valid speeds are [-65000, -1000] and [1000, 65000]. Values are
:param speed: Valid speeds are 0, [-65000, -1000] and [1000, 65000]. Values are
specified in 0.1 * RPM
:param ramp_time_ms: The time after which the reaction wheel will reach the commanded speed.
Valid times are 10 - 10000 ms
Valid times are 10 - 20000 ms
"""
if speed > 0:
if speed < 1000 or speed > 65000: