Skip to content

Commit

Permalink
Make Prepare Special URDF script fail with success exit code (#68)
Browse files Browse the repository at this point in the history
* Add a try exception block on loading URDF from export folder

* formatting fix
  • Loading branch information
hello-fazil authored Jul 10, 2024
1 parent 365fbb8 commit f0ce7cb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion prepare_specialized_urdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pathlib
import pprint
import subprocess
import sys
from typing import Dict, Optional, Tuple

# Third-party imports
Expand Down Expand Up @@ -94,7 +95,13 @@ def save_urdf_file(robot, file_name):
print("Loading URDF from:")
print(urdf_filename)
print("The specialized URDFs will be derived from this URDF.")
robot = ud.Robot.from_xml_file(urdf_filename)
try:
robot = ud.Robot.from_xml_file(urdf_filename)
except FileNotFoundError:
print(
f"The URDF file was not found in path {urdf_filename}. Unable to create specialized URDFs."
)
sys.exit(0)

# Change any joint that should be immobile for end effector IK into a fixed joint
for j in robot.joint_map.keys():
Expand Down

0 comments on commit f0ce7cb

Please sign in to comment.