updated gps data with new value. fixed validity flag output because someone (me) was to stupid to do it right in the first place

This commit is contained in:
Marius Eggert 2023-02-02 11:11:22 +01:00
parent c633893df4
commit 17486fdca7

View File

@ -619,7 +619,7 @@ def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
fmt_vec = "!ddd" fmt_vec = "!ddd"
inc_len_scalar = struct.calcsize(fmt_scalar) inc_len_scalar = struct.calcsize(fmt_scalar)
inc_len_vec = struct.calcsize(fmt_vec) inc_len_vec = struct.calcsize(fmt_vec)
if len(hk_data) < 2 * inc_len_scalar + inc_len_vec: if len(hk_data) < 2 * inc_len_scalar + 2 * inc_len_vec:
pw.dlog("Received HK set too small") pw.dlog("Received HK set too small")
return return
current_idx = 0 current_idx = 0
@ -637,14 +637,22 @@ def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
) )
] ]
current_idx += inc_len_scalar current_idx += inc_len_scalar
pos = [
f"{val:8.3f}"
for val in struct.unpack(
fmt_vec, hk_data[current_idx : current_idx + inc_len_vec]
)
]
velo = [ velo = [
f"{val:8.3f}" f"{val: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]
) )
] ]
current_idx += inc_len_vec
pw.dlog(f"GPS Latitude: {lat} [rad]") pw.dlog(f"GPS Latitude: {lat} [rad]")
pw.dlog(f"GPS Longitude: {long} [rad]") pw.dlog(f"GPS Longitude: {long} [rad]")
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=3) pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=3)
@ -672,6 +680,7 @@ def handle_mekf_data(pw: PrintWrapper, hk_data: bytes):
fmt_vec, hk_data[current_idx : current_idx + inc_len_vec] fmt_vec, hk_data[current_idx : current_idx + inc_len_vec]
) )
] ]
current_idx += inc_len_vec
pw.dlog(f"MEKF Quaternion: {quat}") pw.dlog(f"MEKF Quaternion: {quat}")
pw.dlog(f"MEKF Rotational Rate: {rate}") pw.dlog(f"MEKF Rotational Rate: {rate}")
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=2) pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=2)
@ -707,6 +716,7 @@ def handle_ctrl_val_data(pw: PrintWrapper, hk_data: bytes):
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
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]")
@ -745,6 +755,7 @@ def handle_act_cmd_data(pw: PrintWrapper, hk_data: bytes):
fmt_vec3_int16, hk_data[current_idx : current_idx + inc_len_vec3_int16] fmt_vec3_int16, hk_data[current_idx : current_idx + inc_len_vec3_int16]
) )
] ]
current_idx += inc_len_vec3_int16
pw.dlog(f"Actuator Commands RW Target Torque: {rw_tgt_torque}") pw.dlog(f"Actuator Commands RW Target Torque: {rw_tgt_torque}")
pw.dlog(f"Actuator Commands RW Target Speed: {rw_tgt_speed}") pw.dlog(f"Actuator Commands RW Target Speed: {rw_tgt_speed}")
pw.dlog(f"Actuator Commands MTQ Target Dipole: {mtq_tgt_dipole}") pw.dlog(f"Actuator Commands MTQ Target Dipole: {mtq_tgt_dipole}")