added mode commanding for radiation sensor

This commit is contained in:
Jakob Meier 2021-07-01 11:52:25 +02:00
parent 7a15062efe
commit fe1bed900a
6 changed files with 59 additions and 5 deletions

View File

@ -27,3 +27,4 @@ class CustomServiceList(enum.Enum):
REACTION_WHEEL_2 = "reaction_wheel_2"
REACTION_WHEEL_3 = "reaction_wheel_3"
REACTION_WHEEL_4 = "reaction_wheel_4"
RAD_SENSOR = "rad_sensor"

View File

@ -74,6 +74,13 @@ class EiveHookObject(TmTcHookBase):
}
service_rw_tuple = ("Reaction Wheel", op_code_dict_srv_rw)
op_code_dict_srv_rad_sensor = {
"0": ("Radiation Sensor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"1": ("Radiation Sensor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
"2": ("Radiation Sensor: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_rad_sensor_tuple = ("Radiation Sensor", op_code_dict_srv_rad_sensor)
service_op_code_dict[CustomServiceList.ACU.value] = service_acu_tuple
service_op_code_dict[CustomServiceList.TMP1075_1.value] = service_tmp1075_1_tuple
service_op_code_dict[CustomServiceList.TMP1075_2.value] = service_tmp1075_2_tuple
@ -86,6 +93,7 @@ class EiveHookObject(TmTcHookBase):
service_op_code_dict[CustomServiceList.REACTION_WHEEL_2.value] = service_rw_tuple
service_op_code_dict[CustomServiceList.REACTION_WHEEL_3.value] = service_rw_tuple
service_op_code_dict[CustomServiceList.REACTION_WHEEL_4.value] = service_rw_tuple
service_op_code_dict[CustomServiceList.RAD_SENSOR.value] = service_rad_sensor_tuple
return service_op_code_dict
def get_json_config_file_path(self) -> str:

View File

@ -23,6 +23,8 @@ RW1_ID = bytes([0x44, 0x21, 0x00, 0x1])
RW2_ID = bytes([0x44, 0x21, 0x00, 0x2])
RW3_ID = bytes([0x44, 0x21, 0x00, 0x3])
RW4_ID = bytes([0x44, 0x21, 0x00, 0x4])
RAD_SENSOR_ID = bytes([0x44, 0x32, 0x00, 0xA5])
def get_object_ids() -> Dict[bytes, list]:
object_id_dict = ({
@ -41,5 +43,6 @@ def get_object_ids() -> Dict[bytes, list]:
RW2_ID: "Reaction Wheel 2",
RW3_ID: "Reaction Wheel 3",
RW4_ID: "Reaction Wheel 4",
RAD_SENSOR_ID: "Radiation Sensor",
})
return object_id_dict

38
pus_tc/rad_sensor.py Normal file
View File

@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
"""
@file rad_sensor.py
@brief Tests for the radiation sensor handler
@author J. Meier
@date 01.07.2021
"""
import struct
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.pus_tc.packer import TcQueueT
from tmtccmd.ecss.tc import PusTelecommand
from pus_tc.service_200_mode import pack_mode_data
def pack_rad_sensor_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
tc_queue.appendleft(
(QueueCommands.PRINT,
"Testing radiation sensor handler with object id: 0x" + object_id.hex())
)
if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode on"))
mode_data = pack_mode_data(object_id, 1, 0)
command = PusTelecommand(service=200, subservice=1, ssc=41, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode normal"))
mode_data = pack_mode_data(object_id, 2, 0)
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode off"))
mode_data = pack_mode_data(object_id, 0, 0)
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
"""
@file imtq.py
@brief Tests for the ISIS IMTQ (Magnettorquer) device handler
@file reaction_wheels.py
@brief Tests for the reaction wheel handler
@author J. Meier
@date 25.03.2021
@date 20.06.2021
"""
import struct
from tmtccmd.config.definitions import QueueCommands
@ -11,7 +11,6 @@ from tmtccmd.config.definitions import QueueCommands
from tmtccmd.pus_tc.packer import TcQueueT
from tmtccmd.ecss.tc import PusTelecommand
from pus_tc.service_200_mode import pack_mode_data
from tmtccmd.pus_tc.service_3_housekeeping import make_sid, generate_one_hk_command
class RwSetIds:

View File

@ -23,9 +23,11 @@ from pus_tc.tmp1075 import pack_tmp1075_test_into
from pus_tc.ploc import pack_ploc_test_into
from pus_tc.heater import pack_heater_test_into
from pus_tc.reaction_wheels import pack_single_rw_test_into
from pus_tc.rad_sensor import pack_rad_sensor_test_into
from config.definitions import CustomServiceList
from config.object_ids import P60_DOCK_HANDLER, PDU_1_HANDLER_ID, PDU_2_HANDLER_ID, ACU_HANDLER_ID, \
TMP_1075_1_HANDLER_ID, TMP_1075_2_HANDLER_ID, HEATER_ID, IMTQ_HANDLER_ID, PLOC_ID, RW1_ID, RW2_ID, RW3_ID, RW4_ID
TMP_1075_1_HANDLER_ID, TMP_1075_2_HANDLER_ID, HEATER_ID, IMTQ_HANDLER_ID, PLOC_ID, RW1_ID, RW2_ID, RW3_ID, RW4_ID, \
RAD_SENSOR_ID
LOGGER = get_console_logger()
@ -81,6 +83,9 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
if service == CustomServiceList.REACTION_WHEEL_4.value:
object_id = RW4_ID
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.RAD_SENSOR.value:
object_id = RAD_SENSOR_ID
return pack_rad_sensor_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
LOGGER.warning("Invalid Service !")