use python f-strings

release/4.3a0
Varun Agrawal 2021-10-21 15:12:31 -04:00
parent 279c645028
commit 03ac36c8c3
1 changed files with 7 additions and 13 deletions

View File

@ -145,10 +145,10 @@ def save_results(isam: gtsam.ISAM2, output_filename: str, first_gps_pose: int,
pose_quat = pose.rotation().toQuaternion() pose_quat = pose.rotation().toQuaternion()
gps = gps_measurements[i].position gps = gps_measurements[i].position
print("State at #{}".format(i)) print(f"State at #{i}")
print("Pose:\n", pose) print(f"Pose:\n{pose}")
print("Velocity:\n", velocity) print(f"Velocity:\n{velocity}")
print("Bias:\n", bias) print(f"Bias:\n{bias}")
fp_out.write("{},{},{},{},{},{},{},{},{},{},{}\n".format( fp_out.write("{},{},{},{},{},{},{},{},{},{},{}\n".format(
gps_measurements[i].time, pose.x(), pose.y(), pose.z(), gps_measurements[i].time, pose.x(), pose.y(), pose.z(),
@ -290,9 +290,7 @@ def main():
noise_model_gps) noise_model_gps)
new_values.insert(current_pose_key, gps_pose) new_values.insert(current_pose_key, gps_pose)
print( print(f"############ POSE INCLUDED AT TIME {t} ############")
"################ POSE INCLUDED AT TIME {} ################"
.format(t))
print(gps_pose.translation(), "\n") print(gps_pose.translation(), "\n")
else: else:
new_values.insert(current_pose_key, current_pose_global) new_values.insert(current_pose_key, current_pose_global)
@ -307,9 +305,7 @@ def main():
# We accumulate 2*GPSskip GPS measurements before updating the solver at # We accumulate 2*GPSskip GPS measurements before updating the solver at
# first so that the heading becomes observable. # first so that the heading becomes observable.
if i > (first_gps_pose + 2 * gps_skip): if i > (first_gps_pose + 2 * gps_skip):
print( print(f"############ NEW FACTORS AT TIME {t:.6f} ############")
"################ NEW FACTORS AT TIME {:.6f} ################"
.format(t))
new_factors.print() new_factors.print()
isam.update(new_factors, new_values) isam.update(new_factors, new_values)
@ -325,9 +321,7 @@ def main():
current_velocity_global = result.atVector(current_vel_key) current_velocity_global = result.atVector(current_vel_key)
current_bias = result.atConstantBias(current_bias_key) current_bias = result.atConstantBias(current_bias_key)
print( print(f"############ POSE AT TIME {t} ############")
"################ POSE AT TIME {} ################".format(
t))
current_pose_global.print() current_pose_global.print()
print("\n") print("\n")