2021-08-16 10:03:40 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
@file star_tracker.py
|
|
|
|
@brief Star tracker commanding
|
|
|
|
@author J. Meier
|
|
|
|
@date 14.08.2021
|
|
|
|
"""
|
|
|
|
import struct
|
|
|
|
|
|
|
|
from tmtccmd.config.definitions import QueueCommands
|
|
|
|
|
|
|
|
from tmtccmd.tc.packer import TcQueueT
|
2021-10-01 10:55:56 +02:00
|
|
|
from spacepackets.ecss.tc import PusTelecommand
|
2022-02-23 18:16:10 +01:00
|
|
|
from tmtccmd.tc.service_200_mode import pack_mode_data, Modes
|
2022-04-05 00:51:52 +02:00
|
|
|
from tmtccmd.logging import get_console_logger
|
2022-02-14 16:52:32 +01:00
|
|
|
from utility.input_helper import InputHelper
|
2022-02-11 08:46:48 +01:00
|
|
|
|
2022-03-17 19:42:27 +01:00
|
|
|
|
2022-02-11 08:46:48 +01:00
|
|
|
LOGGER = get_console_logger()
|
2021-08-16 10:03:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
class StarTrackerActionIds:
|
|
|
|
PING = 0
|
2021-12-02 08:01:18 +01:00
|
|
|
BOOT = 1
|
|
|
|
REQ_VERSION = 2
|
|
|
|
REQ_INTERFACE = 3
|
|
|
|
REQ_TIME = 4
|
2022-01-17 08:40:16 +01:00
|
|
|
UNLOCK = 6
|
2021-12-14 19:25:23 +01:00
|
|
|
SWITCH_TO_BOOTLOADER_PROGRAM = 7
|
2022-01-01 11:17:01 +01:00
|
|
|
REQ_POWER = 11
|
|
|
|
TAKE_IMAGE = 15
|
2021-12-06 15:44:34 +01:00
|
|
|
DOWNLOAD_IMAGE = 9
|
|
|
|
UPLOAD_IMAGE = 10
|
2021-12-29 20:33:49 +01:00
|
|
|
DOWNLOAD_CENTROID = 16
|
|
|
|
UPLOAD_CENTROID = 17
|
2022-02-11 08:46:48 +01:00
|
|
|
SUBSCRIPTION = 18
|
2022-01-29 18:37:28 +01:00
|
|
|
IMAGE_PROCESSOR = 19
|
2021-12-02 08:01:18 +01:00
|
|
|
REQ_SOLUTION = 24
|
2021-08-16 10:03:40 +02:00
|
|
|
REQ_TEMPERATURE = 25
|
2021-12-17 15:09:25 +01:00
|
|
|
REQ_HISTOGRAM = 28
|
2021-12-19 11:35:16 +01:00
|
|
|
REQ_CONTRAST = 29
|
2021-12-06 15:44:34 +01:00
|
|
|
LIMITS = 40
|
2021-12-13 07:55:34 +01:00
|
|
|
MOUNTING = 41
|
|
|
|
CAMERA = 42
|
|
|
|
BLOB = 43
|
|
|
|
CENTROIDING = 44
|
|
|
|
LISA = 45
|
|
|
|
MATCHING = 46
|
|
|
|
TRACKING = 47
|
|
|
|
VALIDATION = 48
|
|
|
|
ALGO = 49
|
2021-12-19 14:49:22 +01:00
|
|
|
CHECKSUM = 50
|
2022-02-27 16:17:24 +01:00
|
|
|
FLASH_READ = 51
|
|
|
|
FLASH_WRITE = 52
|
2021-12-29 20:33:49 +01:00
|
|
|
DOWNLOAD_MATCHED_STAR = 53
|
2022-01-01 11:17:01 +01:00
|
|
|
STOP_STR_HELPER = 55
|
2021-12-13 07:55:34 +01:00
|
|
|
RESET_ERROR = 56
|
|
|
|
CHANGE_DOWNLOAD_IMAGE = 57
|
2021-12-19 14:49:22 +01:00
|
|
|
SET_JSON_FILE_NAME = 58
|
2022-02-27 16:17:24 +01:00
|
|
|
SET_FLASH_READ_FILENAME = 59
|
2021-12-29 20:33:49 +01:00
|
|
|
SET_TIME = 60
|
|
|
|
DOWNLOAD_DBIMAGE = 61
|
|
|
|
DOWNLOAD_BLOBPIXEL = 62
|
|
|
|
DOWNLOAD_FPGA_IMAGE = 63
|
2021-12-30 12:55:24 +01:00
|
|
|
CHANGE_FPGA_DOWNLOAD_FILE = 64
|
|
|
|
UPLOAD_FPGA_IMAGE = 65
|
|
|
|
FPGA_ACTION = 66
|
2022-01-17 15:28:19 +01:00
|
|
|
REQ_CAMERA_PARAMS = 67
|
|
|
|
REQ_LIMITS = 68
|
2022-02-11 08:46:48 +01:00
|
|
|
REQ_LOG_LEVEL = 69
|
|
|
|
REQ_MOUNTING = 70
|
|
|
|
REQ_IMAGE_PROCESSOR = 71
|
|
|
|
REQ_CENTROIDING = 72
|
|
|
|
REQ_LISA = 73
|
|
|
|
REQ_MATCHING = 74
|
|
|
|
REQ_TRACKING = 75
|
|
|
|
REQ_VALIDATION = 76
|
|
|
|
REQ_ALGO = 77
|
|
|
|
REQ_SUBSCRIPTION = 78
|
|
|
|
REQ_LOG_SUBSCRIPTION = 79
|
|
|
|
REQ_DEBUG_CAMERA = 80
|
|
|
|
LOGLEVEL = 81
|
|
|
|
LOG_SUBSCRIPTION = 82
|
|
|
|
DEBUG_CAMERA = 83
|
2022-02-14 16:52:32 +01:00
|
|
|
FIRMWARE_UPDATE = 84
|
2021-12-06 15:44:34 +01:00
|
|
|
|
|
|
|
|
2022-02-14 16:52:32 +01:00
|
|
|
class FileDefs:
|
2022-02-27 16:17:24 +01:00
|
|
|
download_path = "/mnt/sd0/startracker"
|
|
|
|
json_file = "/mnt/sd0/startracker/full.json"
|
|
|
|
egse_ground_config = "/home/pi/arcsec/json/ground-config.json"
|
|
|
|
egse_flight_config = "/home/pi/arcsec/json/flight-config.json"
|
|
|
|
egse_solution_upload_img_config = "/home/pi/arcsec/json/upload-image-solution.json"
|
|
|
|
egse_histogram_upload_img_config = (
|
|
|
|
"/home/pi/arcsec/json/upload-image-histogram.json"
|
|
|
|
)
|
|
|
|
q7s_ground_config = "/mnt/sd0/startracker/json/ground-config.json"
|
|
|
|
q7s_flight_config = "/mnt/sd0/startracker/flight-config.json"
|
2022-03-01 16:58:06 +01:00
|
|
|
firmware2_1 = "/home/pi/arcsec/firmware/sagitta-2-1.bin"
|
|
|
|
firmware22_1 = "/home/pi/arcsec/firmware/sagitta-22-1.bin"
|
|
|
|
firmware_origin = "/home/pi/arcsec/firmware/sagitta-origin.bin"
|
2022-02-11 08:46:48 +01:00
|
|
|
|
|
|
|
|
2022-02-14 16:52:32 +01:00
|
|
|
json_dict = {
|
2022-02-27 16:17:24 +01:00
|
|
|
"1": ["Q7S flight config", FileDefs.q7s_flight_config],
|
|
|
|
"2": ["Q7S ground config", FileDefs.q7s_ground_config],
|
|
|
|
"3": ["EGSE flight config", FileDefs.egse_flight_config],
|
|
|
|
"4": ["EGSE ground config", FileDefs.egse_ground_config],
|
|
|
|
"5": [
|
|
|
|
"EGSE get solution, upload image config",
|
|
|
|
FileDefs.egse_solution_upload_img_config,
|
|
|
|
],
|
|
|
|
"6": [
|
|
|
|
"EGSE get histogram, upload image config",
|
|
|
|
FileDefs.egse_solution_upload_img_config,
|
|
|
|
],
|
2022-02-14 16:52:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
firmware_dict = {
|
|
|
|
"1": ["Firmware Major = 2, Minor = 1", FileDefs.firmware2_1],
|
|
|
|
"2": ["Firmware Major = 22, Minor = 1", FileDefs.firmware22_1],
|
2022-02-23 18:16:10 +01:00
|
|
|
"3": ["Firmware Origin", FileDefs.firmware_origin],
|
2022-02-11 08:46:48 +01:00
|
|
|
}
|
|
|
|
|
2022-02-27 16:17:24 +01:00
|
|
|
upload_image_dict = {
|
|
|
|
"1": ["q7s gemma", "/mnt/sd0/startracker/gemma.bin"],
|
|
|
|
"2": ["egse gemma", "/home/pi/arcsec/star-images/gemma.bin"],
|
|
|
|
"3": ["q7s polaris", "/mnt/sd0/startracker/polaris.bin"],
|
|
|
|
"4": ["egse polaris", "/home/pi/arcsec/star-images/polaris.bin"],
|
|
|
|
}
|
|
|
|
|
2021-12-24 07:32:35 +01:00
|
|
|
|
2022-02-27 16:17:24 +01:00
|
|
|
class StartRegion:
|
2021-12-24 07:32:35 +01:00
|
|
|
# Definition according to datasheet (which turned out to be partially faulty)
|
|
|
|
BOOTLOADER = 0
|
|
|
|
STAR_TRACKER_FIRMWARE = 1
|
|
|
|
|
|
|
|
|
|
|
|
class PartitionSize:
|
2022-02-27 16:17:24 +01:00
|
|
|
# Size of most recent firmware image
|
|
|
|
STAR_TRACKER_FIRMWARE = 464572
|
2021-08-16 10:03:40 +02:00
|
|
|
|
|
|
|
|
2022-02-23 18:16:10 +01:00
|
|
|
class Submode:
|
|
|
|
BOOTLOADER = 1
|
|
|
|
FIRMWARE = 2
|
|
|
|
|
|
|
|
|
2022-04-09 18:44:04 +02:00
|
|
|
def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
|
2021-08-16 10:03:40 +02:00
|
|
|
tc_queue.appendleft(
|
2022-01-18 14:03:56 +01:00
|
|
|
(
|
|
|
|
QueueCommands.PRINT,
|
|
|
|
"Generate command for star tracker with object id: 0x" + object_id.hex(),
|
|
|
|
)
|
2021-08-16 10:03:40 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
if op_code == "0":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Mode On, Submode Bootloader")
|
|
|
|
)
|
2022-02-23 18:16:10 +01:00
|
|
|
command = pack_mode_data(object_id, Modes.ON, Submode.BOOTLOADER)
|
|
|
|
command = PusTelecommand(service=200, subservice=1, ssc=9, app_data=command)
|
2021-12-14 19:25:23 +01:00
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
|
|
if op_code == "1":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Mode On, Submode Firmware")
|
|
|
|
)
|
2022-02-23 18:16:10 +01:00
|
|
|
command = pack_mode_data(object_id, Modes.ON, Submode.FIRMWARE)
|
|
|
|
command = PusTelecommand(service=200, subservice=1, ssc=10, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
|
|
if op_code == "2":
|
2021-12-14 19:25:23 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mode Normal"))
|
2022-02-23 18:16:10 +01:00
|
|
|
command = pack_mode_data(object_id, Modes.NORMAL, 0)
|
2021-12-14 19:25:23 +01:00
|
|
|
command = PusTelecommand(service=200, subservice=1, ssc=11, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "3":
|
2021-12-14 19:25:23 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mode Off"))
|
2022-02-23 18:16:10 +01:00
|
|
|
command = pack_mode_data(object_id, Modes.OFF, 0)
|
2021-12-14 19:25:23 +01:00
|
|
|
command = PusTelecommand(service=200, subservice=1, ssc=12, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "4":
|
2021-12-14 19:25:23 +01:00
|
|
|
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())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "5":
|
2021-08-16 10:03:40 +02:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Ping"))
|
2022-01-18 14:03:56 +01:00
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.PING)
|
2021-08-16 10:03:40 +02:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "6":
|
2022-01-18 14:03:56 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Switch to bootloader program")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack(
|
|
|
|
"!I", StarTrackerActionIds.SWITCH_TO_BOOTLOADER_PROGRAM
|
|
|
|
)
|
2021-12-02 08:01:18 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "7":
|
2021-12-02 08:01:18 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Temperature request"))
|
2022-01-18 14:03:56 +01:00
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_TEMPERATURE)
|
2021-12-02 08:01:18 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "8":
|
2021-12-02 08:01:18 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request version"))
|
2022-01-18 14:03:56 +01:00
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_VERSION)
|
2021-12-02 08:01:18 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "9":
|
2021-12-02 08:01:18 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request interface"))
|
2022-01-18 14:03:56 +01:00
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_INTERFACE)
|
2021-12-02 08:01:18 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "10":
|
2021-12-02 08:01:18 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request power"))
|
2022-01-18 14:03:56 +01:00
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_POWER)
|
2021-12-02 08:01:18 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "11":
|
2022-01-18 14:03:56 +01:00
|
|
|
tc_queue.appendleft(
|
2022-02-11 08:46:48 +01:00
|
|
|
(QueueCommands.PRINT, "Star tracker: Set subscription parameters")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2022-02-27 16:17:24 +01:00
|
|
|
json_file = get_config_file()
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.SUBSCRIPTION)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-02 08:01:18 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "12":
|
2021-12-02 08:01:18 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Boot"))
|
2022-01-18 14:03:56 +01:00
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.BOOT)
|
2021-12-02 08:01:18 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=37, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "13":
|
2021-12-02 08:01:18 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request time"))
|
2022-01-18 14:03:56 +01:00
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_TIME)
|
2021-12-02 08:01:18 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=38, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "14":
|
2021-12-02 08:01:18 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request solution"))
|
2022-01-18 14:03:56 +01:00
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_SOLUTION)
|
2021-12-02 08:01:18 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=39, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "15":
|
2021-12-06 15:44:34 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload image"))
|
2022-02-27 16:17:24 +01:00
|
|
|
image = get_upload_image()
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_IMAGE)
|
|
|
|
+ bytearray(image, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-06 15:44:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "16":
|
2021-12-06 15:44:34 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download image"))
|
2022-02-05 15:44:50 +01:00
|
|
|
path = input("Specify storage location (default - /mnt/sd0/startracker): ")
|
|
|
|
if not path:
|
2022-02-27 16:17:24 +01:00
|
|
|
path = FileDefs.download_path
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_IMAGE)
|
|
|
|
+ bytearray(path, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-13 07:55:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=53, app_data=command)
|
2021-12-06 15:44:34 +01:00
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "17":
|
2021-12-06 15:44:34 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set limits"))
|
2022-02-27 16:17:24 +01:00
|
|
|
json_file = get_config_file()
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.LIMITS)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-13 07:55:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=42, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "18":
|
2022-01-18 14:03:56 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Set tracking parameters")
|
|
|
|
)
|
2022-02-27 16:17:24 +01:00
|
|
|
json_file = get_config_file()
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.TRACKING)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-13 07:55:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "19":
|
2021-12-13 07:55:34 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mounting"))
|
2022-02-27 16:17:24 +01:00
|
|
|
json_file = get_config_file()
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.MOUNTING)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-13 07:55:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "20":
|
2021-12-13 07:55:34 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Camera"))
|
2022-02-27 16:17:24 +01:00
|
|
|
json_file = get_config_file()
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.CAMERA)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-13 07:55:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "22":
|
2021-12-13 07:55:34 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Centroiding"))
|
2022-02-27 16:17:24 +01:00
|
|
|
json_file = get_config_file()
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.CENTROIDING)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-13 07:55:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=47, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "23":
|
2021-12-13 07:55:34 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: LISA"))
|
2022-02-27 16:17:24 +01:00
|
|
|
json_file = get_config_file()
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.LISA)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-13 07:55:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=48, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "24":
|
2021-12-13 07:55:34 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Matching"))
|
2022-02-27 16:17:24 +01:00
|
|
|
json_file = get_config_file()
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.MATCHING)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-13 07:55:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=49, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "25":
|
2021-12-13 07:55:34 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Validation"))
|
2022-02-27 16:17:24 +01:00
|
|
|
json_file = get_config_file()
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.VALIDATION)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-13 07:55:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=50, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "26":
|
2021-12-13 07:55:34 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Algo"))
|
2022-02-27 16:17:24 +01:00
|
|
|
json_file = get_config_file()
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.ALGO)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-13 07:55:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=51, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "27":
|
2021-12-13 07:55:34 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Take image"))
|
2022-02-27 16:17:24 +01:00
|
|
|
actionid = int(input("Specify parameter ID (take image - 4): "))
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.TAKE_IMAGE)
|
|
|
|
+ struct.pack("!B", actionid)
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-13 07:55:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=52, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "28":
|
2022-01-01 11:17:01 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Stop str helper"))
|
2022-01-18 14:03:56 +01:00
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.STOP_STR_HELPER)
|
2021-12-13 07:55:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "30":
|
2022-01-18 14:03:56 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Set name of download image")
|
|
|
|
)
|
2021-12-13 07:55:34 +01:00
|
|
|
filename = input("Specify download image name: ")
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.CHANGE_DOWNLOAD_IMAGE)
|
|
|
|
+ bytearray(filename, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-13 07:55:34 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command)
|
2021-12-06 15:44:34 +01:00
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "31":
|
2021-12-17 15:09:25 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request histogram"))
|
2022-01-18 14:03:56 +01:00
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_HISTOGRAM)
|
2021-12-17 15:09:25 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=55, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "32":
|
2021-12-19 11:35:16 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request contrast"))
|
2022-01-18 14:03:56 +01:00
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_CONTRAST)
|
2021-12-19 11:35:16 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=56, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "33":
|
2021-12-19 14:49:22 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set json filename"))
|
2022-02-27 16:17:24 +01:00
|
|
|
json_file = get_config_file()
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.SET_JSON_FILE_NAME)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-19 14:49:22 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=57, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "35":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Flash read"))
|
2021-12-24 07:32:35 +01:00
|
|
|
command = pack_read_command(object_id)
|
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=59, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "36":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Set flash read filename")
|
|
|
|
)
|
2021-12-24 07:32:35 +01:00
|
|
|
filename = input("Specify filename: ")
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.SET_FLASH_READ_FILENAME)
|
|
|
|
+ bytearray(filename, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-24 07:32:35 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=60, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "37":
|
2021-12-24 07:32:35 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Get checksum"))
|
|
|
|
command = pack_checksum_command(object_id)
|
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=61, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "38":
|
2021-12-29 20:33:49 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set time"))
|
|
|
|
unix_time = 1640783543
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.SET_TIME)
|
|
|
|
+ struct.pack("!Q", unix_time)
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-29 20:33:49 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=61, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "39":
|
2021-12-29 20:33:49 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Centroid"))
|
|
|
|
id = 0
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_CENTROID)
|
|
|
|
+ struct.pack("!B", id)
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-29 20:33:49 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=62, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "41":
|
2022-01-18 14:03:56 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Download matched star")
|
|
|
|
)
|
2021-12-29 20:33:49 +01:00
|
|
|
id = 0
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_MATCHED_STAR)
|
|
|
|
+ struct.pack("!B", id)
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-29 20:33:49 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=64, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "42":
|
2021-12-29 20:33:49 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download DB Image"))
|
|
|
|
id = 0
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_DBIMAGE)
|
|
|
|
+ struct.pack("!B", id)
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-29 20:33:49 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "43":
|
2021-12-29 20:33:49 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Blob Pixel"))
|
|
|
|
id = 0
|
2022-01-18 14:03:56 +01:00
|
|
|
type = 1 # 0 - normal, 1 - fast
|
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_BLOBPIXEL)
|
|
|
|
+ struct.pack("!B", id)
|
|
|
|
+ struct.pack("!B", type)
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-29 20:33:49 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "44":
|
2021-12-29 20:33:49 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download FPGA Image"))
|
2022-01-17 08:40:16 +01:00
|
|
|
position = int(input("Start position: "))
|
|
|
|
length = int(input("Size to download: "))
|
2022-01-27 16:38:20 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_FPGA_IMAGE)
|
|
|
|
+ struct.pack("!I", position)
|
|
|
|
+ struct.pack("!I", length)
|
|
|
|
+ bytearray(FileDefs.downloadFpgaImagePath, "utf-8")
|
2022-01-27 16:38:20 +01:00
|
|
|
)
|
2021-12-29 20:33:49 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=66, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "45":
|
2022-01-27 16:38:20 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Change donwload FPGA image file name")
|
|
|
|
)
|
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.CHANGE_FPGA_DOWNLOAD_FILE)
|
|
|
|
+ bytearray(FileDefs.downloadFpgaImageName, "utf-8")
|
2022-01-27 16:38:20 +01:00
|
|
|
)
|
2021-12-30 12:55:24 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=67, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "46":
|
2021-12-30 12:55:24 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload FPGA image"))
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_FPGA_IMAGE)
|
|
|
|
+ bytearray(FileDefs.uploadFpgaImageName, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-30 12:55:24 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=68, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "47":
|
2021-12-30 12:55:24 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: FPGA action"))
|
|
|
|
id = 3
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.FPGA_ACTION)
|
|
|
|
+ struct.pack("!B", id)
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-30 12:55:24 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=69, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "48":
|
2022-01-17 08:40:16 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Unlock"))
|
2022-01-27 16:38:20 +01:00
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.UNLOCK)
|
2022-01-17 08:40:16 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=70, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "49":
|
2022-01-27 16:38:20 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Request camera parameters")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_CAMERA_PARAMS)
|
2022-01-17 15:28:19 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=71, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "50":
|
2022-01-17 15:28:19 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request limits"))
|
2022-01-27 16:38:20 +01:00
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_LIMITS)
|
2022-01-17 15:28:19 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=72, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "51":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Set image processor parameters")
|
|
|
|
)
|
|
|
|
json_file = get_config_file()
|
|
|
|
command = (
|
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.IMAGE_PROCESSOR)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
|
|
|
)
|
2022-01-29 18:37:28 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=70, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "52":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(
|
|
|
|
QueueCommands.PRINT,
|
|
|
|
"Star tracker: EGSE load ground config camera parameters",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
command = (
|
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.CAMERA)
|
|
|
|
+ bytearray(FileDefs.egse_ground_config, "utf-8")
|
|
|
|
)
|
2022-02-05 15:44:50 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=71, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "53":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(
|
|
|
|
QueueCommands.PRINT,
|
|
|
|
"Star tracker: EGSE load flight config camera parameters",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
command = (
|
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.CAMERA)
|
|
|
|
+ bytearray(FileDefs.egse_flight_config, "utf-8")
|
|
|
|
)
|
2022-02-05 15:44:50 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=72, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "54":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Request log level parameters")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_LOG_LEVEL)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=74, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "55":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Request mounting parameters")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_MOUNTING)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=75, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "56":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Request image processor parameters")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack(
|
|
|
|
"!I", StarTrackerActionIds.REQ_IMAGE_PROCESSOR
|
|
|
|
)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=76, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "57":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Request centroiding parameters")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_CENTROIDING)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=75, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "58":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Request lisa parameters")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_LISA)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=76, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "59":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Request matching parameters")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_MATCHING)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=77, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "60":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Request tracking parameters")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_TRACKING)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=78, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "61":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Request validation parameters")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_VALIDATION)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=79, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "62":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Request algo parameters")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_ALGO)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=80, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "63":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Request subscription parameters")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_SUBSCRIPTION)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=81, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "64":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Request log subscription parameters")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack(
|
|
|
|
"!I", StarTrackerActionIds.REQ_LOG_SUBSCRIPTION
|
|
|
|
)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=82, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "65":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Request debug camera parameters")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_DEBUG_CAMERA)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=83, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "66":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Set log level parameters")
|
|
|
|
)
|
|
|
|
json_file = get_config_file()
|
|
|
|
command = (
|
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.LOGLEVEL)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
|
|
|
)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=84, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "67":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Set log subscription parameters")
|
|
|
|
)
|
|
|
|
json_file = get_config_file()
|
|
|
|
command = (
|
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.LOG_SUBSCRIPTION)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
|
|
|
)
|
2022-02-11 08:46:48 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=85, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "68":
|
2022-02-27 16:17:24 +01:00
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Set debug camera parameters")
|
|
|
|
)
|
|
|
|
json_file = get_config_file()
|
|
|
|
command = (
|
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.DEBUG_CAMERA)
|
|
|
|
+ bytearray(json_file, "utf-8")
|
|
|
|
)
|
2022-02-14 16:52:32 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=86, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-23 18:16:10 +01:00
|
|
|
if op_code == "69":
|
2022-02-14 16:52:32 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Firmware update"))
|
|
|
|
firmware = get_firmware()
|
2022-02-27 16:17:24 +01:00
|
|
|
command = (
|
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.FIRMWARE_UPDATE)
|
|
|
|
+ bytearray(firmware, "utf-8")
|
|
|
|
)
|
2022-02-14 16:52:32 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=87, app_data=command)
|
2022-02-11 08:46:48 +01:00
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2022-02-27 16:17:24 +01:00
|
|
|
if op_code == "70":
|
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Disable timestamp generation")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack(
|
|
|
|
"!I", StarTrackerActionIds.DISBALE_TIMESTAMP_GENERATION
|
|
|
|
)
|
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=88, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
|
|
if op_code == "71":
|
|
|
|
tc_queue.appendleft(
|
|
|
|
(QueueCommands.PRINT, "Star tracker: Enable timestamp generation")
|
|
|
|
)
|
|
|
|
command = object_id + struct.pack(
|
|
|
|
"!I", StarTrackerActionIds.ENABLE_TIMESTAMP_GENERATION
|
|
|
|
)
|
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=89, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2021-12-24 07:32:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
def pack_read_command(object_id: bytearray) -> bytearray:
|
2022-02-27 16:17:24 +01:00
|
|
|
start_region = StartRegion.STAR_TRACKER_FIRMWARE
|
2021-12-24 07:32:35 +01:00
|
|
|
size = PartitionSize.STAR_TRACKER_FIRMWARE
|
2022-02-27 16:17:24 +01:00
|
|
|
path = input("Specify storage location (default - /mnt/sd0/startracker): ")
|
|
|
|
if not path:
|
|
|
|
path = FileDefs.download_path
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.FLASH_READ)
|
|
|
|
+ struct.pack("!B", start_region)
|
|
|
|
+ struct.pack("!I", size)
|
|
|
|
+ bytearray(path, "utf-8")
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-24 07:32:35 +01:00
|
|
|
return command
|
|
|
|
|
|
|
|
|
|
|
|
def pack_checksum_command(object_id: bytearray) -> bytearray:
|
2022-02-27 16:17:24 +01:00
|
|
|
start_region = StartRegion.STAR_TRACKER_FIRMWARE
|
2021-12-24 07:32:35 +01:00
|
|
|
address = 0
|
|
|
|
size = PartitionSize.STAR_TRACKER_FIRMWARE
|
2022-01-18 14:03:56 +01:00
|
|
|
command = (
|
2022-02-27 16:17:24 +01:00
|
|
|
object_id
|
|
|
|
+ struct.pack("!I", StarTrackerActionIds.CHECKSUM)
|
|
|
|
+ struct.pack("!B", start_region)
|
|
|
|
+ struct.pack("!I", address)
|
|
|
|
+ struct.pack("!I", size)
|
2022-01-18 14:03:56 +01:00
|
|
|
)
|
2021-12-24 07:32:35 +01:00
|
|
|
return command
|
2022-02-11 08:46:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
def get_config_file() -> str:
|
2022-02-14 16:52:32 +01:00
|
|
|
LOGGER.info("Specify json file")
|
|
|
|
input_helper = InputHelper(json_dict)
|
|
|
|
key = input_helper.get_key()
|
2022-02-27 16:17:24 +01:00
|
|
|
json_file = json_dict[key][1]
|
|
|
|
return json_file
|
2022-02-11 08:46:48 +01:00
|
|
|
|
|
|
|
|
2022-02-14 16:52:32 +01:00
|
|
|
def get_firmware() -> str:
|
|
|
|
LOGGER.info("Specify firmware file")
|
|
|
|
input_helper = InputHelper(firmware_dict)
|
|
|
|
key = input_helper.get_key()
|
|
|
|
firmware = firmware_dict[key][1]
|
|
|
|
return firmware
|
2022-02-27 16:17:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
def get_upload_image() -> str:
|
|
|
|
LOGGER.info("Specify image to upload")
|
|
|
|
input_helper = InputHelper(upload_image_dict)
|
|
|
|
key = input_helper.get_key()
|
|
|
|
image = upload_image_dict[key][1]
|
|
|
|
return image
|