Skip to content

Commit d9b7b62

Browse files
nikhil-sethiNikhil Sethi
authored andcommitted
Add early failure for a missing toolpath file
1 parent d6a99bc commit d9b7b62

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

snp_motion_planning/snp_motion_planning/motion_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ def __init__(self): -> None
8383
)
8484
self.declare_parameter("toolpath_file", toolpath_default)
8585
self.toolpath_file = self.get_parameter("toolpath_file").get_parameter_value().string_value
86+
if not os.path.exists(self.toolpath_file):
87+
raise FileNotFoundError(f"Toolpath file not found: {self.toolpath_file}")
88+
8689
self.motion_group = self.get_parameter("motion_group").get_parameter_value().string_value
8790
self.tcp_frame = self.get_parameter("tcp_frame").get_parameter_value().string_value
8891

@@ -98,7 +101,6 @@ def request_plan(self):
98101
"""Request a motion plan from the motion planning service."""
99102
req = GenerateMotionPlan.Request()
100103
inspection_toolpath = create_toolpath_from_yaml(self.toolpath_file)
101-
102104
req.tool_paths = [inspection_toolpath]
103105
req.motion_group = self.motion_group
104106
req.tcp_frame = self.tcp_frame

0 commit comments

Comments
 (0)