From d9968031d641249ca0ad62e7c1c19ed22390078c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 13 Sep 2021 18:06:25 +0200 Subject: [PATCH] object ids cleaned up --- config/definitions.py | 1 + config/object_ids.py | 37 +++++++++++++++++++++++++++++-------- pus_tc/acs.py | 25 +++++++++++++++++++++++++ pus_tc/tc_packer_hook.py | 9 ++++----- tmtccmd | 2 +- 5 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 pus_tc/acs.py diff --git a/config/definitions.py b/config/definitions.py index 70765d5..65d130f 100644 --- a/config/definitions.py +++ b/config/definitions.py @@ -16,6 +16,7 @@ class CustomServiceList(enum.Enum): PDU1 = "pdu1" PDU2 = "pdu2" ACU = "acu" + ACS = "acs" TMP1075_1 = "tmp1075_1" TMP1075_2 = "tmp1075_2" HEATER = "heater" diff --git a/config/object_ids.py b/config/object_ids.py index 5a67a92..95b3f64 100644 --- a/config/object_ids.py +++ b/config/object_ids.py @@ -5,32 +5,53 @@ """ from typing import Dict -PUS_SERVICE_17_ID = bytes([0x53, 0x00, 0x00, 0x17]) -TEST_DEVICE_ID = bytes([0x54, 0x00, 0xAF, 0xFE]) +# Core Object IDs +CORE_CONTROLLER_ID = bytes([0x43, 0x00, 0x00, 0x03]) +SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x41, 0x10, 0xA2]) + +# Power Object IDs +PCDU_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0xA1]) 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]) + +# Thermal Object IDs +HEATER_ID = bytes([0x44, 0x41, 0x00, 0xA4]) 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, 0xA4]) -PCDU_HANDLER_ID = bytes([0x44, 0x20, 0x00, 0xA1]) -SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x41, 0x10, 0xA2]) + +# Communication Object IDs SYRLINKS_HANDLER = bytes([0x44, 0x53, 0x00, 0xA3]) -IMTQ_HANDLER_ID = bytes([0x44, 0x14, 0x00, 0x14]) -PLOC_MPSOC_ID = bytes([0x44, 0x33, 0x00, 0x15]) + +# ACS Object IDs +MGM_0_HANDLER_ID = bytes([0x44, 0x12, 0x00, 0x06]) +MGM_1_HANDLER_ID = bytes([0x44, 0x12, 0x01, 0x07]) +MGM_2_HANDLER_ID = bytes([0x44, 0x12, 0x02, 0x08]) +MGM_3_HANDLER_ID = bytes([0x44, 0x12, 0x03, 0x09]) +GYRO_0_HANDLER_ID = bytes([0x44, 0x12, 0x00, 0x10]) +GYRO_1_HANDLER_ID = bytes([0x44, 0x12, 0x01, 0x11]) +GYRO_2_HANDLER_ID = bytes([0x44, 0x12, 0x02, 0x12]) +GYRO_3_HANDLER_ID = bytes([0x44, 0x12, 0x03, 0x13]) GPS_HANDLER_0_ID = bytes([0x44, 0x13, 0x00, 0x45]) GPS_HANDLER_1_ID = bytes([0x44, 0x13, 0x01, 0x46]) RW1_ID = bytes([0x44, 0x12, 0x00, 0x47]) RW2_ID = bytes([0x44, 0x12, 0x01, 0x48]) RW3_ID = bytes([0x44, 0x12, 0x02, 0x49]) RW4_ID = bytes([0x44, 0x12, 0x03, 0x50]) +IMTQ_HANDLER_ID = bytes([0x44, 0x14, 0x00, 0x14]) + +# Misc Object IDs +PUS_SERVICE_17_ID = bytes([0x53, 0x00, 0x00, 0x17]) +TEST_DEVICE_ID = bytes([0x54, 0x00, 0xAF, 0xFE]) + +# Payload Object IDs STAR_TRACKER_ID = bytes([0x44, 0x13, 0x00, 0x1]) RAD_SENSOR_ID = bytes([0x44, 0x32, 0x00, 0xA5]) PLOC_SUPV_ID = bytes([0x44, 0x33, 0x00, 0x16]) PLOC_UPDATER_ID = bytes([0x44, 0x33, 0x00, 0x00]) -CORE_CONTROLLER_ID = bytes([0x43, 0x00, 0x00, 0x03]) PLOC_MEMORY_DUMPER_ID = bytes([0x44, 0x33, 0x00, 0x01]) +PLOC_MPSOC_ID = bytes([0x44, 0x33, 0x00, 0x15]) def get_object_ids() -> Dict[bytes, list]: diff --git a/pus_tc/acs.py b/pus_tc/acs.py new file mode 100644 index 0000000..abe1431 --- /dev/null +++ b/pus_tc/acs.py @@ -0,0 +1,25 @@ +import enum +from tmtccmd.tc.definitions import TcQueueT +from tmtccmd.pus.service_list import PusServices +from tmtccmd.tc.service_200_mode import pack_mode_data, Modes +from tmtccmd.tc.packer import PusTelecommand +from config.object_ids import MGM_0_HANDLER_ID, MGM_1_HANDLER_ID, MGM_2_HANDLER_ID, MGM_3_HANDLER_ID + + +class AcsOpCodes(enum.Enum): + # Switch on A side + ON_MGM_0 = "0" + ON_MGM_1 = "1" + ON_GYRO_0 = "2" + ON_GYRO_1 = "3" + # Switch on B side + ON_MGM_2 = "4" + ON_MGM_3 = "5" + ON_GYRO_2 = "6" + ON_GYRO_3 = "7" + + +def pack_acs_command(tc_queue: TcQueueT, op_code: str): + if op_code == AcsOpCodes.ON_MGM_0.value: + app_data = pack_mode_data(object_id=MGM_0_HANDLER_ID, mode=Modes.ON, submode=0) + # return PusTelecommand(service=PusServices.SERVICE_200_MODE, subservice=) \ No newline at end of file diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py index 1717d79..5e093e3 100644 --- a/pus_tc/tc_packer_hook.py +++ b/pus_tc/tc_packer_hook.py @@ -1,9 +1,5 @@ +"""Hook function which packs telecommands based on service and operation code string """ -@brief This file transfers control of TC packing to the user -@details Template configuration file. Copy this folder to the TMTC commander root and adapt - it to your needs. -""" - import os from collections import deque from typing import Union @@ -31,6 +27,7 @@ from pus_tc.ploc_memory_dumper import pack_ploc_memory_dumper_cmd from pus_tc.core import pack_core_commands from pus_tc.star_tracker import pack_star_tracker_commands_into from pus_tc.gps import pack_gps_command +from pus_tc.acs import pack_acs_command 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, \ @@ -114,6 +111,8 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu return pack_ploc_memory_dumper_cmd( object_id=object_id, tc_queue=service_queue, op_code=op_code ) + if service == CustomServiceList.ACS.value: + return pack_acs_command(tc_queue=service_queue, op_code=op_code) if service == CustomServiceList.GPS_0.value: return pack_gps_command(object_id=GPS_HANDLER_0_ID, tc_queue=service_queue, op_code=op_code) if service == CustomServiceList.GPS_1.value: diff --git a/tmtccmd b/tmtccmd index 0d858a8..38be11c 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 0d858a8e96398f46f054f63c1d2d4225c192b330 +Subproject commit 38be11cab16c036fb0968f01d46d198be4cd058f