request param commands
This commit is contained in:
parent
cf7d25c206
commit
5d8b9aac1f
@ -537,10 +537,24 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
|||||||
"47": ("Star Tracker: Unlock", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
"47": ("Star Tracker: Unlock", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
"48": ("Star Tracker: Request camera parameter", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
"48": ("Star Tracker: Request camera parameter", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
"49": ("Star Tracker: Request limits", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
"49": ("Star Tracker: Request limits", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
"50": ("Star Tracker: Request blob parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
"50": ("Star Tracker: Set image processor parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
"51": ("Star Tracker: Set image processor parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
"51": ("Star Tracker: (EGSE only) Load camera ground config ", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
"52": ("Star Tracker: (EGSE only) Load camera ground config ", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
"52": ("Star Tracker: (EGSE only) Load camera flight config", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
"53": ("Star Tracker: (EGSE only) Load camera flight config", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
"53": ("Star Tracker: Request log level parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"54": ("Star Tracker: Request mounting parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"55": ("Star Tracker: Request image processor parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"56": ("Star Tracker: Request centroiding parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"57": ("Star Tracker: Request lisa parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"58": ("Star Tracker: Request matching parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"59": ("Star Tracker: Request tracking parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"60": ("Star Tracker: Request validation parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"61": ("Star Tracker: Request algo parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"62": ("Star Tracker: Request subscription parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"63": ("Star Tracker: Request log subscription parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"64": ("Star Tracker: Request debug camera parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"65": ("Star Tracker: Set log level parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"66": ("Star Tracker: Set log subscription parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"67": ("Star Tracker: Set debug camera parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
}
|
}
|
||||||
service_star_tracker_tuple = ("Star tracker", op_code_dict_srv_star_tracker)
|
service_star_tracker_tuple = ("Star tracker", op_code_dict_srv_star_tracker)
|
||||||
|
|
||||||
|
@ -12,6 +12,9 @@ from tmtccmd.config.definitions import QueueCommands
|
|||||||
from tmtccmd.tc.packer import TcQueueT
|
from tmtccmd.tc.packer import TcQueueT
|
||||||
from spacepackets.ecss.tc import PusTelecommand
|
from spacepackets.ecss.tc import PusTelecommand
|
||||||
from pus_tc.service_200_mode import pack_mode_data
|
from pus_tc.service_200_mode import pack_mode_data
|
||||||
|
from tmtccmd.utility.logger import get_console_logger
|
||||||
|
|
||||||
|
LOGGER = get_console_logger()
|
||||||
|
|
||||||
|
|
||||||
class StarTrackerActionIds:
|
class StarTrackerActionIds:
|
||||||
@ -28,7 +31,7 @@ class StarTrackerActionIds:
|
|||||||
UPLOAD_IMAGE = 10
|
UPLOAD_IMAGE = 10
|
||||||
DOWNLOAD_CENTROID = 16
|
DOWNLOAD_CENTROID = 16
|
||||||
UPLOAD_CENTROID = 17
|
UPLOAD_CENTROID = 17
|
||||||
SUBSCRIBE_TO_TM = 18
|
SUBSCRIPTION = 18
|
||||||
IMAGE_PROCESSOR = 19
|
IMAGE_PROCESSOR = 19
|
||||||
REQ_SOLUTION = 24
|
REQ_SOLUTION = 24
|
||||||
REQ_TEMPERATURE = 25
|
REQ_TEMPERATURE = 25
|
||||||
@ -62,7 +65,21 @@ class StarTrackerActionIds:
|
|||||||
FPGA_ACTION = 66
|
FPGA_ACTION = 66
|
||||||
REQ_CAMERA_PARAMS = 67
|
REQ_CAMERA_PARAMS = 67
|
||||||
REQ_LIMITS = 68
|
REQ_LIMITS = 68
|
||||||
REQ_BLOB_PARAMS = 69
|
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
|
||||||
|
|
||||||
|
|
||||||
class ImagePathDefs:
|
class ImagePathDefs:
|
||||||
@ -78,6 +95,17 @@ class ImagePathDefs:
|
|||||||
uploadFpgaImageName = "/mnt/sd0/startracker/fpga-image.bin"
|
uploadFpgaImageName = "/mnt/sd0/startracker/fpga-image.bin"
|
||||||
egseGroundConfig = "/home/pi/arcsec/ground-config.json"
|
egseGroundConfig = "/home/pi/arcsec/ground-config.json"
|
||||||
egseFlightConfig = "/home/pi/arcsec/flight-config.json"
|
egseFlightConfig = "/home/pi/arcsec/flight-config.json"
|
||||||
|
q7sGroundConfig = "/mnt/sd0/startracker/ground-config.json"
|
||||||
|
q7sFlightConfig = "/mnt/sd0/startracker/flight-config.json"
|
||||||
|
|
||||||
|
|
||||||
|
json_selection = {
|
||||||
|
"1": ["Q7S flight config", ImagePathDefs.q7sFlightConfig],
|
||||||
|
"2": ["Q7S ground config", ImagePathDefs.q7sGroundConfig],
|
||||||
|
"3": ["EGSE flight config", ImagePathDefs.egseFlightConfig],
|
||||||
|
"4": ["EGSE ground config", ImagePathDefs.egseGroundConfig]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class Region:
|
class Region:
|
||||||
# Definition according to datasheet (which turned out to be partially faulty)
|
# Definition according to datasheet (which turned out to be partially faulty)
|
||||||
@ -160,13 +188,13 @@ def pack_star_tracker_commands(
|
|||||||
tc_queue.appendleft(command.pack_command_tuple())
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
if op_code == "10":
|
if op_code == "10":
|
||||||
tc_queue.appendleft(
|
tc_queue.appendleft(
|
||||||
(QueueCommands.PRINT, "Star tracker: Subscribe to telemetry")
|
(QueueCommands.PRINT, "Star tracker: Set subscription parameters")
|
||||||
)
|
)
|
||||||
tm_id = int(input("Specify Id of tm: "))
|
jsonfile = get_config_file()
|
||||||
command = (
|
command = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", StarTrackerActionIds.SUBSCRIBE_TO_TM)
|
+ struct.pack("!I", StarTrackerActionIds.SUBSCRIPTION)
|
||||||
+ struct.pack("B", tm_id)
|
+ bytearray(jsonfile, "utf-8")
|
||||||
)
|
)
|
||||||
command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command)
|
command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command)
|
||||||
tc_queue.appendleft(command.pack_command_tuple())
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
@ -291,10 +319,11 @@ def pack_star_tracker_commands(
|
|||||||
tc_queue.appendleft(command.pack_command_tuple())
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
if op_code == "25":
|
if op_code == "25":
|
||||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Algo"))
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Algo"))
|
||||||
|
jsonfile = get_config_file()
|
||||||
command = (
|
command = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", StarTrackerActionIds.ALGO)
|
+ struct.pack("!I", StarTrackerActionIds.ALGO)
|
||||||
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
|
+ bytearray(jsonfile, "utf-8")
|
||||||
)
|
)
|
||||||
command = PusTelecommand(service=8, subservice=128, ssc=51, app_data=command)
|
command = PusTelecommand(service=8, subservice=128, ssc=51, app_data=command)
|
||||||
tc_queue.appendleft(command.pack_command_tuple())
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
@ -498,30 +527,101 @@ def pack_star_tracker_commands(
|
|||||||
command = PusTelecommand(service=8, subservice=128, ssc=72, app_data=command)
|
command = PusTelecommand(service=8, subservice=128, ssc=72, app_data=command)
|
||||||
tc_queue.appendleft(command.pack_command_tuple())
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
if op_code == "50":
|
if op_code == "50":
|
||||||
tc_queue.appendleft(
|
|
||||||
(QueueCommands.PRINT, "Star tracker: Request blob parameters")
|
|
||||||
)
|
|
||||||
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_BLOB_PARAMS)
|
|
||||||
command = PusTelecommand(service=8, subservice=128, ssc=73, app_data=command)
|
|
||||||
tc_queue.appendleft(command.pack_command_tuple())
|
|
||||||
if op_code == "51":
|
|
||||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set image processor parameters"))
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set image processor parameters"))
|
||||||
command = object_id + struct.pack('!I', StarTrackerActionIds.IMAGE_PROCESSOR) + \
|
command = object_id + struct.pack('!I', StarTrackerActionIds.IMAGE_PROCESSOR) + \
|
||||||
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
||||||
command = PusTelecommand(service=8, subservice=128, ssc=70, app_data=command)
|
command = PusTelecommand(service=8, subservice=128, ssc=70, app_data=command)
|
||||||
tc_queue.appendleft(command.pack_command_tuple())
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
if op_code == "52":
|
if op_code == "51":
|
||||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: EGSE load ground config camera parameters"))
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: EGSE load ground config camera parameters"))
|
||||||
command = object_id + struct.pack('!I', StarTrackerActionIds.CAMERA) + \
|
command = object_id + struct.pack('!I', StarTrackerActionIds.CAMERA) + \
|
||||||
bytearray(ImagePathDefs.egseGroundConfig, 'utf-8')
|
bytearray(ImagePathDefs.egseGroundConfig, 'utf-8')
|
||||||
command = PusTelecommand(service=8, subservice=128, ssc=71, app_data=command)
|
command = PusTelecommand(service=8, subservice=128, ssc=71, app_data=command)
|
||||||
tc_queue.appendleft(command.pack_command_tuple())
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
if op_code == "53":
|
if op_code == "52":
|
||||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: EGSE load flight config camera parameters"))
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: EGSE load flight config camera parameters"))
|
||||||
command = object_id + struct.pack('!I', StarTrackerActionIds.CAMERA) + \
|
command = object_id + struct.pack('!I', StarTrackerActionIds.CAMERA) + \
|
||||||
bytearray(ImagePathDefs.egseFlightConfig, 'utf-8')
|
bytearray(ImagePathDefs.egseFlightConfig, 'utf-8')
|
||||||
command = PusTelecommand(service=8, subservice=128, ssc=72, app_data=command)
|
command = PusTelecommand(service=8, subservice=128, ssc=72, app_data=command)
|
||||||
tc_queue.appendleft(command.pack_command_tuple())
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "53":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request log level parameters"))
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_LOG_LEVEL)
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=74, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "54":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request mounting parameters"))
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_MOUNTING)
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=75, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "55":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request image processor parameters"))
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_IMAGE_PROCESSOR)
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=76, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "56":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request centroiding parameters"))
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_CENTROIDING)
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=75, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "57":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request lisa parameters"))
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_LISA)
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=76, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "58":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request matching parameters"))
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_MATCHING)
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=77, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "59":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request tracking parameters"))
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_TRACKING)
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=78, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "60":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request validation parameters"))
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_VALIDATION)
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=79, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "61":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request algo parameters"))
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_ALGO)
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=80, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "62":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request subscription parameters"))
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_SUBSCRIPTION)
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=81, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "63":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request log subscription parameters"))
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_LOG_SUBSCRIPTION)
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=82, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "64":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request debug camera parameters"))
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_DEBUG_CAMERA)
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=83, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "65":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set log level parameters"))
|
||||||
|
jsonfile = get_config_file()
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.LOGLEVEL) + bytearray(jsonfile, "utf-8")
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=84, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "66":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set log subscription parameters"))
|
||||||
|
jsonfile = get_config_file()
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.LOG_SUBSCRIPTION) + bytearray(jsonfile, "utf-8")
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=85, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
if op_code == "67":
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set debug camera parameters"))
|
||||||
|
jsonfile = get_config_file()
|
||||||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.DEBUG_CAMERA) + bytearray(jsonfile, "utf-8")
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=85, app_data=command)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
|
||||||
|
|
||||||
def pack_write_command(object_id: bytearray) -> bytearray:
|
def pack_write_command(object_id: bytearray) -> bytearray:
|
||||||
@ -564,3 +664,30 @@ def pack_checksum_command(object_id: bytearray) -> bytearray:
|
|||||||
+ struct.pack("!I", size)
|
+ struct.pack("!I", size)
|
||||||
)
|
)
|
||||||
return command
|
return command
|
||||||
|
|
||||||
|
|
||||||
|
def get_config_file() -> str:
|
||||||
|
LOGGER.info("Specify json file to use")
|
||||||
|
key = get_json_file_key()
|
||||||
|
while key not in json_selection:
|
||||||
|
LOGGER.info("Invalid key specified, try again.")
|
||||||
|
key = get_json_file_key()
|
||||||
|
jsonfile = json_selection[key][1]
|
||||||
|
return jsonfile
|
||||||
|
|
||||||
|
|
||||||
|
def get_json_file_key():
|
||||||
|
key_column_width = 10
|
||||||
|
description_column_width = 50
|
||||||
|
separator_width = key_column_width + description_column_width + 3
|
||||||
|
separator_string = separator_width * "-"
|
||||||
|
key_string = "Key".ljust(key_column_width)
|
||||||
|
description_string = "Description".ljust(description_column_width)
|
||||||
|
LOGGER.info(f"{key_string} | {description_string}")
|
||||||
|
LOGGER.info(separator_string)
|
||||||
|
for key in json_selection:
|
||||||
|
key_string = key.ljust(key_column_width)
|
||||||
|
description_string = json_selection[key][0].ljust(description_column_width)
|
||||||
|
LOGGER.info(f"{key_string} | {description_string}")
|
||||||
|
key = input("Specify key: ")
|
||||||
|
return key
|
||||||
|
Loading…
x
Reference in New Issue
Block a user