new events, retvals, objects #165

Merged
muellerr merged 4 commits from refactor_tm_handling into main 2023-03-11 15:02:16 +01:00
2 changed files with 74 additions and 51 deletions
Showing only changes of commit e334521e6d - Show all commits

View File

@ -10,6 +10,10 @@ list yields a list of all related PRs for each release.
# [unreleased] # [unreleased]
## Added
- Added GPS Altitude for GPS Processed Data Dataset
## Changed ## Changed
- ACS mode changes: The ACS CTRL submodes are now modes. DETUBMLE is now submode of SAFE mode. - ACS mode changes: The ACS CTRL submodes are now modes. DETUBMLE is now submode of SAFE mode.

View File

@ -2,6 +2,7 @@ import enum
import logging import logging
import socket import socket
import struct import struct
import math
from socket import AF_INET from socket import AF_INET
from typing import Tuple from typing import Tuple
@ -75,36 +76,36 @@ class OpCodes:
SET_PARAMETER_SCALAR = ["set_scalar_param"] SET_PARAMETER_SCALAR = ["set_scalar_param"]
SET_PARAMETER_VECTOR = ["set_vector_param"] SET_PARAMETER_VECTOR = ["set_vector_param"]
SET_PARAMETER_MATRIX = ["set_matrix_param"] SET_PARAMETER_MATRIX = ["set_matrix_param"]
REQUEST_RAW_MGM_HK = ["0", "mgm_raw_hk"] REQUEST_RAW_MGM_HK = ["mgm_raw_hk"]
ENABLE_RAW_MGM_HK = ["1", "mgm_raw_enable_hk"] ENABLE_RAW_MGM_HK = ["mgm_raw_enable_hk"]
DISABLE_RAW_MGM_HK = ["2", "mgm_raw_disable_hk"] DISABLE_RAW_MGM_HK = ["mgm_raw_disable_hk"]
REQUEST_PROC_MGM_HK = ["3", "mgm_proc_hk"] REQUEST_PROC_MGM_HK = ["mgm_proc_hk"]
ENABLE_PROC_MGM_HK = ["4", "mgm_proc_enable_hk"] ENABLE_PROC_MGM_HK = ["mgm_proc_enable_hk"]
DISABLE_PROC_MGM_HK = ["5", "mgm_proc_disable_hk"] DISABLE_PROC_MGM_HK = ["mgm_proc_disable_hk"]
REQUEST_RAW_SUS_HK = ["6", "sus_raw_hk"] REQUEST_RAW_SUS_HK = ["sus_raw_hk"]
ENABLE_RAW_SUS_HK = ["7", "sus_raw_enable_hk"] ENABLE_RAW_SUS_HK = ["sus_raw_enable_hk"]
DISABLE_RAW_SUS_HK = ["8", "sus_raw_disable_hk"] DISABLE_RAW_SUS_HK = ["sus_raw_disable_hk"]
REQUEST_PROC_SUS_HK = ["9", "sus_proc_hk"] REQUEST_PROC_SUS_HK = ["sus_proc_hk"]
ENABLE_PROC_SUS_HK = ["10", "sus_proc_enable_hk"] ENABLE_PROC_SUS_HK = ["sus_proc_enable_hk"]
DISABLE_PROC_SUS_HK = ["11", "sus_proc_disable_hk"] DISABLE_PROC_SUS_HK = ["sus_proc_disable_hk"]
REQUEST_RAW_GYR_HK = ["12", "gyr_raw_hk"] REQUEST_RAW_GYR_HK = ["gyr_raw_hk"]
ENABLE_RAW_GYR_HK = ["13", "gyr_raw_enable_hk"] ENABLE_RAW_GYR_HK = ["gyr_raw_enable_hk"]
DISABLE_RAW_GYR_HK = ["14", "gyr_raw_disable_hk"] DISABLE_RAW_GYR_HK = ["gyr_raw_disable_hk"]
REQUEST_PROC_GYR_HK = ["15", "gyr_proc_hk"] REQUEST_PROC_GYR_HK = ["gyr_proc_hk"]
ENABLE_PROC_GYR_HK = ["16", "gyr_proc_enable_hk"] ENABLE_PROC_GYR_HK = ["gyr_proc_enable_hk"]
DISABLE_PROC_GYR_HK = ["17", "gyr_proc_disable_hk"] DISABLE_PROC_GYR_HK = ["gyr_proc_disable_hk"]
REQUEST_PROC_GPS_HK = ["18", "gps_proc_hk"] REQUEST_PROC_GPS_HK = ["gps_proc_hk"]
ENABLE_PROC_GPS_HK = ["19", "gps_proc_enable_hk"] ENABLE_PROC_GPS_HK = ["gps_proc_enable_hk"]
DISABLE_PROC_GPS_HK = ["20", "gps_proc_disable_hk"] DISABLE_PROC_GPS_HK = ["gps_proc_disable_hk"]
REQUEST_MEKF_HK = ["21", "mekf_hk"] REQUEST_MEKF_HK = ["mekf_hk"]
ENABLE_MEKF_HK = ["22", "mekf_enable_hk"] ENABLE_MEKF_HK = ["mekf_enable_hk"]
DISABLE_MEKF_HK = ["23", "mekf_disable_hk"] DISABLE_MEKF_HK = ["mekf_disable_hk"]
REQUEST_CTRL_VAL_HK = ["24", "ctrl_val_hk"] REQUEST_CTRL_VAL_HK = ["ctrl_val_hk"]
ENABLE_CTRL_VAL_HK = ["25", "ctrl_val_enable_hk"] ENABLE_CTRL_VAL_HK = ["ctrl_val_enable_hk"]
DISABLE_CTRL_VAL_HK = ["26", "ctrl_val_disable_hk"] DISABLE_CTRL_VAL_HK = ["ctrl_val_disable_hk"]
REQUEST_ACT_CMD_HK = ["27", "act_cmd_hk"] REQUEST_ACT_CMD_HK = ["act_cmd_hk"]
ENABLE_ACT_CMD_HK = ["28", "act_cmd_enable_hk"] ENABLE_ACT_CMD_HK = ["act_cmd_enable_hk"]
DISABLE_ACT_CMD_HK = ["29", "act_cmd_disable_hk"] DISABLE_ACT_CMD_HK = ["act_cmd_disable_hk"]
class Info: class Info:
@ -273,9 +274,10 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.MGM_RAW_SET)) generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.MGM_RAW_SET))
) )
elif op_code in OpCodes.ENABLE_RAW_MGM_HK: elif op_code in OpCodes.ENABLE_RAW_MGM_HK:
interval = float(input("Please specify interval in floating point seconds: "))
q.add_log_cmd(Info.ENABLE_RAW_MGM_HK) q.add_log_cmd(Info.ENABLE_RAW_MGM_HK)
cmd_tuple = enable_periodic_hk_command_with_interval( cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetId.MGM_RAW_SET), 2.0 False, make_sid(ACS_CONTROLLER, SetId.MGM_RAW_SET), interval
) )
q.add_pus_tc(cmd_tuple[0]) q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1]) q.add_pus_tc(cmd_tuple[1])
@ -292,9 +294,10 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.MGM_PROC_SET)) generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.MGM_PROC_SET))
) )
elif op_code in OpCodes.ENABLE_PROC_MGM_HK: elif op_code in OpCodes.ENABLE_PROC_MGM_HK:
interval = float(input("Please specify interval in floating point seconds: "))
q.add_log_cmd(Info.ENABLE_PROC_MGM_HK) q.add_log_cmd(Info.ENABLE_PROC_MGM_HK)
cmd_tuple = enable_periodic_hk_command_with_interval( cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetId.MGM_PROC_SET), 2.0 False, make_sid(ACS_CONTROLLER, SetId.MGM_PROC_SET), interval
) )
q.add_pus_tc(cmd_tuple[0]) q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1]) q.add_pus_tc(cmd_tuple[1])
@ -311,9 +314,10 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.SUS_RAW_SET)) generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.SUS_RAW_SET))
) )
elif op_code in OpCodes.ENABLE_RAW_SUS_HK: elif op_code in OpCodes.ENABLE_RAW_SUS_HK:
interval = float(input("Please specify interval in floating point seconds: "))
q.add_log_cmd(Info.ENABLE_RAW_SUS_HK) q.add_log_cmd(Info.ENABLE_RAW_SUS_HK)
cmd_tuple = enable_periodic_hk_command_with_interval( cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetId.SUS_RAW_SET), 2.0 False, make_sid(ACS_CONTROLLER, SetId.SUS_RAW_SET), interval
) )
q.add_pus_tc(cmd_tuple[0]) q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1]) q.add_pus_tc(cmd_tuple[1])
@ -330,9 +334,10 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.SUS_PROC_SET)) generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.SUS_PROC_SET))
) )
elif op_code in OpCodes.ENABLE_PROC_SUS_HK: elif op_code in OpCodes.ENABLE_PROC_SUS_HK:
interval = float(input("Please specify interval in floating point seconds: "))
q.add_log_cmd(Info.ENABLE_PROC_SUS_HK) q.add_log_cmd(Info.ENABLE_PROC_SUS_HK)
cmd_tuple = enable_periodic_hk_command_with_interval( cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetId.SUS_PROC_SET), 2.0 False, make_sid(ACS_CONTROLLER, SetId.SUS_PROC_SET), interval
) )
q.add_pus_tc(cmd_tuple[0]) q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1]) q.add_pus_tc(cmd_tuple[1])
@ -349,9 +354,10 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
create_request_one_diag_command(make_sid(ACS_CONTROLLER, SetId.GYR_RAW_SET)) create_request_one_diag_command(make_sid(ACS_CONTROLLER, SetId.GYR_RAW_SET))
) )
elif op_code in OpCodes.ENABLE_RAW_GYR_HK: elif op_code in OpCodes.ENABLE_RAW_GYR_HK:
interval = float(input("Please specify interval in floating point seconds: "))
q.add_log_cmd(Info.ENABLE_RAW_GYR_HK) q.add_log_cmd(Info.ENABLE_RAW_GYR_HK)
cmd_tuple = enable_periodic_hk_command_with_interval( cmd_tuple = enable_periodic_hk_command_with_interval(
True, make_sid(ACS_CONTROLLER, SetId.GYR_RAW_SET), 2.0 True, make_sid(ACS_CONTROLLER, SetId.GYR_RAW_SET), interval
) )
q.add_pus_tc(cmd_tuple[0]) q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1]) q.add_pus_tc(cmd_tuple[1])
@ -370,9 +376,10 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
) )
) )
elif op_code in OpCodes.ENABLE_PROC_GYR_HK: elif op_code in OpCodes.ENABLE_PROC_GYR_HK:
interval = float(input("Please specify interval in floating point seconds: "))
q.add_log_cmd(Info.ENABLE_PROC_GYR_HK) q.add_log_cmd(Info.ENABLE_PROC_GYR_HK)
cmd_tuple = enable_periodic_hk_command_with_interval( cmd_tuple = enable_periodic_hk_command_with_interval(
True, make_sid(ACS_CONTROLLER, SetId.GYR_PROC_SET), 2.0 True, make_sid(ACS_CONTROLLER, SetId.GYR_PROC_SET), interval
) )
q.add_pus_tc(cmd_tuple[0]) q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1]) q.add_pus_tc(cmd_tuple[1])
@ -389,9 +396,10 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.GPS_PROC_SET)) generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.GPS_PROC_SET))
) )
elif op_code in OpCodes.ENABLE_PROC_GPS_HK: elif op_code in OpCodes.ENABLE_PROC_GPS_HK:
interval = float(input("Please specify interval in floating point seconds: "))
q.add_log_cmd(Info.ENABLE_PROC_GPS_HK) q.add_log_cmd(Info.ENABLE_PROC_GPS_HK)
cmd_tuple = enable_periodic_hk_command_with_interval( cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetId.GPS_PROC_SET), 2.0 False, make_sid(ACS_CONTROLLER, SetId.GPS_PROC_SET), interval
) )
q.add_pus_tc(cmd_tuple[0]) q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1]) q.add_pus_tc(cmd_tuple[1])
@ -408,9 +416,10 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
create_request_one_diag_command(make_sid(ACS_CONTROLLER, SetId.MEKF_DATA)) create_request_one_diag_command(make_sid(ACS_CONTROLLER, SetId.MEKF_DATA))
) )
elif op_code in OpCodes.ENABLE_MEKF_HK: elif op_code in OpCodes.ENABLE_MEKF_HK:
interval = float(input("Please specify interval in floating point seconds: "))
q.add_log_cmd(Info.ENABLE_MEKF_HK) q.add_log_cmd(Info.ENABLE_MEKF_HK)
cmd_tuple = enable_periodic_hk_command_with_interval( cmd_tuple = enable_periodic_hk_command_with_interval(
True, make_sid(ACS_CONTROLLER, SetId.MEKF_DATA), 2.0 True, make_sid(ACS_CONTROLLER, SetId.MEKF_DATA), interval
) )
q.add_pus_tc(cmd_tuple[0]) q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1]) q.add_pus_tc(cmd_tuple[1])
@ -425,9 +434,10 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.CTRL_VAL_DATA)) generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.CTRL_VAL_DATA))
) )
elif op_code in OpCodes.ENABLE_CTRL_VAL_HK: elif op_code in OpCodes.ENABLE_CTRL_VAL_HK:
interval = float(input("Please specify interval in floating point seconds: "))
q.add_log_cmd(Info.ENABLE_CTRL_VAL_HK) q.add_log_cmd(Info.ENABLE_CTRL_VAL_HK)
cmd_tuple = enable_periodic_hk_command_with_interval( cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetId.CTRL_VAL_DATA), 2.0 False, make_sid(ACS_CONTROLLER, SetId.CTRL_VAL_DATA), interval
) )
q.add_pus_tc(cmd_tuple[0]) q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1]) q.add_pus_tc(cmd_tuple[1])
@ -444,9 +454,10 @@ def pack_acs_ctrl_command(p: ServiceProviderParams):
generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.ACTUATOR_CMD_DATA)) generate_one_hk_command(make_sid(ACS_CONTROLLER, SetId.ACTUATOR_CMD_DATA))
) )
elif op_code in OpCodes.ENABLE_ACT_CMD_HK: elif op_code in OpCodes.ENABLE_ACT_CMD_HK:
interval = float(input("Please specify interval in floating point seconds: "))
q.add_log_cmd(Info.ENABLE_ACT_CMD_HK) q.add_log_cmd(Info.ENABLE_ACT_CMD_HK)
cmd_tuple = enable_periodic_hk_command_with_interval( cmd_tuple = enable_periodic_hk_command_with_interval(
False, make_sid(ACS_CONTROLLER, SetId.ACTUATOR_CMD_DATA), 2.0 False, make_sid(ACS_CONTROLLER, SetId.ACTUATOR_CMD_DATA), interval
) )
q.add_pus_tc(cmd_tuple[0]) q.add_pus_tc(cmd_tuple[0])
q.add_pus_tc(cmd_tuple[1]) q.add_pus_tc(cmd_tuple[1])
@ -880,7 +891,7 @@ def handle_gyr_data_processed(pw: PrintWrapper, hk_data: bytes):
current_idx = 0 current_idx = 0
for i in range(4): for i in range(4):
gyr_vec = [ gyr_vec = [
f"{val:8.3f}" f"{val*180/math.pi:8.3f}"
for val in struct.unpack( for val in struct.unpack(
fmt_str, hk_data[current_idx : current_idx + inc_len] fmt_str, hk_data[current_idx : current_idx + inc_len]
) )
@ -888,7 +899,7 @@ def handle_gyr_data_processed(pw: PrintWrapper, hk_data: bytes):
pw.dlog(f"{GYR_NAMES[i]}: {gyr_vec}") pw.dlog(f"{GYR_NAMES[i]}: {gyr_vec}")
current_idx += inc_len current_idx += inc_len
gyr_vec_tot = [ gyr_vec_tot = [
f"{val:8.3f}" f"{val*180/math.pi:8.3f}"
for val in struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len]) for val in struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
] ]
pw.dlog(f"GYR Vec Total: {gyr_vec_tot}") pw.dlog(f"GYR Vec Total: {gyr_vec_tot}")
@ -907,13 +918,20 @@ def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
return return
current_idx = 0 current_idx = 0
lat = [ lat = [
f"{val:8.3f}" f"{val*180/math.pi:8.3f}"
for val in struct.unpack( for val in struct.unpack(
fmt_scalar, hk_data[current_idx : current_idx + inc_len_scalar] fmt_scalar, hk_data[current_idx : current_idx + inc_len_scalar]
) )
] ]
current_idx += inc_len_scalar current_idx += inc_len_scalar
long = [ long = [
f"{val*180/math.pi:8.3f}"
for val in struct.unpack(
fmt_scalar, hk_data[current_idx : current_idx + inc_len_scalar]
)
]
current_idx += inc_len_scalar
alt = [
f"{val:8.3f}" f"{val:8.3f}"
for val in struct.unpack( for val in struct.unpack(
fmt_scalar, hk_data[current_idx: current_idx + inc_len_scalar] fmt_scalar, hk_data[current_idx: current_idx + inc_len_scalar]
@ -934,8 +952,9 @@ def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
) )
] ]
current_idx += inc_len_vec current_idx += inc_len_vec
pw.dlog(f"GPS Latitude: {lat} [rad]") pw.dlog(f"GPS Latitude: {lat} [deg]")
pw.dlog(f"GPS Longitude: {long} [rad]") pw.dlog(f"GPS Longitude: {long} [deg]")
pw.dlog(f"GPS Altitude: {alt} [m]")
pw.dlog(f"GPS Position: {pos} [m]") pw.dlog(f"GPS Position: {pos} [m]")
pw.dlog(f"GPS Velocity: {velo} [m/s]") pw.dlog(f"GPS Velocity: {velo} [m/s]")
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=4) pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=4)
@ -966,7 +985,7 @@ def handle_mekf_data(pw: PrintWrapper, hk_data: bytes):
current_idx = 0 current_idx = 0
quat = struct.unpack(fmt_quat, hk_data[current_idx : current_idx + inc_len_quat]) quat = struct.unpack(fmt_quat, hk_data[current_idx : current_idx + inc_len_quat])
current_idx += inc_len_quat current_idx += inc_len_quat
rate = struct.unpack(fmt_vec, hk_data[current_idx : current_idx + inc_len_vec]) rate = struct.unpack(fmt_vec, hk_data[current_idx : current_idx + inc_len_vec])*180/math.pi
current_idx += inc_len_vec current_idx += inc_len_vec
status = struct.unpack(fmt_sts, hk_data[current_idx : current_idx + inc_len_sts])[0] status = struct.unpack(fmt_sts, hk_data[current_idx : current_idx + inc_len_sts])[0]
current_idx += inc_len_sts current_idx += inc_len_sts
@ -1003,14 +1022,14 @@ def handle_ctrl_val_data(pw: PrintWrapper, hk_data: bytes):
] ]
current_idx += inc_len_quat current_idx += inc_len_quat
err_ang = [ err_ang = [
f"{val:8.3f}" f"{val*180/math.pi:8.3f}"
for val in struct.unpack( for val in struct.unpack(
fmt_scalar, hk_data[current_idx : current_idx + inc_len_scalar] fmt_scalar, hk_data[current_idx : current_idx + inc_len_scalar]
) )
] ]
current_idx += inc_len_scalar current_idx += inc_len_scalar
tgt_rot = [ tgt_rot = [
f"{val:8.3f}" f"{val*180/math.pi:8.3f}"
for val in struct.unpack( for val in struct.unpack(
fmt_vec, hk_data[current_idx : current_idx + inc_len_vec] fmt_vec, hk_data[current_idx : current_idx + inc_len_vec]
) )
@ -1018,8 +1037,8 @@ def handle_ctrl_val_data(pw: PrintWrapper, hk_data: bytes):
current_idx += inc_len_vec current_idx += inc_len_vec
pw.dlog(f"Control Values Target Quaternion: {tgt_quat}") pw.dlog(f"Control Values Target Quaternion: {tgt_quat}")
pw.dlog(f"Control Values Error Quaternion: {err_quat}") pw.dlog(f"Control Values Error Quaternion: {err_quat}")
pw.dlog(f"Control Values Error Angle: {err_ang} [rad]") pw.dlog(f"Control Values Error Angle: {err_ang} [deg]")
pw.dlog(f"Control Values Target Rotational Rate: {tgt_rot} [rad/s]") pw.dlog(f"Control Values Target Rotational Rate: {tgt_rot} [deg/s]")
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=4) pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=4)