Merge pull request 'RW commanding fix' (#277) from rw-commanding-fix into main
Some checks are pending
EIVE/-/pipeline/head Build queued...

Reviewed-on: #277
This commit is contained in:
Marius Eggert 2024-02-26 14:03:52 +01:00
commit 588d7a8079
3 changed files with 18 additions and 61 deletions

View File

@ -14,6 +14,10 @@ list yields a list of all related PRs for each release.
- Added commands to unlock and use STR secondary firmware slot. - Added commands to unlock and use STR secondary firmware slot.
## Fixed
- RW commanding
# [v6.0.0] 2024-02-08 # [v6.0.0] 2024-02-08
## Changed ## Changed

View File

@ -198,29 +198,29 @@ def handle_acs_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: Lis
) )
if cmd_path_list[0] == "rws": if cmd_path_list[0] == "rws":
assert len(cmd_path_list) >= 3 assert len(cmd_path_list) >= 2
if cmd_path_list[1] == "rw_assy": if cmd_path_list[1] == "rw_assy":
assert len(cmd_path_list) >= 4 assert len(cmd_path_list) >= 3
return pack_rw_ass_cmds( return pack_rw_ass_cmds(
q=queue_helper, object_id=RW_ASSEMBLY, cmd_str=cmd_path_list[2] q=queue_helper, object_id=RW_ASSEMBLY, cmd_str=cmd_path_list[2]
) )
if cmd_path_list[1] == "rw_1": if cmd_path_list[1] == "rw_1":
assert len(cmd_path_list) >= 4 assert len(cmd_path_list) >= 3
return create_single_rw_cmd( return create_single_rw_cmd(
object_id=RW1_ID, rw_idx=1, q=queue_helper, cmd_str=cmd_path_list[2] object_id=RW1_ID, rw_idx=1, q=queue_helper, cmd_str=cmd_path_list[2]
) )
if cmd_path_list[1] == "rw_2": if cmd_path_list[1] == "rw_2":
assert len(cmd_path_list) >= 4 assert len(cmd_path_list) >= 3
return create_single_rw_cmd( return create_single_rw_cmd(
object_id=RW2_ID, rw_idx=2, q=queue_helper, cmd_str=cmd_path_list[2] object_id=RW2_ID, rw_idx=2, q=queue_helper, cmd_str=cmd_path_list[2]
) )
if cmd_path_list[1] == "rw_3": if cmd_path_list[1] == "rw_3":
assert len(cmd_path_list) >= 4 assert len(cmd_path_list) >= 3
return create_single_rw_cmd( return create_single_rw_cmd(
object_id=RW3_ID, rw_idx=3, q=queue_helper, cmd_str=cmd_path_list[2] object_id=RW3_ID, rw_idx=3, q=queue_helper, cmd_str=cmd_path_list[2]
) )
if cmd_path_list[1] == "rw_4": if cmd_path_list[1] == "rw_4":
assert len(cmd_path_list) >= 4 assert len(cmd_path_list) >= 3
return create_single_rw_cmd( return create_single_rw_cmd(
object_id=RW4_ID, rw_idx=4, q=queue_helper, cmd_str=cmd_path_list[2] object_id=RW4_ID, rw_idx=4, q=queue_helper, cmd_str=cmd_path_list[2]
) )

View File

