From 805470df6d907ba5002fcca1ae71f662a7097b0b Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Tue, 15 Jun 2021 15:39:14 +0200 Subject: [PATCH 01/32] commit tmtccmd --- tmtccmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtccmd b/tmtccmd index b36f182..475ac3f 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit b36f182178cf7fa41b169b705eaf2364a1e29969 +Subproject commit 475ac3f8293fd92533e4d50c061d93b1c2b7f5e1 From 5be05c2a929dfc908b8de61250e4db890b010fa5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 21 Jun 2021 18:40:05 +0200 Subject: [PATCH 02/32] tmtccmd update --- tmtccmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtccmd b/tmtccmd index b4358a1..b0cf33b 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit b4358a15fd945a9e0103a707b2a2dc56c458b24a +Subproject commit b0cf33b8a6223247c5df38e5918ac8885c494c11 From f4e5bc19568fc9786a3e5ac0a9164dbfe1dcbbe3 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Thu, 24 Jun 2021 16:34:51 +0200 Subject: [PATCH 03/32] updated object IDS --- config/object_ids.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/config/object_ids.py b/config/object_ids.py index 3dd4c29..1332df9 100644 --- a/config/object_ids.py +++ b/config/object_ids.py @@ -6,19 +6,19 @@ from typing import Dict PUS_SERVICE_17_ID = bytes([0x53, 0x00, 0x00, 0x17]) -TEST_DEVICE_ID = bytes([0x44, 0x00, 0xAF, 0xFE]) -P60_DOCK_HANDLER = bytes([0x44, 0x00, 0x00, 0x1]) -PDU_1_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x2]) -PDU_2_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x3]) -ACU_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x4]) -TMP_1075_1_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x5]) -TMP_1075_2_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x6]) -HEATER_ID = bytes([0x54, 0x00, 0x00, 0x1]) -PCDU_HANDLER_ID = bytes([0x44, 0x00, 0x10, 0x00]) -SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x00, 0x10, 0x01]) -SYRLINKS_HANDLER = bytes([0x44, 0x00, 0x10, 0x02]) -IMTQ_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x14]) -PLOC_ID = bytearray([0x44, 0x00, 0x00, 0x15]) +TEST_DEVICE_ID = bytes([0x54, 0x00, 0xAF, 0xFE]) +P60_DOCK_HANDLER = bytes([0x44, 0x20, 0x00, 0x01]) +PDU_1_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0x02]) +PDU_2_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0x03]) +ACU_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0x04]) +TMP_1075_1_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x05]) +TMP_1075_2_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x06]) +HEATER_ID = bytes([0x44, 0x41, 0x00, 0x35]) +PCDU_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0x32]) +SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x41, 0x10, 0x33]) +SYRLINKS_HANDLER = bytes([0x44, 0x53, 0x00, 0x34]) +IMTQ_HANDLER_ID = bytearray([0x44, 0x10, 0x00, 0x14]) +PLOC_ID = bytearray([0x44, 0x30, 0x00, 0x15]) def get_object_ids() -> Dict[bytes, list]: From 8a66b2a721882acf342d1e25c9967db3651a919f Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Thu, 24 Jun 2021 16:42:58 +0200 Subject: [PATCH 04/32] updated TMTC IDs --- config/object_ids.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/config/object_ids.py b/config/object_ids.py index 1332df9..b26536f 100644 --- a/config/object_ids.py +++ b/config/object_ids.py @@ -7,18 +7,18 @@ from typing import Dict PUS_SERVICE_17_ID = bytes([0x53, 0x00, 0x00, 0x17]) TEST_DEVICE_ID = bytes([0x54, 0x00, 0xAF, 0xFE]) -P60_DOCK_HANDLER = bytes([0x44, 0x20, 0x00, 0x01]) -PDU_1_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0x02]) -PDU_2_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0x03]) -ACU_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0x04]) -TMP_1075_1_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x05]) -TMP_1075_2_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x06]) -HEATER_ID = bytes([0x44, 0x41, 0x00, 0x35]) -PCDU_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0x32]) -SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x41, 0x10, 0x33]) -SYRLINKS_HANDLER = bytes([0x44, 0x53, 0x00, 0x34]) -IMTQ_HANDLER_ID = bytearray([0x44, 0x10, 0x00, 0x14]) -PLOC_ID = bytearray([0x44, 0x30, 0x00, 0x15]) +P60_DOCK_HANDLER = bytes([0x44, 0x25, 0x00, 0x00]) +PDU_1_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x01]) +PDU_2_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x02]) +ACU_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x03]) +TMP_1075_1_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x04]) +TMP_1075_2_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x05]) +HEATER_ID = bytes([0x44, 0x41, 0x00, 0x53]) +PCDU_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0x50]) +SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x41, 0x10, 0x51]) +SYRLINKS_HANDLER = bytes([0x44, 0x53, 0x00, 0x52]) +IMTQ_HANDLER_ID = bytearray([0x44, 0x14, 0x00, 0x14]) +PLOC_ID = bytearray([0x44, 0x33, 0x00, 0x15]) def get_object_ids() -> Dict[bytes, list]: From 2a9862489d57e2ccbf8b9ca5017f5e89395acddf Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Thu, 24 Jun 2021 16:49:19 +0200 Subject: [PATCH 05/32] updated object ids again --- config/object_ids.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/object_ids.py b/config/object_ids.py index b26536f..733107b 100644 --- a/config/object_ids.py +++ b/config/object_ids.py @@ -13,10 +13,10 @@ PDU_2_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x02]) ACU_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x03]) TMP_1075_1_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x04]) TMP_1075_2_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x05]) -HEATER_ID = bytes([0x44, 0x41, 0x00, 0x53]) -PCDU_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0x50]) -SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x41, 0x10, 0x51]) -SYRLINKS_HANDLER = bytes([0x44, 0x53, 0x00, 0x52]) +HEATER_ID = bytes([0x44, 0x41, 0x00, 0xA4]) +PCDU_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0xA1]) +SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x41, 0x10, 0xA2]) +SYRLINKS_HANDLER = bytes([0x44, 0x53, 0x00, 0xA3]) IMTQ_HANDLER_ID = bytearray([0x44, 0x14, 0x00, 0x14]) PLOC_ID = bytearray([0x44, 0x33, 0x00, 0x15]) From 3d26373726199b0d07f0ce344a184ccd9a0a6041 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Fri, 25 Jun 2021 12:07:16 +0200 Subject: [PATCH 06/32] reaction wheel set speed command --- config/definitions.py | 1 + config/hook_implementations.py | 7 ++++ config/object_ids.py | 1 + pus_tc/imtq.py | 19 +--------- pus_tc/reaction_wheels.py | 65 ++++++++++++++++++++++++++++++++++ pus_tc/tc_packer_hook.py | 3 ++ tmtccmd | 2 +- 7 files changed, 79 insertions(+), 19 deletions(-) create mode 100644 pus_tc/reaction_wheels.py diff --git a/config/definitions.py b/config/definitions.py index 75b7b21..3ef84d2 100644 --- a/config/definitions.py +++ b/config/definitions.py @@ -23,3 +23,4 @@ class CustomServiceList(enum.Enum): PLOC = "ploc" PCDU = "pcdu", SA_DEPLYOMENT = "sa_depl" + REACTION_WHEEL = "reaction_wheel" diff --git a/config/hook_implementations.py b/config/hook_implementations.py index 3b0e2ac..9b1a7a3 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -63,6 +63,12 @@ class EiveHookObject(TmTcHookBase): } service_imtq_tuple = ("IMTQ Device", op_code_dict_srv_imtq) + op_code_dict_srv_rw = { + "0": ("Reaction Wheel: Run all commands", {OpCodeDictKeys.TIMEOUT: 2.0}), + "1": ("Reaction Wheel: Set speed", {OpCodeDictKeys.TIMEOUT: 2.0}), + } + service_rw_tuple = ("Reaction Wheel", op_code_dict_srv_rw) + 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 @@ -72,6 +78,7 @@ class EiveHookObject(TmTcHookBase): service_op_code_dict[CustomServiceList.PDU1.value] = service_pdu2_tuple service_op_code_dict[CustomServiceList.HEATER.value] = service_heater_tuple service_op_code_dict[CustomServiceList.IMTQ.value] = service_imtq_tuple + service_op_code_dict[CustomServiceList.REACTION_WHEEL.value] = service_rw_tuple return service_op_code_dict def get_json_config_file_path(self) -> str: diff --git a/config/object_ids.py b/config/object_ids.py index 3dd4c29..e115c49 100644 --- a/config/object_ids.py +++ b/config/object_ids.py @@ -19,6 +19,7 @@ SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x00, 0x10, 0x01]) SYRLINKS_HANDLER = bytes([0x44, 0x00, 0x10, 0x02]) IMTQ_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x14]) PLOC_ID = bytearray([0x44, 0x00, 0x00, 0x15]) +RW1_ID = bytearray([0x44, 0x00, 0x00, 0x15]) def get_object_ids() -> Dict[bytes, list]: diff --git a/pus_tc/imtq.py b/pus_tc/imtq.py index c6bee28..902b13e 100644 --- a/pus_tc/imtq.py +++ b/pus_tc/imtq.py @@ -12,23 +12,6 @@ from tmtccmd.ecss.tc import PusTelecommand from tmtccmd.pus_tc.service_3_housekeeping import make_sid, generate_one_hk_command -class ImtqTestProcedure: - """ - @brief Use this class to define the tests to perform for the IMTQ Handler. - @details Setting all to True will run all tests. - Setting all to False will only run the tests set to True. - """ - all = False - command_dipole = False - get_commanded_dipole = False - positive_x_test = True - negative_x_test = False - positive_y_test = False - negative_y_test = False - positive_z_test = False - negative_z_test = False - - class ImtqSetIds: ENG_HK_SET = 1 CAL_MTM_SET = 2 @@ -178,7 +161,7 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) def pack_dipole_command(object_id: bytearray, x_dipole: int, y_dipole: int, z_dipole: int, duration: int) -> bytearray: """ This function packs the command causing the ISIS IMTQ to generate a dipole. - @param object_id The object id of the gomspace device handler. + @param object_id The object id of the IMTQ handler. @param x_dipole The dipole of the x coil in 10^-4*Am^2 (max. 2000) @param y_dipole The dipole of the y coil in 10^-4*Am^2 (max. 2000) @param z_dipole The dipole of the z coil in 10^-4*Am^2 (max. 2000) diff --git a/pus_tc/reaction_wheels.py b/pus_tc/reaction_wheels.py new file mode 100644 index 0000000..b84c264 --- /dev/null +++ b/pus_tc/reaction_wheels.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +""" +@file imtq.py +@brief Tests for the ISIS IMTQ (Magnettorquer) device handler +@author J. Meier +@date 25.03.2021 +""" +from tmtccmd.config.definitions import QueueCommands + +from tmtccmd.pus_tc.packer import TcQueueT +from tmtccmd.ecss.tc import PusTelecommand +from tmtccmd.pus_tc.service_3_housekeeping import make_sid, generate_one_hk_command + + +class RwSetIds: + STATUS_SET_ID = 4 + TEMPERATURE_SET_ID = 8 + + +class RwCommandIds: + RESET_MCU = bytearray([0x0, 0x0, 0x0, 0x01]) + # Reads status information from reaction wheel into dataset with id 4 + GET_RW_STATUS = bytearray([0x0, 0x0, 0x0, 0x04]) + SET_SPEED = bytearray([0x0, 0x0, 0x0, 0x06]) + # Reads temperature from reaction wheel into dataset with id 8 + GET_TEMPERATURE = bytearray([0x0, 0x0, 0x0, 0x08]) + + +class SpeedDefinitions: + RPM_100 = 1000 + RPM_5000 = 5000 + + +class RampTime: + MS_100 = 100 + + +def pack_single_rw_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: + tc_queue.appendleft( + (QueueCommands.PRINT, + "Testing reaction wheel handler with object id: 0x" + object_id.hex()) + ) + + if op_code == "0" or op_code == "1": + tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Set speed")) + command = pack_set_speed_command(SpeedDefinitions.RPM_100, RampTime.MS_100) + command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + + return tc_queue + + +def pack_set_speed_command(object_id: bytearray, speed: int, ramp_time: int) -> bytearray: + """ 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 specified in 0.1 * RPM + @param ramp_time The time after which the reaction wheel will reached the commanded speed. Valid times are + 10 - 10000 ms + """ + command_id = RwCommandIds.SET_SPEED + command = bytearray() + command = object_id + command_id + command.extend(speed.to_bytes(length=4, byteorder='big')) + command.extend(ramp_time.to_bytes(length=2, byteorder='big')) + return command diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py index 41b572b..e9a7042 100644 --- a/pus_tc/tc_packer_hook.py +++ b/pus_tc/tc_packer_hook.py @@ -68,6 +68,9 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu if service == CustomServiceList.PLOC.value: object_id = PLOC_ID return pack_ploc_test_into(object_id=object_id, tc_queue=service_queue) + if service == CustomServiceList.REACTION_WHEEL.value: + object_id = + return pack_ploc_test_into(object_id=object_id, tc_queue=service_queue) LOGGER.warning("Invalid Service !") diff --git a/tmtccmd b/tmtccmd index b4358a1..b0cf33b 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit b4358a15fd945a9e0103a707b2a2dc56c458b24a +Subproject commit b0cf33b8a6223247c5df38e5918ac8885c494c11 From 899cd942ce7136f371e93d270a6c6c149c0698cb Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Fri, 25 Jun 2021 12:16:35 +0200 Subject: [PATCH 07/32] reaction wheel commands --- config/object_ids.py | 5 ++++- pus_tc/tc_packer_hook.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/object_ids.py b/config/object_ids.py index e115c49..c3360d9 100644 --- a/config/object_ids.py +++ b/config/object_ids.py @@ -19,7 +19,10 @@ SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x00, 0x10, 0x01]) SYRLINKS_HANDLER = bytes([0x44, 0x00, 0x10, 0x02]) IMTQ_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x14]) PLOC_ID = bytearray([0x44, 0x00, 0x00, 0x15]) -RW1_ID = bytearray([0x44, 0x00, 0x00, 0x15]) +RW1_ID = bytearray([0x44, 0x21, 0x00, 0x1]) +RW2_ID = bytearray([0x44, 0x21, 0x00, 0x2]) +RW3_ID = bytearray([0x44, 0x21, 0x00, 0x3]) +RW4_ID = bytearray([0x44, 0x21, 0x00, 0x4]) def get_object_ids() -> Dict[bytes, list]: diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py index e9a7042..bd34907 100644 --- a/pus_tc/tc_packer_hook.py +++ b/pus_tc/tc_packer_hook.py @@ -24,7 +24,7 @@ from pus_tc.ploc import pack_ploc_test_into from pus_tc.heater import pack_heater_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 + TMP_1075_1_HANDLER_ID, TMP_1075_2_HANDLER_ID, HEATER_ID, IMTQ_HANDLER_ID, PLOC_ID, RW1_ID LOGGER = get_logger() @@ -69,7 +69,7 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu object_id = PLOC_ID return pack_ploc_test_into(object_id=object_id, tc_queue=service_queue) if service == CustomServiceList.REACTION_WHEEL.value: - object_id = + object_id = RW1_ID return pack_ploc_test_into(object_id=object_id, tc_queue=service_queue) LOGGER.warning("Invalid Service !") From 19b76d961c61966a0093d3768f62d99196e1c9b2 Mon Sep 17 00:00:00 2001 From: Martin Zietz Date: Fri, 25 Jun 2021 15:25:22 +0200 Subject: [PATCH 08/32] rw test fixes --- config/object_ids.py | 16 ++++++++++------ pus_tc/reaction_wheels.py | 8 ++++---- pus_tc/tc_packer_hook.py | 3 ++- tmtc_core | 1 + 4 files changed, 17 insertions(+), 11 deletions(-) create mode 160000 tmtc_core diff --git a/config/object_ids.py b/config/object_ids.py index c3360d9..ed2cdef 100644 --- a/config/object_ids.py +++ b/config/object_ids.py @@ -17,12 +17,12 @@ HEATER_ID = bytes([0x54, 0x00, 0x00, 0x1]) PCDU_HANDLER_ID = bytes([0x44, 0x00, 0x10, 0x00]) SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x00, 0x10, 0x01]) SYRLINKS_HANDLER = bytes([0x44, 0x00, 0x10, 0x02]) -IMTQ_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x14]) -PLOC_ID = bytearray([0x44, 0x00, 0x00, 0x15]) -RW1_ID = bytearray([0x44, 0x21, 0x00, 0x1]) -RW2_ID = bytearray([0x44, 0x21, 0x00, 0x2]) -RW3_ID = bytearray([0x44, 0x21, 0x00, 0x3]) -RW4_ID = bytearray([0x44, 0x21, 0x00, 0x4]) +IMTQ_HANDLER_ID = bytes([0x44, 0x00, 0x00, 0x14]) +PLOC_ID = bytes([0x44, 0x00, 0x00, 0x15]) +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]) def get_object_ids() -> Dict[bytes, list]: @@ -38,5 +38,9 @@ def get_object_ids() -> Dict[bytes, list]: HEATER_ID: "Heater", PCDU_HANDLER_ID: "PCDU", SOLAR_ARRAY_DEPLOYMENT_ID: "Solar Array Deployment", + RW1_ID: "Reaction Wheel 1", + RW2_ID: "Reaction Wheel 2", + RW3_ID: "Reaction Wheel 3", + RW4_ID: "Reaction Wheel 4", }) return object_id_dict diff --git a/pus_tc/reaction_wheels.py b/pus_tc/reaction_wheels.py index b84c264..24d764e 100644 --- a/pus_tc/reaction_wheels.py +++ b/pus_tc/reaction_wheels.py @@ -32,7 +32,7 @@ class SpeedDefinitions: class RampTime: - MS_100 = 100 + MS_1000 = 1000 def pack_single_rw_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: @@ -43,7 +43,7 @@ def pack_single_rw_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: if op_code == "0" or op_code == "1": tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Set speed")) - command = pack_set_speed_command(SpeedDefinitions.RPM_100, RampTime.MS_100) + command = pack_set_speed_command(object_id, 10000, 1000) command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) @@ -60,6 +60,6 @@ def pack_set_speed_command(object_id: bytearray, speed: int, ramp_time: int) -> command_id = RwCommandIds.SET_SPEED command = bytearray() command = object_id + command_id - command.extend(speed.to_bytes(length=4, byteorder='big')) - command.extend(ramp_time.to_bytes(length=2, byteorder='big')) + command = command + speed.to_bytes(length=4, byteorder='big') + command = command + ramp_time.to_bytes(length=2, byteorder='big') return command diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py index bd34907..dce0404 100644 --- a/pus_tc/tc_packer_hook.py +++ b/pus_tc/tc_packer_hook.py @@ -22,6 +22,7 @@ from pus_tc.imtq import pack_imtq_test_into 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 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 @@ -70,7 +71,7 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu return pack_ploc_test_into(object_id=object_id, tc_queue=service_queue) if service == CustomServiceList.REACTION_WHEEL.value: object_id = RW1_ID - return pack_ploc_test_into(object_id=object_id, tc_queue=service_queue) + return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) LOGGER.warning("Invalid Service !") diff --git a/tmtc_core b/tmtc_core new file mode 160000 index 0000000..bd46c5a --- /dev/null +++ b/tmtc_core @@ -0,0 +1 @@ +Subproject commit bd46c5a85262140ab097b2704926745e1a0687d1 From 10ea97ff0b685014f8f79b124edc8009db6fd879 Mon Sep 17 00:00:00 2001 From: Martin Zietz Date: Mon, 28 Jun 2021 14:08:04 +0200 Subject: [PATCH 09/32] add init command --- pus_tc/reaction_wheels.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pus_tc/reaction_wheels.py b/pus_tc/reaction_wheels.py index 24d764e..b407976 100644 --- a/pus_tc/reaction_wheels.py +++ b/pus_tc/reaction_wheels.py @@ -5,6 +5,7 @@ @author J. Meier @date 25.03.2021 """ +import struct from tmtccmd.config.definitions import QueueCommands from tmtccmd.pus_tc.packer import TcQueueT @@ -21,6 +22,7 @@ class RwCommandIds: RESET_MCU = bytearray([0x0, 0x0, 0x0, 0x01]) # Reads status information from reaction wheel into dataset with id 4 GET_RW_STATUS = bytearray([0x0, 0x0, 0x0, 0x04]) + INIT_RW_CONTROLLER = bytearray([0x0, 0x0, 0x0, 0x05]) SET_SPEED = bytearray([0x0, 0x0, 0x0, 0x06]) # Reads temperature from reaction wheel into dataset with id 8 GET_TEMPERATURE = bytearray([0x0, 0x0, 0x0, 0x08]) @@ -43,10 +45,15 @@ def pack_single_rw_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: if op_code == "0" or op_code == "1": tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Set speed")) - command = pack_set_speed_command(object_id, 10000, 1000) + command = pack_set_speed_command(object_id, -2000, 100) command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) + tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Init reaction wheel controller")) + command = object_id + RwCommandIds.INIT_RW_CONTROLLER + command = PusTelecommand(service=8, subservice=128, ssc=41, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + return tc_queue @@ -60,6 +67,6 @@ def pack_set_speed_command(object_id: bytearray, speed: int, ramp_time: int) -> command_id = RwCommandIds.SET_SPEED command = bytearray() command = object_id + command_id - command = command + speed.to_bytes(length=4, byteorder='big') + command = command + struct.pack('!i', speed) command = command + ramp_time.to_bytes(length=2, byteorder='big') return command From 98deb8444f84e94dc0252ad3c51eb61574174b90 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 28 Jun 2021 17:49:13 +0200 Subject: [PATCH 10/32] updated gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 50cba5f..ec6e113 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ log /lib /lib64 /share + +/venv From 8048c50c227065dfdc1cb715b108fe6e79d5a88e Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 28 Jun 2021 18:55:14 +0200 Subject: [PATCH 11/32] tmtccmd update --- tmtccmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtccmd b/tmtccmd index b0cf33b..e839281 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit b0cf33b8a6223247c5df38e5918ac8885c494c11 +Subproject commit e83928127df3451171d8d5c22d8c2ca1d571d629 From 9d98eb6b606b40fa26aad12786894d1a99cb726c Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 28 Jun 2021 19:06:09 +0200 Subject: [PATCH 12/32] renaming logging functions --- config/custom_mode_op.py | 4 ++-- config/globals_config.py | 4 ++-- pus_tc/tc_packer_hook.py | 4 ++-- pus_tm/factory_hook.py | 4 ++-- pus_tm/hk_handling.py | 4 ++-- tmtccmd | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config/custom_mode_op.py b/config/custom_mode_op.py index a82797b..159e350 100644 --- a/config/custom_mode_op.py +++ b/config/custom_mode_op.py @@ -6,9 +6,9 @@ import enum from tmtccmd.core.backend import TmTcHandler -from tmtccmd.utility.logger import get_logger +from tmtccmd.utility.logger import get_console_logger -LOGGER = get_logger() +LOGGER = get_console_logger() class CustomModeList(enum.IntEnum): diff --git a/config/globals_config.py b/config/globals_config.py index b8274bb..3fc9b35 100644 --- a/config/globals_config.py +++ b/config/globals_config.py @@ -14,9 +14,9 @@ from config.custom_mode_op import CustomModeList from tmtccmd.config.definitions import CoreComInterfaces from tmtccmd.config.globals import set_default_globals_pre_args_parsing, \ set_default_globals_post_args_parsing -from tmtccmd.utility.logger import get_logger +from tmtccmd.utility.logger import get_console_logger -LOGGER = get_logger() +LOGGER = get_console_logger() class CustomGlobalIds(enum.Enum): diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py index 41b572b..b1ee736 100644 --- a/pus_tc/tc_packer_hook.py +++ b/pus_tc/tc_packer_hook.py @@ -9,7 +9,7 @@ from collections import deque from typing import Union from tmtccmd.config.definitions import CoreServiceList -from tmtccmd.utility.logger import get_logger +from tmtccmd.utility.logger import get_console_logger from tmtccmd.pus_tc.definitions import TcQueueT from tmtccmd.pus_tc.service_5_event import pack_generic_service5_test_into from tmtccmd.pus_tc.service_17_test import pack_service17_ping_command @@ -27,7 +27,7 @@ from config.object_ids import P60_DOCK_HANDLER, PDU_1_HANDLER_ID, PDU_2_HANDLER_ TMP_1075_1_HANDLER_ID, TMP_1075_2_HANDLER_ID, HEATER_ID, IMTQ_HANDLER_ID, PLOC_ID -LOGGER = get_logger() +LOGGER = get_console_logger() def pack_service_queue_user(service: Union[str, int], op_code: str, service_queue: TcQueueT): diff --git a/pus_tm/factory_hook.py b/pus_tm/factory_hook.py index ab2b264..d1a2bac 100644 --- a/pus_tm/factory_hook.py +++ b/pus_tm/factory_hook.py @@ -5,7 +5,7 @@ """ from tmtccmd.pus_tm.service_8_functional_cmd import Service8TM from tmtccmd.ecss.tm import PusTelemetry -from tmtccmd.utility.logger import get_logger +from tmtccmd.utility.logger import get_console_logger from tmtccmd.pus_tm.service_1_verification import Service1TM from tmtccmd.pus_tm.service_3_housekeeping import Service3TM @@ -15,7 +15,7 @@ from tmtccmd.utility.tmtc_printer import TmTcPrinter from config.definitions import PUS_APID -LOGGER = get_logger() +LOGGER = get_console_logger() def ccsds_tm_handler(apid: int, raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter) -> None: diff --git a/pus_tm/hk_handling.py b/pus_tm/hk_handling.py index f093ae7..681c8aa 100644 --- a/pus_tm/hk_handling.py +++ b/pus_tm/hk_handling.py @@ -8,11 +8,11 @@ import struct from typing import Tuple from tmtccmd.pus_tm.service_3_housekeeping import Service3Base -from tmtccmd.utility.logger import get_logger +from tmtccmd.utility.logger import get_console_logger from pus_tc.syrlinks_hk_handler import SetIds from pus_tc.imtq import ImtqSetIds from config.object_ids import SYRLINKS_HANDLER, IMTQ_HANDLER_ID -LOGGER = get_logger() +LOGGER = get_console_logger() def handle_user_hk_packet(object_id: bytes, set_id: int, hk_data: bytearray, diff --git a/tmtccmd b/tmtccmd index e839281..742e73d 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit e83928127df3451171d8d5c22d8c2ca1d571d629 +Subproject commit 742e73dba0fbcad35768a268320c419854eab2ae From a8ea01bb2fced3d7562af4b200080e424468e9c6 Mon Sep 17 00:00:00 2001 From: Martin Zietz Date: Tue, 29 Jun 2021 09:51:54 +0200 Subject: [PATCH 13/32] added run configs for reaction wheels --- .idea/runConfigurations/RW1_Test.xml | 24 ++++++++++++++++++++++++ .idea/runConfigurations/RW2_Test_.xml | 24 ++++++++++++++++++++++++ .idea/runConfigurations/RW3_Test_.xml | 24 ++++++++++++++++++++++++ .idea/runConfigurations/RW4_Test_.xml | 24 ++++++++++++++++++++++++ config/definitions.py | 5 ++++- pus_tc/reaction_wheels.py | 10 +++++----- pus_tc/tc_packer_hook.py | 13 +++++++++++-- 7 files changed, 116 insertions(+), 8 deletions(-) create mode 100644 .idea/runConfigurations/RW1_Test.xml create mode 100644 .idea/runConfigurations/RW2_Test_.xml create mode 100644 .idea/runConfigurations/RW3_Test_.xml create mode 100644 .idea/runConfigurations/RW4_Test_.xml diff --git a/.idea/runConfigurations/RW1_Test.xml b/.idea/runConfigurations/RW1_Test.xml new file mode 100644 index 0000000..69a1cd0 --- /dev/null +++ b/.idea/runConfigurations/RW1_Test.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/RW2_Test_.xml b/.idea/runConfigurations/RW2_Test_.xml new file mode 100644 index 0000000..3c8d71d --- /dev/null +++ b/.idea/runConfigurations/RW2_Test_.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/RW3_Test_.xml b/.idea/runConfigurations/RW3_Test_.xml new file mode 100644 index 0000000..f874325 --- /dev/null +++ b/.idea/runConfigurations/RW3_Test_.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/RW4_Test_.xml b/.idea/runConfigurations/RW4_Test_.xml new file mode 100644 index 0000000..eaca002 --- /dev/null +++ b/.idea/runConfigurations/RW4_Test_.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/config/definitions.py b/config/definitions.py index 3ef84d2..a5e094b 100644 --- a/config/definitions.py +++ b/config/definitions.py @@ -23,4 +23,7 @@ class CustomServiceList(enum.Enum): PLOC = "ploc" PCDU = "pcdu", SA_DEPLYOMENT = "sa_depl" - REACTION_WHEEL = "reaction_wheel" + REACTION_WHEEL_1 = "reaction_wheel_1" + REACTION_WHEEL_2 = "reaction_wheel_2" + REACTION_WHEEL_3 = "reaction_wheel_3" + REACTION_WHEEL_4 = "reaction_wheel_4" diff --git a/pus_tc/reaction_wheels.py b/pus_tc/reaction_wheels.py index b407976..3aaa411 100644 --- a/pus_tc/reaction_wheels.py +++ b/pus_tc/reaction_wheels.py @@ -45,14 +45,14 @@ def pack_single_rw_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: if op_code == "0" or op_code == "1": tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Set speed")) - command = pack_set_speed_command(object_id, -2000, 100) + command = pack_set_speed_command(object_id, 0, 1000) command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Init reaction wheel controller")) - command = object_id + RwCommandIds.INIT_RW_CONTROLLER - command = PusTelecommand(service=8, subservice=128, ssc=41, app_data=command) - tc_queue.appendleft(command.pack_command_tuple()) + # tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Init reaction wheel controller")) + # command = object_id + RwCommandIds.INIT_RW_CONTROLLER + # command = PusTelecommand(service=8, subservice=128, ssc=41, app_data=command) + # tc_queue.appendleft(command.pack_command_tuple()) return tc_queue diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py index dce0404..0b60522 100644 --- a/pus_tc/tc_packer_hook.py +++ b/pus_tc/tc_packer_hook.py @@ -25,7 +25,7 @@ from pus_tc.heater import pack_heater_test_into from pus_tc.reaction_wheels import pack_single_rw_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 + 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 LOGGER = get_logger() @@ -69,9 +69,18 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu if service == CustomServiceList.PLOC.value: object_id = PLOC_ID return pack_ploc_test_into(object_id=object_id, tc_queue=service_queue) - if service == CustomServiceList.REACTION_WHEEL.value: + if service == CustomServiceList.REACTION_WHEEL_1.value: object_id = RW1_ID return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) + if service == CustomServiceList.REACTION_WHEEL_2.value: + object_id = RW2_ID + return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) + if service == CustomServiceList.REACTION_WHEEL_3.value: + object_id = RW3_ID + return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) + 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) LOGGER.warning("Invalid Service !") From 09cab1941fad0bbe8fa54234f7513c61e22038ca Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Tue, 29 Jun 2021 16:10:03 +0200 Subject: [PATCH 14/32] modified run configs --- .idea/runConfigurations/RW1_Test.xml | 4 +-- .idea/runConfigurations/RW2_Test_.xml | 4 +-- .idea/runConfigurations/RW3_Test_.xml | 4 +-- .idea/runConfigurations/RW4_Test_.xml | 4 +-- .../tmtcclient_Heater_Test_UDP.xml | 24 ++++++++++++++++++ .../tmtcclient_IMTQ_Command_Dipole.xml | 24 ++++++++++++++++++ .../tmtcclient_IMTQ_Get_Commanded_Dipole.xml | 24 ++++++++++++++++++ .../tmtcclient_IMTQ_Neg_X_Test.xml | 24 ++++++++++++++++++ .../tmtcclient_IMTQ_Neg_Y_Test.xml | 24 ++++++++++++++++++ .../tmtcclient_IMTQ_Neg_Z_Test.xml | 24 ++++++++++++++++++ .../tmtcclient_IMTQ_Pos_X_Test.xml | 24 ++++++++++++++++++ .../tmtcclient_IMTQ_Pos_Y_Test.xml | 24 ++++++++++++++++++ .../tmtcclient_IMTQ_Pos_Z_Test.xml | 24 ++++++++++++++++++ .../tmtcclient_IMTQ_Test_UDP.xml | 24 ++++++++++++++++++ .../tmtcclient_PLOC_Test_UDP_Flatsat.xml | 24 ++++++++++++++++++ .../tmtcclient_PLOC_Test_UDP_Local.xml | 24 ++++++++++++++++++ .../tmtcclient_S_A_Deployment_Test_UDP.xml | 24 ++++++++++++++++++ .../tmtcclient_Syrlinks_Test_UDP.xml | 24 ++++++++++++++++++ .../tmtcclient_TMP1075_1_Dock_Test_UDP.xml | 24 ++++++++++++++++++ .../tmtcclient_TMP1075_2_Dock_Test_UDP.xml | 24 ++++++++++++++++++ config/hook_implementations.py | 19 ++++++++++++-- pus_tc/reaction_wheels.py | 25 +++++++++++++++---- 22 files changed, 429 insertions(+), 15 deletions(-) create mode 100644 .idea/runConfigurations/tmtcclient_Heater_Test_UDP.xml create mode 100644 .idea/runConfigurations/tmtcclient_IMTQ_Command_Dipole.xml create mode 100644 .idea/runConfigurations/tmtcclient_IMTQ_Get_Commanded_Dipole.xml create mode 100644 .idea/runConfigurations/tmtcclient_IMTQ_Neg_X_Test.xml create mode 100644 .idea/runConfigurations/tmtcclient_IMTQ_Neg_Y_Test.xml create mode 100644 .idea/runConfigurations/tmtcclient_IMTQ_Neg_Z_Test.xml create mode 100644 .idea/runConfigurations/tmtcclient_IMTQ_Pos_X_Test.xml create mode 100644 .idea/runConfigurations/tmtcclient_IMTQ_Pos_Y_Test.xml create mode 100644 .idea/runConfigurations/tmtcclient_IMTQ_Pos_Z_Test.xml create mode 100644 .idea/runConfigurations/tmtcclient_IMTQ_Test_UDP.xml create mode 100644 .idea/runConfigurations/tmtcclient_PLOC_Test_UDP_Flatsat.xml create mode 100644 .idea/runConfigurations/tmtcclient_PLOC_Test_UDP_Local.xml create mode 100644 .idea/runConfigurations/tmtcclient_S_A_Deployment_Test_UDP.xml create mode 100644 .idea/runConfigurations/tmtcclient_Syrlinks_Test_UDP.xml create mode 100644 .idea/runConfigurations/tmtcclient_TMP1075_1_Dock_Test_UDP.xml create mode 100644 .idea/runConfigurations/tmtcclient_TMP1075_2_Dock_Test_UDP.xml diff --git a/.idea/runConfigurations/RW1_Test.xml b/.idea/runConfigurations/RW1_Test.xml index 69a1cd0..c013f3d 100644 --- a/.idea/runConfigurations/RW1_Test.xml +++ b/.idea/runConfigurations/RW1_Test.xml @@ -6,14 +6,14 @@ -