Refactor ACS modes #163
@ -10,6 +10,10 @@ list yields a list of all related PRs for each release.
|
|||||||
|
|
||||||
# [unreleased]
|
# [unreleased]
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
|
||||||
|
- ACS mode changes: The ACS CTRL submodes are now modes. DETUBMLE is now submode of SAFE mode.
|
||||||
|
|
||||||
# [v2.17.3] 2023-03-09
|
# [v2.17.3] 2023-03-09
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
@ -8,6 +8,7 @@ from typing import Tuple
|
|||||||
from eive_tmtc.config.definitions import CustomServiceList
|
from eive_tmtc.config.definitions import CustomServiceList
|
||||||
from eive_tmtc.config.object_ids import ACS_CONTROLLER
|
from eive_tmtc.config.object_ids import ACS_CONTROLLER
|
||||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||||
|
from eive_tmtc.tmtc.acs.defs import AcsMode, SafeSubmode
|
||||||
from tmtccmd.config.tmtc import (
|
from tmtccmd.config.tmtc import (
|
||||||
tmtc_definitions_provider,
|
tmtc_definitions_provider,
|
||||||
TmtcDefinitionWrapper,
|
TmtcDefinitionWrapper,
|
||||||
@ -55,17 +56,6 @@ class SetId(enum.IntEnum):
|
|||||||
ACTUATOR_CMD_DATA = 9
|
ACTUATOR_CMD_DATA = 9
|
||||||
|
|
||||||
|
|
||||||
class Submode(enum.IntEnum):
|
|
||||||
OFF = 0
|
|
||||||
SAFE = 10
|
|
||||||
DETUMBLE = 11
|
|
||||||
IDLE = 12
|
|
||||||
PTG_NADIR = 13
|
|
||||||
PTG_TARGET = 14
|
|
||||||
PTG_TARGET_GS = 15
|
|
||||||
PTG_INERTIAL = 16
|
|
||||||
|
|
||||||
|
|
||||||
class ActionId(enum.IntEnum):
|
class ActionId(enum.IntEnum):
|
||||||
SOLAR_ARRAY_DEPLOYMENT_SUCCESSFUL = 0
|
SOLAR_ARRAY_DEPLOYMENT_SUCCESSFUL = 0
|
||||||
RESET_MEKF = 1
|
RESET_MEKF = 1
|
||||||
@ -73,13 +63,13 @@ class ActionId(enum.IntEnum):
|
|||||||
|
|
||||||
class OpCodes:
|
class OpCodes:
|
||||||
OFF = ["off"]
|
OFF = ["off"]
|
||||||
SAFE = ["normal_safe"]
|
SAFE = ["safe"]
|
||||||
DTBL = ["normal_detumble"]
|
DTBL = ["safe_detumble"]
|
||||||
IDLE = ["normal_idle"]
|
IDLE = ["ptg_idle"]
|
||||||
NADIR = ["normal_nadir"]
|
NADIR = ["ptg_nadir"]
|
||||||
TARGET = ["normal_target"]
|
TARGET = ["ptg_target"]
|
||||||
GS = ["normal_gs"]
|
GS = ["ptg_target_gs"]
|
||||||
INERTIAL = ["normal_inertial"]
|
INERTIAL = ["ptg_inertial"]
|
||||||
SAFE_PTG = ["confirm_deployment"]
|
SAFE_PTG = ["confirm_deployment"]
|
||||||
RESET_MEKF = ["reset_mekf"]
|
RESET_MEKF = ["reset_mekf"]
|
||||||
SET_PARAMETER_SCALAR = ["set_scalar_param"]
|
SET_PARAMETER_SCALAR = ["set_scalar_param"]
|
||||||
@ -119,9 +109,9 @@ class OpCodes:
|
|||||||
|
|
||||||
class Info:
|
class Info:
|
||||||
OFF = "Switch ACS CTRL off"
|
OFF = "Switch ACS CTRL off"
|
||||||
SAFE = "Switch ACS CTRL normal - safe"
|
SAFE = "Switch ACS CTRL - safe"
|
||||||
DTBL = "Switch ACS CTRL normal - detumble"
|
DTBL = "Switch ACS CTRL - safe with detumble submode"
|
||||||
IDLE = "Switch ACS CTRL normal - idle"
|
IDLE = "Switch ACS CTRL - pointing idle"
|
||||||
NADIR = "Switch ACS CTRL normal - pointing nadir"
|
NADIR = "Switch ACS CTRL normal - pointing nadir"
|
||||||
TARGET = "Switch ACS CTRL normal - pointing target"
|
TARGET = "Switch ACS CTRL normal - pointing target"
|
||||||
GS = "Switch ACS CTRL normal - pointing target groundstation"
|
GS = "Switch ACS CTRL normal - pointing target groundstation"
|
||||||
@ -235,29 +225,29 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
|
|||||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.OFF, 0))
|
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.OFF, 0))
|
||||||
elif op_code in OpCodes.SAFE:
|
elif op_code in OpCodes.SAFE:
|
||||||
q.add_log_cmd(f"{Info.SAFE}")
|
q.add_log_cmd(f"{Info.SAFE}")
|
||||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.SAFE))
|
q.add_pus_tc(
|
||||||
|
pack_mode_command(ACS_CONTROLLER, AcsMode.SAFE, SafeSubmode.DEFAULT)
|
||||||
|
)
|
||||||
elif op_code in OpCodes.DTBL:
|
elif op_code in OpCodes.DTBL:
|
||||||
q.add_log_cmd(f"{Info.DTBL}")
|
q.add_log_cmd(f"{Info.DTBL}")
|
||||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.DETUMBLE))
|
q.add_pus_tc(
|
||||||
|
pack_mode_command(ACS_CONTROLLER, AcsMode.SAFE, SafeSubmode.DETUMBLE)
|
||||||
|
)
|
||||||
elif op_code in OpCodes.IDLE:
|
elif op_code in OpCodes.IDLE:
|
||||||
q.add_log_cmd(f"{Info.IDLE}")
|
q.add_log_cmd(f"{Info.IDLE}")
|
||||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.IDLE))
|
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, AcsMode.IDLE, 0))
|
||||||
elif op_code in OpCodes.NADIR:
|
elif op_code in OpCodes.NADIR:
|
||||||
q.add_log_cmd(f"{Info.NADIR}")
|
q.add_log_cmd(f"{Info.NADIR}")
|
||||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.PTG_NADIR))
|
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, AcsMode.PTG_NADIR, 0))
|
||||||
elif op_code in OpCodes.TARGET:
|
elif op_code in OpCodes.TARGET:
|
||||||
q.add_log_cmd(f"{Info.TARGET}")
|
q.add_log_cmd(f"{Info.TARGET}")
|
||||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.PTG_TARGET))
|
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, AcsMode.PTG_TARGET, 0))
|
||||||
elif op_code in OpCodes.GS:
|
elif op_code in OpCodes.GS:
|
||||||
q.add_log_cmd(f"{Info.GS}")
|
q.add_log_cmd(f"{Info.GS}")
|
||||||
q.add_pus_tc(
|
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, AcsMode.PTG_TARGET_GS, 0))
|
||||||
pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.PTG_TARGET_GS)
|
|
||||||
)
|
|
||||||
elif op_code in OpCodes.INERTIAL:
|
elif op_code in OpCodes.INERTIAL:
|
||||||
q.add_log_cmd(f"{Info.INERTIAL}")
|
q.add_log_cmd(f"{Info.INERTIAL}")
|
||||||
q.add_pus_tc(
|
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, AcsMode.PTG_INERTIAL, 0))
|
||||||
pack_mode_command(ACS_CONTROLLER, Mode.NORMAL, Submode.PTG_INERTIAL)
|
|
||||||
)
|
|
||||||
elif op_code in OpCodes.SAFE_PTG:
|
elif op_code in OpCodes.SAFE_PTG:
|
||||||
q.add_log_cmd(f"{Info.SAFE_PTG}")
|
q.add_log_cmd(f"{Info.SAFE_PTG}")
|
||||||
q.add_pus_tc(
|
q.add_pus_tc(
|
||||||
|
16
eive_tmtc/tmtc/acs/defs.py
Normal file
16
eive_tmtc/tmtc/acs/defs.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import enum
|
||||||
|
|
||||||
|
|
||||||
|
class AcsMode(enum.IntEnum):
|
||||||
|
OFF = 0
|
||||||
|
SAFE = 10
|
||||||
|
IDLE = 11
|
||||||
|
PTG_NADIR = 12
|
||||||
|
PTG_TARGET = 13
|
||||||
|
PTG_TARGET_GS = 14
|
||||||
|
PTG_INERTIAL = 15
|
||||||
|
|
||||||
|
|
||||||
|
class SafeSubmode(enum.IntEnum):
|
||||||
|
DEFAULT = 0
|
||||||
|
DETUMBLE = 1
|
@ -1,6 +1,7 @@
|
|||||||
import enum
|
import enum
|
||||||
from typing import Tuple, Dict
|
from typing import Tuple, Dict
|
||||||
|
|
||||||
|
from eive_tmtc.tmtc.acs.defs import AcsMode, SafeSubmode
|
||||||
from spacepackets.ecss import PusTelecommand
|
from spacepackets.ecss import PusTelecommand
|
||||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||||
from eive_tmtc.config.object_ids import ACS_SUBSYSTEM_ID
|
from eive_tmtc.config.object_ids import ACS_SUBSYSTEM_ID
|
||||||
@ -27,17 +28,6 @@ class OpCode(str, enum.Enum):
|
|||||||
REPORT_ALL_MODES = "all_modes"
|
REPORT_ALL_MODES = "all_modes"
|
||||||
|
|
||||||
|
|
||||||
class AcsMode(enum.IntEnum):
|
|
||||||
OFF = 0
|
|
||||||
SAFE = 10
|
|
||||||
DETUMBLE = 11
|
|
||||||
IDLE = 12
|
|
||||||
PTG_TARGET_NADIR = 13
|
|
||||||
PTG_TARGET = 14
|
|
||||||
PTG_TARGET_GS = 15
|
|
||||||
PTG_TARGET_INERTIAL = 16
|
|
||||||
|
|
||||||
|
|
||||||
class Info(str, enum.Enum):
|
class Info(str, enum.Enum):
|
||||||
OFF = "Off Command"
|
OFF = "Off Command"
|
||||||
SAFE = "Safe Mode Command"
|
SAFE = "Safe Mode Command"
|
||||||
@ -50,15 +40,15 @@ class Info(str, enum.Enum):
|
|||||||
REPORT_ALL_MODES = "Report All Modes Recursively"
|
REPORT_ALL_MODES = "Report All Modes Recursively"
|
||||||
|
|
||||||
|
|
||||||
HANDLER_LIST: Dict[str, Tuple[int, str]] = {
|
HANDLER_LIST: Dict[str, Tuple[int, int, str]] = {
|
||||||
OpCode.OFF: (AcsMode.OFF, Info.OFF),
|
OpCode.OFF: (AcsMode.OFF, 0, Info.OFF),
|
||||||
OpCode.SAFE: (AcsMode.SAFE, Info.SAFE),
|
OpCode.SAFE: (AcsMode.SAFE, SafeSubmode.DEFAULT, Info.SAFE),
|
||||||
OpCode.DETUMBLE: (AcsMode.DETUMBLE, Info.DETUMBLE),
|
OpCode.DETUMBLE: (AcsMode.SAFE, SafeSubmode.DETUMBLE, Info.DETUMBLE),
|
||||||
OpCode.IDLE: (AcsMode.IDLE, Info.IDLE),
|
OpCode.IDLE: (AcsMode.IDLE, 0, Info.IDLE),
|
||||||
OpCode.PTG_TARGET: (AcsMode.PTG_TARGET, Info.PTG_TARGET),
|
OpCode.PTG_TARGET: (AcsMode.PTG_TARGET, 0, Info.PTG_TARGET),
|
||||||
OpCode.PTG_TARGET_GS: (AcsMode.PTG_TARGET_GS, Info.PTG_TARGET_GS),
|
OpCode.PTG_TARGET_GS: (AcsMode.PTG_TARGET_GS, 0, Info.PTG_TARGET_GS),
|
||||||
OpCode.PTG_TARGET_NADIR: (AcsMode.PTG_TARGET_NADIR, Info.PTG_TARGET_NADIR),
|
OpCode.PTG_TARGET_NADIR: (AcsMode.PTG_NADIR, 0, Info.PTG_TARGET_NADIR),
|
||||||
OpCode.PTG_TARGET_INERTIAL: (AcsMode.PTG_TARGET_INERTIAL, Info.PTG_TARGET_INERTIAL),
|
OpCode.PTG_TARGET_INERTIAL: (AcsMode.PTG_INERTIAL, 0, Info.PTG_TARGET_INERTIAL),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -81,9 +71,9 @@ def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
|||||||
return
|
return
|
||||||
pack_mode_cmd_with_info(
|
pack_mode_cmd_with_info(
|
||||||
object_id=ACS_SUBSYSTEM_ID,
|
object_id=ACS_SUBSYSTEM_ID,
|
||||||
info=f"{info_prefix}: {mode_info_tup[1]}",
|
info=f"{info_prefix}: {mode_info_tup[2]}",
|
||||||
submode=0,
|
|
||||||
mode=mode_info_tup[0],
|
mode=mode_info_tup[0],
|
||||||
|
submode=mode_info_tup[1],
|
||||||
q=q,
|
q=q,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user