reworked fused rotation rate set implemented

This commit is contained in:
Marius Eggert 2024-06-24 13:40:12 +02:00
parent 2d6e9f826c
commit 50f504992b

View File

@ -988,27 +988,43 @@ def handle_fused_rot_rate_data(pw: PrintWrapper, hk_data: bytes):
inc_len_vec3_double = struct.calcsize(fmt_vec3_double) inc_len_vec3_double = struct.calcsize(fmt_vec3_double)
fmt_source = "!B" fmt_source = "!B"
inc_len_source = struct.calcsize(fmt_source) inc_len_source = struct.calcsize(fmt_source)
old_size = 3 * inc_len_vec3_double + 1 v0_size = 3 * inc_len_vec3_double + 1
new_size = 3 * inc_len_vec3_double + inc_len_source + 1 v1_size = 3 * inc_len_vec3_double + inc_len_source + 1
v2_size = 2 * inc_len_vec3_double + inc_len_source + 1
size = len(hk_data) size = len(hk_data)
if size not in [old_size, new_size]: if size not in [v0_size, v1_size, v2_size]:
pw.dlog(f"Received Fused Rot Rate HK set of unexpected size: {len(hk_data)}") pw.dlog(f"Received Fused Rot Rate HK set of unexpected size: {len(hk_data)}")
return return
current_idx = 0 current_idx = 0
if size in [v0_size, v1_size]:
rot_rate_orthogonal = [ rot_rate_orthogonal = [
f"{val*180/math.pi:8.3f}" f"{val*180/math.pi:8.3f}"
for val in struct.unpack( for val in struct.unpack(
fmt_vec3_double, hk_data[current_idx : current_idx + inc_len_vec3_double] fmt_vec3_double,
hk_data[current_idx : current_idx + inc_len_vec3_double],
) )
] ]
current_idx += inc_len_vec3_double current_idx += inc_len_vec3_double
pw.dlog(f"Fused Rotational Rate Orthogonal: {rot_rate_orthogonal} [deg/s]")
rot_rate_parallel = [ rot_rate_parallel = [
f"{val*180/math.pi:8.3f}" f"{val*180/math.pi:8.3f}"
for val in struct.unpack( for val in struct.unpack(
fmt_vec3_double, hk_data[current_idx : current_idx + inc_len_vec3_double] fmt_vec3_double,
hk_data[current_idx : current_idx + inc_len_vec3_double],
) )
] ]
current_idx += inc_len_vec3_double current_idx += inc_len_vec3_double
pw.dlog(f"Fused Rotational Rate Parallel: {rot_rate_parallel} [deg/s]")
else:
rot_rate_susmgm = [
f"{val * 180 / math.pi:8.3f}"
for val in struct.unpack(
fmt_vec3_double,
hk_data[current_idx: current_idx + inc_len_vec3_double],
)
]
current_idx += inc_len_vec3_double
pw.dlog(f"Fused Rotational Rate SUSMGM: {rot_rate_susmgm} [deg/s]")
rot_rate_total = [ rot_rate_total = [
f"{val*180/math.pi:8.3f}" f"{val*180/math.pi:8.3f}"
for val in struct.unpack( for val in struct.unpack(
@ -1016,10 +1032,8 @@ def handle_fused_rot_rate_data(pw: PrintWrapper, hk_data: bytes):
) )
] ]
current_idx += inc_len_vec3_double current_idx += inc_len_vec3_double
pw.dlog(f"Fused Rotational Rate Orthogonal: {rot_rate_orthogonal} [deg/s]")
pw.dlog(f"Fused Rotational Rate Parallel: {rot_rate_parallel} [deg/s]")
pw.dlog(f"Fused Rotational Rate Total: {rot_rate_total} [deg/s]") pw.dlog(f"Fused Rotational Rate Total: {rot_rate_total} [deg/s]")
if size == new_size: if size in [v1_size, v2_size]:
rot_rate_source = struct.unpack( rot_rate_source = struct.unpack(
fmt_source, hk_data[current_idx : current_idx + inc_len_source] fmt_source, hk_data[current_idx : current_idx + inc_len_source]
)[0] )[0]
@ -1030,9 +1044,10 @@ def handle_fused_rot_rate_data(pw: PrintWrapper, hk_data: bytes):
) )
else: else:
pw.dlog(f"Ctrl Strategy (key unknown): {rot_rate_source}") pw.dlog(f"Ctrl Strategy (key unknown): {rot_rate_source}")
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=4)) if size in [v0_size, v2_size]:
return
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=3)) pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=3))
else:
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=4))
def handle_fused_rot_rate_source_data(pw: PrintWrapper, hk_data: bytes): def handle_fused_rot_rate_source_data(pw: PrintWrapper, hk_data: bytes):