Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fix to python API and gitignore #5

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__pycache__
*/build/*
**/build/*
.vscode
3 changes: 2 additions & 1 deletion mad_icp/apps/mad_icp.py
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is to open the file in append mode.
The truncate call basically clears existing contents of the file if it existed before, which the write mode does by default, but not the append mode.

Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def main(data_path: Annotated[
p_th, b_min, b_ratio, num_keyframes, num_cores, realtime)

estimate_file_name = estimate_path / "estimate.txt"
estimate_file = open(estimate_file_name, 'w')
estimate_file = open(estimate_file_name, 'a')
estimate_file.truncate(0)

with InputDataInterface_lut[reader_type](data_path, min_range, max_range, topic=topic, sensor_hz=sensor_hz, apply_correction=apply_correction) as reader:
t_start = datetime.now()
Expand Down
5 changes: 1 addition & 4 deletions mad_icp/apps/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,4 @@
def write_transformed_pose(estimate_file, lidar_to_world, lidar_to_base):
base_to_lidar = np.linalg.inv(lidar_to_base)
base_to_world = np.dot(lidar_to_base, np.dot(lidar_to_world, base_to_lidar))
for row in range(3):
for col in range(4):
estimate_file.write(str(base_to_world[row, col]) + " ")
estimate_file.write("\n")
np.savetxt(estimate_file, base_to_world[:3].reshape(-1, 12))
Loading