added missing str parameters
This commit is contained in:
parent
b0f51072b2
commit
a5cc03d8a0
@ -12,14 +12,13 @@ import struct
|
|||||||
|
|
||||||
from eive_tmtc.config.definitions import CustomServiceList
|
from eive_tmtc.config.definitions import CustomServiceList
|
||||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||||
|
from eive_tmtc.utility.input_helper import InputHelper
|
||||||
from spacepackets.ecss.tc import PusTelecommand
|
from spacepackets.ecss.tc import PusTelecommand
|
||||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
|
||||||
|
|
||||||
from tmtccmd.tc import DefaultPusQueueHelper
|
from tmtccmd.tc import DefaultPusQueueHelper
|
||||||
|
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||||
from tmtccmd.util import ObjectIdU32
|
from tmtccmd.util import ObjectIdU32
|
||||||
from eive_tmtc.utility.input_helper import InputHelper
|
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -175,7 +174,7 @@ class Submode:
|
|||||||
|
|
||||||
|
|
||||||
def pack_star_tracker_commands(
|
def pack_star_tracker_commands(
|
||||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||||
):
|
):
|
||||||
q.add_log_cmd(
|
q.add_log_cmd(
|
||||||
f"Generate command for star tracker with object id: {object_id.as_hex_string}"
|
f"Generate command for star tracker with object id: {object_id.as_hex_string}"
|
||||||
@ -231,9 +230,9 @@ def pack_star_tracker_commands(
|
|||||||
q.add_log_cmd("Star tracker: Set subscription parameters")
|
q.add_log_cmd("Star tracker: Set subscription parameters")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.SUBSCRIPTION)
|
+ struct.pack("!I", StarTrackerActionId.SUBSCRIPTION)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "12":
|
if op_code == "12":
|
||||||
@ -252,9 +251,9 @@ def pack_star_tracker_commands(
|
|||||||
q.add_log_cmd("Star tracker: Upload image")
|
q.add_log_cmd("Star tracker: Upload image")
|
||||||
image = get_upload_image()
|
image = get_upload_image()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.UPLOAD_IMAGE)
|
+ struct.pack("!I", StarTrackerActionId.UPLOAD_IMAGE)
|
||||||
+ bytearray(image, "utf-8")
|
+ bytearray(image, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "16":
|
if op_code == "16":
|
||||||
@ -263,99 +262,99 @@ def pack_star_tracker_commands(
|
|||||||
if not path:
|
if not path:
|
||||||
path = FileDefs.download_path
|
path = FileDefs.download_path
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_IMAGE)
|
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_IMAGE)
|
||||||
+ bytearray(path, "utf-8")
|
+ bytearray(path, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "17":
|
if op_code == "17":
|
||||||
q.add_log_cmd("Star tracker: Set limits")
|
q.add_log_cmd("Star tracker: Set limits")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.LIMITS)
|
+ struct.pack("!I", StarTrackerActionId.LIMITS)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "18":
|
if op_code == "18":
|
||||||
q.add_log_cmd("Star tracker: Set tracking parameters")
|
q.add_log_cmd("Star tracker: Set tracking parameters")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.TRACKING)
|
+ struct.pack("!I", StarTrackerActionId.TRACKING)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "19":
|
if op_code == "19":
|
||||||
q.add_log_cmd("Star tracker: Mounting")
|
q.add_log_cmd("Star tracker: Mounting")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.MOUNTING)
|
+ struct.pack("!I", StarTrackerActionId.MOUNTING)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "20":
|
if op_code == "20":
|
||||||
q.add_log_cmd("Star tracker: Camera")
|
q.add_log_cmd("Star tracker: Camera")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.CAMERA)
|
+ struct.pack("!I", StarTrackerActionId.CAMERA)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "22":
|
if op_code == "22":
|
||||||
q.add_log_cmd("Star tracker: Centroiding")
|
q.add_log_cmd("Star tracker: Centroiding")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.CENTROIDING)
|
+ struct.pack("!I", StarTrackerActionId.CENTROIDING)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "23":
|
if op_code == "23":
|
||||||
q.add_log_cmd("Star tracker: LISA")
|
q.add_log_cmd("Star tracker: LISA")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.LISA)
|
+ struct.pack("!I", StarTrackerActionId.LISA)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "24":
|
if op_code == "24":
|
||||||
q.add_log_cmd("Star tracker: Matching")
|
q.add_log_cmd("Star tracker: Matching")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.MATCHING)
|
+ struct.pack("!I", StarTrackerActionId.MATCHING)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "25":
|
if op_code == "25":
|
||||||
q.add_log_cmd("Star tracker: Validation")
|
q.add_log_cmd("Star tracker: Validation")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.VALIDATION)
|
+ struct.pack("!I", StarTrackerActionId.VALIDATION)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "26":
|
if op_code == "26":
|
||||||
q.add_log_cmd("Star tracker: Algo")
|
q.add_log_cmd("Star tracker: Algo")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.ALGO)
|
+ struct.pack("!I", StarTrackerActionId.ALGO)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "27":
|
if op_code == "27":
|
||||||
q.add_log_cmd("Star tracker: Take image")
|
q.add_log_cmd("Star tracker: Take image")
|
||||||
actionid = int(input("Specify parameter ID (take image - 4): "))
|
actionid = int(input("Specify parameter ID (take image - 4): "))
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.TAKE_IMAGE)
|
+ struct.pack("!I", StarTrackerActionId.TAKE_IMAGE)
|
||||||
+ struct.pack("!B", actionid)
|
+ struct.pack("!B", actionid)
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "28":
|
if op_code == "28":
|
||||||
@ -366,9 +365,9 @@ def pack_star_tracker_commands(
|
|||||||
q.add_log_cmd("Star tracker: Set name of download image")
|
q.add_log_cmd("Star tracker: Set name of download image")
|
||||||
filename = input("Specify download image name: ")
|
filename = input("Specify download image name: ")
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.CHANGE_DOWNLOAD_IMAGE)
|
+ struct.pack("!I", StarTrackerActionId.CHANGE_DOWNLOAD_IMAGE)
|
||||||
+ bytearray(filename, "utf-8")
|
+ bytearray(filename, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "31":
|
if op_code == "31":
|
||||||
@ -383,9 +382,9 @@ def pack_star_tracker_commands(
|
|||||||
q.add_log_cmd("Star tracker: Set json filename")
|
q.add_log_cmd("Star tracker: Set json filename")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.SET_JSON_FILE_NAME)
|
+ struct.pack("!I", StarTrackerActionId.SET_JSON_FILE_NAME)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "35":
|
if op_code == "35":
|
||||||
@ -396,9 +395,9 @@ def pack_star_tracker_commands(
|
|||||||
q.add_log_cmd("Star tracker: Set flash read filename")
|
q.add_log_cmd("Star tracker: Set flash read filename")
|
||||||
filename = input("Specify filename: ")
|
filename = input("Specify filename: ")
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.SET_FLASH_READ_FILENAME)
|
+ struct.pack("!I", StarTrackerActionId.SET_FLASH_READ_FILENAME)
|
||||||
+ bytearray(filename, "utf-8")
|
+ bytearray(filename, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "37":
|
if op_code == "37":
|
||||||
@ -409,36 +408,36 @@ def pack_star_tracker_commands(
|
|||||||
q.add_log_cmd("Star tracker: Set time")
|
q.add_log_cmd("Star tracker: Set time")
|
||||||
unix_time = 1640783543
|
unix_time = 1640783543
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.SET_TIME)
|
+ struct.pack("!I", StarTrackerActionId.SET_TIME)
|
||||||
+ struct.pack("!Q", unix_time)
|
+ struct.pack("!Q", unix_time)
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "39":
|
if op_code == "39":
|
||||||
q.add_log_cmd("Star tracker: Download Centroid")
|
q.add_log_cmd("Star tracker: Download Centroid")
|
||||||
id = 0
|
id = 0
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_CENTROID)
|
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_CENTROID)
|
||||||
+ struct.pack("!B", id)
|
+ struct.pack("!B", id)
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "41":
|
if op_code == "41":
|
||||||
q.add_log_cmd("Star tracker: Download matched star")
|
q.add_log_cmd("Star tracker: Download matched star")
|
||||||
id = 0
|
id = 0
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_MATCHED_STAR)
|
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_MATCHED_STAR)
|
||||||
+ struct.pack("!B", id)
|
+ struct.pack("!B", id)
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "42":
|
if op_code == "42":
|
||||||
q.add_log_cmd("Star tracker: Download DB Image")
|
q.add_log_cmd("Star tracker: Download DB Image")
|
||||||
id = 0
|
id = 0
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_DBIMAGE)
|
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_DBIMAGE)
|
||||||
+ struct.pack("!B", id)
|
+ struct.pack("!B", id)
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "43":
|
if op_code == "43":
|
||||||
@ -446,10 +445,10 @@ def pack_star_tracker_commands(
|
|||||||
id = 0
|
id = 0
|
||||||
type = 1 # 0 - normal, 1 - fast
|
type = 1 # 0 - normal, 1 - fast
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_BLOBPIXEL)
|
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_BLOBPIXEL)
|
||||||
+ struct.pack("!B", id)
|
+ struct.pack("!B", id)
|
||||||
+ struct.pack("!B", type)
|
+ struct.pack("!B", type)
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "44":
|
if op_code == "44":
|
||||||
@ -457,36 +456,36 @@ def pack_star_tracker_commands(
|
|||||||
position = int(input("Start position: "))
|
position = int(input("Start position: "))
|
||||||
length = int(input("Size to download: "))
|
length = int(input("Size to download: "))
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_FPGA_IMAGE)
|
+ struct.pack("!I", StarTrackerActionId.DOWNLOAD_FPGA_IMAGE)
|
||||||
+ struct.pack("!I", position)
|
+ struct.pack("!I", position)
|
||||||
+ struct.pack("!I", length)
|
+ struct.pack("!I", length)
|
||||||
+ bytearray(FileDefs.downloadFpgaImagePath, "utf-8")
|
+ bytearray(FileDefs.downloadFpgaImagePath, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "45":
|
if op_code == "45":
|
||||||
q.add_log_cmd("Star tracker: Change donwload FPGA image file name")
|
q.add_log_cmd("Star tracker: Change donwload FPGA image file name")
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.CHANGE_FPGA_DOWNLOAD_FILE)
|
+ struct.pack("!I", StarTrackerActionId.CHANGE_FPGA_DOWNLOAD_FILE)
|
||||||
+ bytearray(FileDefs.downloadFpgaImageName, "utf-8")
|
+ bytearray(FileDefs.downloadFpgaImageName, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "46":
|
if op_code == "46":
|
||||||
q.add_log_cmd("Star tracker: Upload FPGA image")
|
q.add_log_cmd("Star tracker: Upload FPGA image")
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.UPLOAD_FPGA_IMAGE)
|
+ struct.pack("!I", StarTrackerActionId.UPLOAD_FPGA_IMAGE)
|
||||||
+ bytearray(FileDefs.uploadFpgaImageName, "utf-8")
|
+ bytearray(FileDefs.uploadFpgaImageName, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "47":
|
if op_code == "47":
|
||||||
q.add_log_cmd("Star tracker: FPGA action")
|
q.add_log_cmd("Star tracker: FPGA action")
|
||||||
id = 3
|
id = 3
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.FPGA_ACTION)
|
+ struct.pack("!I", StarTrackerActionId.FPGA_ACTION)
|
||||||
+ struct.pack("!B", id)
|
+ struct.pack("!B", id)
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "48":
|
if op_code == "48":
|
||||||
@ -505,25 +504,25 @@ def pack_star_tracker_commands(
|
|||||||
q.add_log_cmd("Star tracker: Set image processor parameters")
|
q.add_log_cmd("Star tracker: Set image processor parameters")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.IMAGE_PROCESSOR)
|
+ struct.pack("!I", StarTrackerActionId.IMAGE_PROCESSOR)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "52":
|
if op_code == "52":
|
||||||
q.add_log_cmd("Star tracker: EGSE load ground config camera parameters")
|
q.add_log_cmd("Star tracker: EGSE load ground config camera parameters")
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.CAMERA)
|
+ struct.pack("!I", StarTrackerActionId.CAMERA)
|
||||||
+ bytearray(FileDefs.egse_ground_config, "utf-8")
|
+ bytearray(FileDefs.egse_ground_config, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "53":
|
if op_code == "53":
|
||||||
q.add_log_cmd("Star tracker: EGSE load flight config camera parameters")
|
q.add_log_cmd("Star tracker: EGSE load flight config camera parameters")
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.CAMERA)
|
+ struct.pack("!I", StarTrackerActionId.CAMERA)
|
||||||
+ bytearray(FileDefs.egse_flight_config, "utf-8")
|
+ bytearray(FileDefs.egse_flight_config, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "54":
|
if op_code == "54":
|
||||||
@ -578,9 +577,9 @@ def pack_star_tracker_commands(
|
|||||||
q.add_log_cmd("Star tracker: Set log level parameters")
|
q.add_log_cmd("Star tracker: Set log level parameters")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.LOGLEVEL)
|
+ struct.pack("!I", StarTrackerActionId.LOGLEVEL)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "67":
|
if op_code == "67":
|
||||||
@ -588,27 +587,27 @@ def pack_star_tracker_commands(
|
|||||||
|
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.LOG_SUBSCRIPTION)
|
+ struct.pack("!I", StarTrackerActionId.LOG_SUBSCRIPTION)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "68":
|
if op_code == "68":
|
||||||
q.add_log_cmd("Star tracker: Set debug camera parameters")
|
q.add_log_cmd("Star tracker: Set debug camera parameters")
|
||||||
json_file = get_config_file()
|
json_file = get_config_file()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.DEBUG_CAMERA)
|
+ struct.pack("!I", StarTrackerActionId.DEBUG_CAMERA)
|
||||||
+ bytearray(json_file, "utf-8")
|
+ bytearray(json_file, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "69":
|
if op_code == "69":
|
||||||
q.add_log_cmd("Star tracker: Firmware update")
|
q.add_log_cmd("Star tracker: Firmware update")
|
||||||
firmware = get_firmware()
|
firmware = get_firmware()
|
||||||
data = (
|
data = (
|
||||||
obyt
|
obyt
|
||||||
+ struct.pack("!I", StarTrackerActionId.FIRMWARE_UPDATE)
|
+ struct.pack("!I", StarTrackerActionId.FIRMWARE_UPDATE)
|
||||||
+ bytearray(firmware, "utf-8")
|
+ bytearray(firmware, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "70":
|
if op_code == "70":
|
||||||
@ -632,11 +631,11 @@ def pack_read_command(object_id: bytes) -> bytearray:
|
|||||||
if not path:
|
if not path:
|
||||||
path = FileDefs.download_path
|
path = FileDefs.download_path
|
||||||
data = (
|
data = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", StarTrackerActionId.FLASH_READ)
|
+ struct.pack("!I", StarTrackerActionId.FLASH_READ)
|
||||||
+ struct.pack("!B", start_region)
|
+ struct.pack("!B", start_region)
|
||||||
+ struct.pack("!I", size)
|
+ struct.pack("!I", size)
|
||||||
+ bytearray(path, "utf-8")
|
+ bytearray(path, "utf-8")
|
||||||
)
|
)
|
||||||
return bytearray(data)
|
return bytearray(data)
|
||||||
|
|
||||||
@ -646,11 +645,11 @@ def pack_checksum_command(object_id: bytes) -> bytearray:
|
|||||||
address = 0
|
address = 0
|
||||||
size = PartitionSize.STAR_TRACKER_FIRMWARE
|
size = PartitionSize.STAR_TRACKER_FIRMWARE
|
||||||
data = (
|
data = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", StarTrackerActionId.CHECKSUM)
|
+ struct.pack("!I", StarTrackerActionId.CHECKSUM)
|
||||||
+ struct.pack("!B", start_region)
|
+ struct.pack("!B", start_region)
|
||||||
+ struct.pack("!I", address)
|
+ struct.pack("!I", address)
|
||||||
+ struct.pack("!I", size)
|
+ struct.pack("!I", size)
|
||||||
)
|
)
|
||||||
return bytearray(data)
|
return bytearray(data)
|
||||||
|
|
||||||
@ -694,7 +693,7 @@ def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
|||||||
current_idx = 0
|
current_idx = 0
|
||||||
fmt_len = struct.calcsize(ticks_time_fmt)
|
fmt_len = struct.calcsize(ticks_time_fmt)
|
||||||
(ticks, unix_time) = struct.unpack(
|
(ticks, unix_time) = struct.unpack(
|
||||||
ticks_time_fmt, hk_data[current_idx : current_idx + fmt_len]
|
ticks_time_fmt, hk_data[current_idx: current_idx + fmt_len]
|
||||||
)
|
)
|
||||||
unix_as_dt = datetime.datetime.fromtimestamp(unix_time, tz=datetime.timezone.utc)
|
unix_as_dt = datetime.datetime.fromtimestamp(unix_time, tz=datetime.timezone.utc)
|
||||||
pw.dlog(f"Ticks: {ticks} | UNIX time: {unix_time}")
|
pw.dlog(f"Ticks: {ticks} | UNIX time: {unix_time}")
|
||||||
@ -703,7 +702,7 @@ def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
|||||||
calib_quaternions_fmt = "!ffff"
|
calib_quaternions_fmt = "!ffff"
|
||||||
fmt_len = struct.calcsize(calib_quaternions_fmt)
|
fmt_len = struct.calcsize(calib_quaternions_fmt)
|
||||||
(calib_q_w, calib_q_x, calib_q_y, calib_q_z) = struct.unpack(
|
(calib_q_w, calib_q_x, calib_q_y, calib_q_z) = struct.unpack(
|
||||||
calib_quaternions_fmt, hk_data[current_idx : current_idx + fmt_len]
|
calib_quaternions_fmt, hk_data[current_idx: current_idx + fmt_len]
|
||||||
)
|
)
|
||||||
pw.dlog("Calibrated Quaternions")
|
pw.dlog("Calibrated Quaternions")
|
||||||
pw.dlog(f"Quaternion w: {calib_q_w}")
|
pw.dlog(f"Quaternion w: {calib_q_w}")
|
||||||
@ -714,7 +713,7 @@ def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
|||||||
track_fmt = "!fffff"
|
track_fmt = "!fffff"
|
||||||
fmt_len = struct.calcsize(track_fmt)
|
fmt_len = struct.calcsize(track_fmt)
|
||||||
(track_confidence, track_q_w, track_q_x, track_q_y, track_q_z) = struct.unpack(
|
(track_confidence, track_q_w, track_q_x, track_q_y, track_q_z) = struct.unpack(
|
||||||
track_fmt, hk_data[current_idx : current_idx + fmt_len]
|
track_fmt, hk_data[current_idx: current_idx + fmt_len]
|
||||||
)
|
)
|
||||||
pw.dlog(f"Track Confidence: {track_confidence}")
|
pw.dlog(f"Track Confidence: {track_confidence}")
|
||||||
pw.dlog(f"Track QW: {track_q_w}")
|
pw.dlog(f"Track QW: {track_q_w}")
|
||||||
@ -734,18 +733,20 @@ def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
|||||||
# Result of LISA: Lost in space algorithm
|
# Result of LISA: Lost in space algorithm
|
||||||
lisa_fmt = "!fffffB"
|
lisa_fmt = "!fffffB"
|
||||||
fmt_len = struct.calcsize(track_fmt)
|
fmt_len = struct.calcsize(track_fmt)
|
||||||
(lisa_q_w, lisa_q_x, lisa_q_y, lisa_q_z) = struct.unpack(
|
(lisa_q_w, lisa_q_x, lisa_q_y, lisa_q_z, lisa_percentage_close_stars, lisa_number_close_stars) = struct.unpack(
|
||||||
lisa_fmt, hk_data[current_idx : current_idx + fmt_len]
|
lisa_fmt, hk_data[current_idx: current_idx + fmt_len]
|
||||||
)
|
)
|
||||||
pw.dlog(f"LISA QW: {lisa_q_w}")
|
pw.dlog(f"LISA QW: {lisa_q_w}")
|
||||||
pw.dlog(f"LISA QX: {lisa_q_x}")
|
pw.dlog(f"LISA QX: {lisa_q_x}")
|
||||||
pw.dlog(f"LISA QY: {lisa_q_y}")
|
pw.dlog(f"LISA QY: {lisa_q_y}")
|
||||||
pw.dlog(f"LISA QZ: {lisa_q_z}")
|
pw.dlog(f"LISA QZ: {lisa_q_z}")
|
||||||
|
pw.dlog(f"Percentage of close stars in LISA solution: {lisa_percentage_close_stars}")
|
||||||
|
pw.dlog(f"Number of close stars in LISA solution: {lisa_number_close_stars}")
|
||||||
current_idx += fmt_len
|
current_idx += fmt_len
|
||||||
is_trusworthy = hk_data[current_idx]
|
is_trusworthy = hk_data[current_idx]
|
||||||
pw.dlog(f"Trustworthy solution: {is_trusworthy}")
|
pw.dlog(f"Trustworthy solution: {is_trusworthy}")
|
||||||
current_idx += 1
|
current_idx += 1
|
||||||
stable_count = struct.unpack("!I", hk_data[current_idx : current_idx + 4])
|
stable_count = struct.unpack("!I", hk_data[current_idx: current_idx + 4])
|
||||||
pw.dlog(f"Stable count: {stable_count}")
|
pw.dlog(f"Stable count: {stable_count}")
|
||||||
current_idx += 4
|
current_idx += 4
|
||||||
solution_strategy = hk_data[current_idx]
|
solution_strategy = hk_data[current_idx]
|
||||||
|
Loading…
Reference in New Issue
Block a user