diff --git a/config/hook_implementations.py b/config/hook_implementations.py index 6544b82..ac612fa 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -295,6 +295,19 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): "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}), } 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 21ff070..42a402f 100644 --- a/pus_tc/star_tracker.py +++ b/pus_tc/star_tracker.py @@ -27,10 +27,25 @@ class StarTrackerActionIds: REQ_SOLUTION = 24 REQ_TEMPERATURE = 25 LIMITS = 40 + MOUNTING = 41 + CAMERA = 42 + BLOB = 43 + CENTROIDING = 44 + LISA = 45 + MATCHING = 46 + TRACKING = 47 + VALIDATION = 48 + ALGO = 49 + TAKE_IMAGE = 15 + STOP_IMAGE_LOADER = 55 + RESET_ERROR = 56 + CHANGE_DOWNLOAD_IMAGE = 57 class ImagePathDefs: uploadFile = "/mnt/sd0/startracker/gemma.bin" + downloadFile = "test_image.bin" + downloadPath = "/mnt/sd0/startracker" jsonFile = "/mnt/sd0/startracker/full.json" @@ -99,12 +114,90 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code tc_queue.appendleft(command.pack_command_tuple()) if op_code == "11": tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download image")) - command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_IMAGE) - command = PusTelecommand(service=8, subservice=128, ssc=41, app_data=command) + 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": 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=41, app_data=command) + command = PusTelecommand(service=8, subservice=128, ssc=42, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "13": + 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": + 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": + 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": + 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": + 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": + 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": + 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": + 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": + 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": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Take image")) + actionid = int(input("Specify parameter ID: ")) + 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": + 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": + 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": + 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) + \ + bytearray(filename, 'utf-8') + command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command) tc_queue.appendleft(command.pack_command_tuple())