@ -6,12 +6,11 @@
""" """
import enum import enum
import struct import struct
from typing import List from typing import List, Tuple
from eive_tmtc.pus_tm.defs import PrintWrapper from eive_tmtc.pus_tm.defs import PrintWrapper
from eive_tmtc.config.object_ids import RW1_ID, RW2_ID, RW3_ID, RW4_ID from eive_tmtc.config.object_ids import RW1_ID, RW2_ID, RW3_ID, RW4_ID
from tmtccmd.config import CmdTreeNode, TmtcDefinitionWrapper, OpCodeEntry from tmtccmd.config import CmdTreeNode
from tmtccmd.config.tmtc import tmtc_definitions_provider
from tmtccmd.tmtc import DefaultPusQueueHelper from tmtccmd.tmtc import DefaultPusQueueHelper
from tmtccmd.pus.tc.s3_fsfw_hk import ( from tmtccmd.pus.tc.s3_fsfw_hk import (
generate_one_hk_command, generate_one_hk_command,
@ -23,7 +22,6 @@ from tmtccmd.pus.tc.s3_fsfw_hk import (
from tmtccmd.pus.s8_fsfw_action import create_action_cmd from tmtccmd.pus.s8_fsfw_action import create_action_cmd
from spacepackets.ecss.tc import PusTelecommand from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode, Subservice from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode, Subservice
from eive_tmtc.config.definitions import CustomServiceList
from tmtccmd.util import ObjectIdU32 from tmtccmd.util import ObjectIdU32
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
@ -126,59 +124,14 @@ def create_reaction_wheel_assembly_node() -> CmdTreeNode:
node = CmdTreeNode( node = CmdTreeNode(
"rw_assy", "Reaction Wheels Assembly", hide_children_which_are_leaves=True "rw_assy", "Reaction Wheels Assembly", hide_children_which_are_leaves=True
) )
node.add_child(CmdTreeNode(InfoAss.ON, OpCodesAss.ON)) node.add_child(CmdTreeNode(OpCodesAss.ON, InfoAss.ON))
node.add_child(CmdTreeNode(InfoAss.NML, OpCodesAss.NML)) node.add_child(CmdTreeNode(OpCodesAss.NML, InfoAss.NML))
node.add_child(CmdTreeNode(InfoAss.OFF, OpCodesAss.OFF)) node.add_child(CmdTreeNode(OpCodesAss.OFF, InfoAss.OFF))
node.add_child(CmdTreeNode(InfoAss.ALL_SPEED_UP, OpCodesAss.ALL_SPEED_UP)) node.add_child(CmdTreeNode(OpCodesAss.ALL_SPEED_UP, InfoAss.ALL_SPEED_UP))
node.add_child(CmdTreeNode(InfoAss.ALL_SPEED_OFF, OpCodesAss.ALL_SPEED_OFF)) node.add_child(CmdTreeNode(OpCodesAss.ALL_SPEED_OFF, InfoAss.ALL_SPEED_OFF))
return node return node
@tmtc_definitions_provider
def add_rw_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(info=InfoDev.SPEED, keys=OpCodesDev.SPEED)
oce.add(info=InfoDev.ON, keys=OpCodesDev.ON)
oce.add(info=InfoDev.OFF, keys=OpCodesDev.OFF)
oce.add(info=InfoDev.NML, keys=OpCodesDev.NML)
oce.add(info=InfoDev.REQ_TM, keys=OpCodesDev.REQ_TM)
oce.add(info=InfoDev.GET_STATUS, keys=OpCodesDev.GET_STATUS)
oce.add(info=InfoDev.GET_TM, keys=OpCodesDev.GET_TM)
oce.add(info=InfoDev.ENABLE_STATUS_HK, keys=OpCodesDev.ENABLE_STATUS_HK)
oce.add(info=InfoDev.DISABLE_STATUS_HK, keys=OpCodesDev.DISABLE_STATUS_HK)
defs.add_service(
name=CustomServiceList.REACTION_WHEEL_1.value,
info="Reaction Wheel 1",
op_code_entry=oce,
)
defs.add_service(
name=CustomServiceList.REACTION_WHEEL_2.value,
info="Reaction Wheel 2",
op_code_entry=oce,
)
defs.add_service(
name=CustomServiceList.REACTION_WHEEL_3.value,
info="Reaction Wheel 3",
op_code_entry=oce,
)
defs.add_service(
name=CustomServiceList.REACTION_WHEEL_4.value,
info="Reaction Wheel 4",
op_code_entry=oce,
)
oce = OpCodeEntry()
oce.add(info=InfoAss.ON, keys=OpCodesAss.ON)
oce.add(info=InfoAss.NML, keys=OpCodesAss.NML)
oce.add(info=InfoAss.OFF, keys=OpCodesAss.OFF)
oce.add(info=InfoAss.ALL_SPEED_UP, keys=OpCodesAss.ALL_SPEED_UP)
oce.add(info=InfoAss.ALL_SPEED_OFF, keys=OpCodesAss.ALL_SPEED_OFF)
defs.add_service(
name=CustomServiceList.RW_ASSEMBLY.value,
info="Reaction Wheel Assembly",
op_code_entry=oce,
)
def create_single_rw_cmd( # noqa C901: Complexity is okay here. def create_single_rw_cmd( # noqa C901: Complexity is okay here.
object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, cmd_str: str object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, cmd_str: str
): ):
@ -272,7 +225,7 @@ def pack_rw_ass_cmds(q: DefaultPusQueueHelper, object_id: bytes, cmd_str: str):
) )
def prompt_speed_ramp_time() -> (int, int): def prompt_speed_ramp_time() -> Tuple[int, int]:
speed = int( speed = int(
input("Specify speed [0.1 RPM, 0 or range [-65000, -1000] and [1000, 65000]: ") input("Specify speed [0.1 RPM, 0 or range [-65000, -1000] and [1000, 65000]: ")
) )