update and clean up star tracker commands

This commit is contained in:
Robin Müller 2023-03-31 18:43:02 +02:00
parent aab50dce5a
commit 5b613f98ee
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 45 additions and 33 deletions

View File

@ -97,12 +97,19 @@ class OpCodes:
NORMAL = "nml"
OFF = "off"
PING = "ping"
REQUEST_SOLUTION_SET = "request_sol_set"
REQUEST_SOLUTION_SET_HK = "hk_req_sol"
REQUEST_SOLUTION_SET_ACTION = "action_req_sol"
TAKE_IMAGE = "take_image"
UPLOAD_IMAGE = "upload_image"
SET_IMG_PROCESSOR_MODE = "set_img_proc_mode"
class Info:
REQUEST_SOLUTION_SET = "Request Solution Set HK once"
REQUEST_SOLUTION_SET_HK = "Request Solution Set HK once"
REQUEST_SOLUTION_SET_ACTION = "Request Solution Set Action"
UPLOAD_IMAGE = "Upload Image"
TAKE_IMAGE = "Take Image"
SET_IMG_PROCESSOR_MODE = "Set Image Processor Mode"
class SetId(enum.IntEnum):
@ -128,7 +135,7 @@ class FileDefs:
egse_histogram_upload_img_config = (
"/home/pi/arcsec/json/upload-image-histogram.json"
)
q7s_ground_config = "/mnt/sd0/startracker/json/ground-config.json"
q7s_ground_config = "/mnt/sd0/startracker/ground-config.json"
q7s_flight_config = "/mnt/sd0/startracker/flight-config.json"
firmware2_1 = "/home/pi/arcsec/firmware/sagitta-2-1.bin"
firmware22_1 = "/home/pi/arcsec/firmware/sagitta-22-1.bin"
@ -136,31 +143,31 @@ class FileDefs:
json_dict = {
"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": [
"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": [
),
"6": (
"EGSE get histogram, upload image config",
FileDefs.egse_solution_upload_img_config,
],
),
}
firmware_dict = {
"1": ["Firmware Major = 2, Minor = 1", FileDefs.firmware2_1],
"2": ["Firmware Major = 22, Minor = 1", FileDefs.firmware22_1],
"3": ["Firmware Origin", FileDefs.firmware_origin],
"1": ("Firmware Major = 2, Minor = 1", FileDefs.firmware2_1),
"2": ("Firmware Major = 22, Minor = 1", FileDefs.firmware22_1),
"3": ("Firmware Origin", FileDefs.firmware_origin),
}
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"],
"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"),
}
@ -204,9 +211,13 @@ def pack_star_tracker_commands(
q.add_log_cmd("Star tracker: Mode Off")
data = pack_mode_data(obyt, Mode.OFF, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if op_code == OpCodes.REQUEST_SOLUTION_SET:
q.add_log_cmd(Info.REQUEST_SOLUTION_SET)
if op_code == OpCodes.REQUEST_SOLUTION_SET_HK:
q.add_log_cmd(Info.REQUEST_SOLUTION_SET_HK)
q.add_pus_tc(create_request_one_diag_command(make_sid(obyt, SetId.SOLUTION)))
if op_code == OpCodes.REQUEST_SOLUTION_SET_ACTION:
q.add_log_cmd("Star tracker: Request solution")
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_SOLUTION)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "4":
q.add_log_cmd("Star tracker: Mode Raw")
data = pack_mode_data(obyt, Mode.RAW, 0)
@ -254,11 +265,7 @@ def pack_star_tracker_commands(
q.add_log_cmd("Star tracker: Request time")
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_TIME)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "14":
q.add_log_cmd("Star tracker: Request solution")
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_SOLUTION)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "15":
if op_code == OpCodes.UPLOAD_IMAGE:
q.add_log_cmd("Star tracker: Upload image")
image = get_upload_image()
data = (
@ -361,7 +368,9 @@ def pack_star_tracker_commands(
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == OpCodes.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 (4: take image, 7: get histogram): ")
)
data = (
obyt
+ struct.pack("!I", StarTrackerActionId.TAKE_IMAGE)
@ -511,8 +520,8 @@ def pack_star_tracker_commands(
q.add_log_cmd("Star tracker: Request limits")
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_LIMITS)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "51":
q.add_log_cmd("Star tracker: Set image processor parameters")
if op_code == OpCodes.SET_IMG_PROCESSOR_MODE:
q.add_log_cmd(Info.SET_IMG_PROCESSOR_MODE)
json_file = get_config_file()
data = (
obyt
@ -798,10 +807,13 @@ def add_str_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCodes.ON_FIRMWARE, "Mode On, Submode Firmware")
oce.add(OpCodes.NORMAL, "Mode Normal")
oce.add(OpCodes.OFF, "Mode Off")
oce.add("4", "Star Tracker: Mode Raw")
# oce.add("4", "Star Tracker: Mode Raw")
oce.add(OpCodes.PING, "Star Tracker: Ping")
oce.add(OpCodes.TAKE_IMAGE, "Take Image")
oce.add(OpCodes.REQUEST_SOLUTION_SET, "Request Solution Set HK")
oce.add(OpCodes.REQUEST_SOLUTION_SET_HK, Info.REQUEST_SOLUTION_SET_HK)
oce.add(OpCodes.REQUEST_SOLUTION_SET_ACTION, Info.REQUEST_SOLUTION_SET_ACTION)
oce.add(OpCodes.UPLOAD_IMAGE, Info.UPLOAD_IMAGE)
oce.add(OpCodes.SET_IMG_PROCESSOR_MODE, Info.SET_IMG_PROCESSOR_MODE)
oce.add("6", "Star Tracker: Switch to bootloader program")
oce.add("7", "Star Tracker: Request temperature")
oce.add("8", "Star Tracker: Request version")
@ -811,7 +823,6 @@ def add_str_cmds(defs: TmtcDefinitionWrapper):
oce.add("12", "Star Tracker: Boot image (requires bootloader mode)")
oce.add("13", "Star Tracker: Request time")
oce.add("14", "Star Tracker: Request solution")
oce.add("15", "Star Tracker: Upload image")
oce.add("16", "Star Tracker: Download image")
oce.add("17", "Star Tracker: Set limit parameters")
oce.add("17", "Star Tracker: Set limit parameters")
@ -833,7 +844,6 @@ def add_str_cmds(defs: TmtcDefinitionWrapper):
oce.add("37", "Star Tracker: Get checksum")
oce.add("49", "Star Tracker: Request camera parameter")
oce.add("50", "Star Tracker: Request limits")
oce.add("51", "Star Tracker: Set image processor parameters")
oce.add("52", "Star Tracker: (EGSE only) Load camera ground config")
oce.add("53", "Star Tracker: (EGSE only) Load camera flight config")
oce.add("54", "Star Tracker: Request log level parameters")

View File

@ -307,7 +307,9 @@ def handle_syrlinks_rx_registers_dataset(printer: FsfwTmTcPrinter, hk_data: byte
if rx_demod_n0 > 0:
eb_to_n0 = 20 * math.log10(rx_demod_eb / rx_demod_n0) - 3
else:
logging.getLogger(__name__).warning("RX Demod N0 is 0, can not calculate Eb to N0")
logging.getLogger(__name__).warning(
"RX Demod N0 is 0, can not calculate Eb to N0"
)
eb_to_n0 = 0
rx_data_rate_raw = hk_data[21]
rx_data_rate = -1