updated handle_mekf_data

This commit is contained in:
Marius Eggert 2023-02-24 14:01:39 +01:00
parent 31d51e3660
commit 09dbc6b14d

View File

@ -732,8 +732,10 @@ def handle_ctrl_val_data(pw: PrintWrapper, hk_data: bytes):
pw.dlog("Received CTRL Values Set") pw.dlog("Received CTRL Values Set")
fmt_quat = "!dddd" fmt_quat = "!dddd"
fmt_scalar = "!d" fmt_scalar = "!d"
fmt_vec = "!ddd"
inc_len_quat = struct.calcsize(fmt_quat) inc_len_quat = struct.calcsize(fmt_quat)
inc_len_scalar = struct.calcsize(fmt_scalar) inc_len_scalar = struct.calcsize(fmt_scalar)
inc_len_vec = struct.calcsize(fmt_vec)
if len(hk_data) < 2 * inc_len_quat + inc_len_scalar: if len(hk_data) < 2 * inc_len_quat + inc_len_scalar:
pw.dlog("Received HK set too small") pw.dlog("Received HK set too small")
return return
@ -759,10 +761,18 @@ def handle_ctrl_val_data(pw: PrintWrapper, hk_data: bytes):
) )
] ]
current_idx += inc_len_scalar current_idx += inc_len_scalar
tgt_rot = [
f"{val:8.3f}"
for val in struct.unpack(
fmt_vec, hk_data[current_idx : 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} [rad]")
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=3) pw.dlog(f"Control Values Target Rotational Rate: {tgt_rot} [rad/s]")
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=4)
def handle_act_cmd_data(pw: PrintWrapper, hk_data: bytes): def handle_act_cmd_data(pw: PrintWrapper, hk_data: bytes):