diff --git a/.idea/runConfigurations/Syrlinks_Test_UDP.xml b/.idea/runConfigurations/Syrlinks_Test_UDP.xml new file mode 100644 index 0000000..83cc53f --- /dev/null +++ b/.idea/runConfigurations/Syrlinks_Test_UDP.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/tmtcc_Service_17.xml b/.idea/runConfigurations/tmtcc_Service_17.xml new file mode 100644 index 0000000..06866e6 --- /dev/null +++ b/.idea/runConfigurations/tmtcc_Service_17.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/config/hook_implementations.py b/config/hook_implementations.py index ac612fa..43ad2a4 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -282,32 +282,36 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): service_ploc_updater_tuple = ("Ploc Updater", op_code_dict_srv_ploc_updater) op_code_dict_srv_star_tracker = { - "0": ("Star Tracker: Ping", {OpCodeDictKeys.TIMEOUT: 2.0}), - "1": ("Star Tracker: Reboot", {OpCodeDictKeys.TIMEOUT: 2.0}), - "2": ("Star Tracker: Request temperature", {OpCodeDictKeys.TIMEOUT: 2.0}), - "3": ("Star Tracker: Request version", {OpCodeDictKeys.TIMEOUT: 2.0}), - "4": ("Star Tracker: Request interface", {OpCodeDictKeys.TIMEOUT: 2.0}), - "5": ("Star Tracker: Request power", {OpCodeDictKeys.TIMEOUT: 2.0}), - "6": ("Star Tracker: Subscribe to telemetry", {OpCodeDictKeys.TIMEOUT: 2.0}), - "7": ("Star Tracker: Boot image (requires bootloader mode)", {OpCodeDictKeys.TIMEOUT: 2.0}), - "8": ("Star Tracker: Request time", {OpCodeDictKeys.TIMEOUT: 2.0}), - "9": ("Star Tracker: Request solution", {OpCodeDictKeys.TIMEOUT: 2.0}), - "10": ("Star Tracker: Upload image", {OpCodeDictKeys.TIMEOUT: 2.0}), - "11": ("Star Tracker: Download image", {OpCodeDictKeys.TIMEOUT: 2.0}), - "12": ("Star Tracker: Limits", {OpCodeDictKeys.TIMEOUT: 2.0}), - "13": ("Star Tracker: Tracking", {OpCodeDictKeys.TIMEOUT: 2.0}), - "14": ("Star Tracker: Mounting", {OpCodeDictKeys.TIMEOUT: 2.0}), - "15": ("Star Tracker: Camera", {OpCodeDictKeys.TIMEOUT: 2.0}), - "16": ("Star Tracker: Blob", {OpCodeDictKeys.TIMEOUT: 2.0}), - "17": ("Star Tracker: Centroiding", {OpCodeDictKeys.TIMEOUT: 2.0}), - "18": ("Star Tracker: LISA", {OpCodeDictKeys.TIMEOUT: 2.0}), - "19": ("Star Tracker: Matching", {OpCodeDictKeys.TIMEOUT: 2.0}), - "20": ("Star Tracker: Validation", {OpCodeDictKeys.TIMEOUT: 2.0}), - "21": ("Star Tracker: Algo", {OpCodeDictKeys.TIMEOUT: 2.0}), - "22": ("Star Tracker: Take image", {OpCodeDictKeys.TIMEOUT: 2.0}), - "23": ("Star Tracker: Stop image loader", {OpCodeDictKeys.TIMEOUT: 2.0}), - "24": ("Star Tracker: Reset error signal", {OpCodeDictKeys.TIMEOUT: 2.0}), - "25": ("Star Tracker: Set name of download image", {OpCodeDictKeys.TIMEOUT: 2.0}), + "0": ("Star Tracker: Mode On", {OpCodeDictKeys.TIMEOUT: 2.0}), + "1": ("Star Tracker: Mode Normal", {OpCodeDictKeys.TIMEOUT: 2.0}), + "2": ("Star Tracker: Mode Off", {OpCodeDictKeys.TIMEOUT: 2.0}), + "3": ("Star Tracker: Mode Raw", {OpCodeDictKeys.TIMEOUT: 2.0}), + "4": ("Star Tracker: Ping", {OpCodeDictKeys.TIMEOUT: 2.0}), + "5": ("Star Tracker: Switch to bootloader program", {OpCodeDictKeys.TIMEOUT: 2.0}), + "6": ("Star Tracker: Request temperature", {OpCodeDictKeys.TIMEOUT: 2.0}), + "7": ("Star Tracker: Request version", {OpCodeDictKeys.TIMEOUT: 2.0}), + "8": ("Star Tracker: Request interface", {OpCodeDictKeys.TIMEOUT: 2.0}), + "9": ("Star Tracker: Request power", {OpCodeDictKeys.TIMEOUT: 2.0}), + "10": ("Star Tracker: Subscribe to telemetry", {OpCodeDictKeys.TIMEOUT: 2.0}), + "11": ("Star Tracker: Boot image (requires bootloader mode)", {OpCodeDictKeys.TIMEOUT: 2.0}), + "12": ("Star Tracker: Request time", {OpCodeDictKeys.TIMEOUT: 2.0}), + "13": ("Star Tracker: Request solution", {OpCodeDictKeys.TIMEOUT: 2.0}), + "14": ("Star Tracker: Upload image", {OpCodeDictKeys.TIMEOUT: 2.0}), + "15": ("Star Tracker: Download image", {OpCodeDictKeys.TIMEOUT: 2.0}), + "16": ("Star Tracker: Limits", {OpCodeDictKeys.TIMEOUT: 2.0}), + "17": ("Star Tracker: Tracking", {OpCodeDictKeys.TIMEOUT: 2.0}), + "18": ("Star Tracker: Mounting", {OpCodeDictKeys.TIMEOUT: 2.0}), + "19": ("Star Tracker: Camera", {OpCodeDictKeys.TIMEOUT: 2.0}), + "20": ("Star Tracker: Blob", {OpCodeDictKeys.TIMEOUT: 2.0}), + "21": ("Star Tracker: Centroiding", {OpCodeDictKeys.TIMEOUT: 2.0}), + "22": ("Star Tracker: LISA", {OpCodeDictKeys.TIMEOUT: 2.0}), + "23": ("Star Tracker: Matching", {OpCodeDictKeys.TIMEOUT: 2.0}), + "24": ("Star Tracker: Validation", {OpCodeDictKeys.TIMEOUT: 2.0}), + "25": ("Star Tracker: Algo", {OpCodeDictKeys.TIMEOUT: 2.0}), + "26": ("Star Tracker: Take image", {OpCodeDictKeys.TIMEOUT: 2.0}), + "27": ("Star Tracker: Stop image loader", {OpCodeDictKeys.TIMEOUT: 2.0}), + "28": ("Star Tracker: Reset error signal", {OpCodeDictKeys.TIMEOUT: 2.0}), + "29": ("Star Tracker: Set name of download image", {OpCodeDictKeys.TIMEOUT: 2.0}), } service_star_tracker_tuple = ("Star tracker", op_code_dict_srv_star_tracker) diff --git a/pus_tc/star_tracker.py b/pus_tc/star_tracker.py index 42a402f..9b974c4 100644 --- a/pus_tc/star_tracker.py +++ b/pus_tc/star_tracker.py @@ -11,6 +11,7 @@ from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT from spacepackets.ecss.tc import PusTelecommand +from pus_tc.service_200_mode import pack_mode_data class StarTrackerActionIds: @@ -20,7 +21,7 @@ class StarTrackerActionIds: REQ_INTERFACE = 3 REQ_TIME = 4 REQ_POWER = 11 - REBOOT = 7 + SWITCH_TO_BOOTLOADER_PROGRAM = 7 DOWNLOAD_IMAGE = 9 UPLOAD_IMAGE = 10 SUBSCRIBE_TO_TM = 18 @@ -56,145 +57,165 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code ) if op_code == "0": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mode On")) + command = pack_mode_data(object_id, 1, 0) + command = PusTelecommand(service=200, subservice=1, ssc=10, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "1": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mode Normal")) + command = pack_mode_data(object_id, 2, 0) + command = PusTelecommand(service=200, subservice=1, ssc=11, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "2": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mode Off")) + command = pack_mode_data(object_id, 0, 0) + command = PusTelecommand(service=200, subservice=1, ssc=12, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "3": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mode Raw")) + command = pack_mode_data(object_id, 3, 0) + command = PusTelecommand(service=200, subservice=1, ssc=13, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "4": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Ping")) command = object_id + struct.pack('!I', StarTrackerActionIds.PING) command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "1": - tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Reboot star tracker")) - command = object_id + struct.pack('!I', StarTrackerActionIds.REBOOT) + if op_code == "5": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Switch to bootloader program")) + command = object_id + struct.pack('!I', StarTrackerActionIds.SWITCH_TO_BOOTLOADER_PROGRAM) command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "2": + if op_code == "6": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Temperature request")) command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_TEMPERATURE) command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "3": + if op_code == "7": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request version")) command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_VERSION) command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "4": + if op_code == "8": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request interface")) command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_INTERFACE) command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "5": + if op_code == "9": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request power")) command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_POWER) command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "6": + if op_code == "10": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Subscribe to telemetry")) tm_id = int(input("Specify Id of tm: ")) command = object_id + struct.pack('!I', StarTrackerActionIds.SUBSCRIBE_TO_TM) + struct.pack('B', tm_id) command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "7": + if op_code == "11": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Boot")) command = object_id + struct.pack('!I', StarTrackerActionIds.BOOT) command = PusTelecommand(service=8, subservice=128, ssc=37, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "8": + if op_code == "12": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request time")) command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_TIME) command = PusTelecommand(service=8, subservice=128, ssc=38, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "9": + if op_code == "13": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request solution")) command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_SOLUTION) command = PusTelecommand(service=8, subservice=128, ssc=39, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "10": + if op_code == "14": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload image")) command = object_id + struct.pack('!I', StarTrackerActionIds.UPLOAD_IMAGE) + \ bytearray(ImagePathDefs.uploadFile, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "11": + if op_code == "15": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download image")) command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_IMAGE) + \ bytearray(ImagePathDefs.downloadPath, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=53, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "12": + if op_code == "16": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set limits")) command = object_id + struct.pack('!I', StarTrackerActionIds.LIMITS) + \ bytearray(ImagePathDefs.jsonFile, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=42, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "13": + if op_code == "17": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set tracking parameters")) command = object_id + struct.pack('!I', StarTrackerActionIds.TRACKING) + \ bytearray(ImagePathDefs.jsonFile, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "14": + if op_code == "18": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mounting")) command = object_id + struct.pack('!I', StarTrackerActionIds.MOUNTING) + \ bytearray(ImagePathDefs.jsonFile, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "15": + if op_code == "19": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Camera")) command = object_id + struct.pack('!I', StarTrackerActionIds.CAMERA) + \ bytearray(ImagePathDefs.jsonFile, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "16": + if op_code == "20": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Blob")) command = object_id + struct.pack('!I', StarTrackerActionIds.BLOB) + \ bytearray(ImagePathDefs.jsonFile, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=46, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "17": + if op_code == "21": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Centroiding")) command = object_id + struct.pack('!I', StarTrackerActionIds.CENTROIDING) + \ bytearray(ImagePathDefs.jsonFile, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=47, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "18": + if op_code == "22": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: LISA")) command = object_id + struct.pack('!I', StarTrackerActionIds.LISA) + \ bytearray(ImagePathDefs.jsonFile, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=48, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "19": + if op_code == "23": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Matching")) command = object_id + struct.pack('!I', StarTrackerActionIds.MATCHING) + \ bytearray(ImagePathDefs.jsonFile, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=49, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "20": + if op_code == "24": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Validation")) command = object_id + struct.pack('!I', StarTrackerActionIds.VALIDATION) + \ bytearray(ImagePathDefs.jsonFile, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=50, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "21": + if op_code == "25": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Algo")) command = object_id + struct.pack('!I', StarTrackerActionIds.ALGO) + \ bytearray(ImagePathDefs.jsonFile, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=51, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "22": + if op_code == "26": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Take image")) - actionid = int(input("Specify parameter ID: ")) + actionid = int(input("Specify parameter ID (nominal - 4): ")) command = object_id + struct.pack('!I', StarTrackerActionIds.TAKE_IMAGE) + struct.pack('!B', actionid) command = PusTelecommand(service=8, subservice=128, ssc=52, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "23": + if op_code == "27": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Stop image loader")) command = object_id + struct.pack('!I', StarTrackerActionIds.STOP_IMAGE_LOADER) command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "24": + if op_code == "28": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Reset error signal")) command = object_id + struct.pack('!I', StarTrackerActionIds.RESET_ERROR) command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == "25": + if op_code == "29": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set name of download image")) filename = input("Specify download image name: ") command = object_id + struct.pack('!I', StarTrackerActionIds.CHANGE_DOWNLOAD_IMAGE) + \