Skip to content

Commit

Permalink
Use file's md5sum for compressed urdf
Browse files Browse the repository at this point in the history
  • Loading branch information
iory committed Dec 10, 2024
1 parent 1100376 commit aa556d6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ros/kxr_models/node_scripts/urdf_model_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ def run(self):
temp_file.write(urdf)
urdf_path = temp_file.name

md5sum = checksum_md5(urdf_path)
urdf_md5sum = checksum_md5(urdf_path)
compressed_urdf_path = os.path.join(
kxr_models_path, "models", "urdf", f"{md5sum}.tar.gz"
kxr_models_path, "models", "urdf", f"{urdf_md5sum}.tar.gz"
)

if os.path.exists(compressed_urdf_path):
md5sum = checksum_md5(compressed_urdf_path)
self._update_robot_description(urdf_path, md5sum, kxr_models_path)
continue

Expand All @@ -60,6 +61,7 @@ def run(self):
compress=True,
)
rospy.loginfo(f"Compressed URDF model saved to {compressed_urdf_path}")
md5sum = checksum_md5(compressed_urdf_path)
self._update_robot_description(urdf_path, md5sum, kxr_models_path)

os.remove(urdf_path)
Expand Down

0 comments on commit aa556d6

Please sign in to comment.