@@ -1021,10 +1021,7 @@ def inverse_kinematics(self, frame_WCF, start_configuration=None, group=None, re
10211021 frame_WCF_scaled .point /= self .scale_factor # must be in meters
10221022
10231023 if self .attached_tool :
1024- if attached_collision_meshes :
1025- attached_collision_meshes .append (self .attached_tool .attached_collision_mesh )
1026- else :
1027- attached_collision_meshes = [self .attached_tool .attached_collision_mesh ]
1024+ attached_collision_meshes .append (self .attached_tool .attached_collision_mesh )
10281025
10291026 options ['attached_collision_meshes' ] = attached_collision_meshes
10301027
@@ -1201,7 +1198,7 @@ def plan_cartesian_motion(self, frames_WCF, start_configuration=None, group=None
12011198 options = options or {}
12021199 max_step = options .get ('max_step' )
12031200 path_constraints = options .get ('path_constraints' )
1204- attached_collision_meshes = options .get ('attached_collision_meshes' )
1201+ attached_collision_meshes = options .get ('attached_collision_meshes' , [] )
12051202
12061203 self .ensure_client ()
12071204 if not group :
@@ -1230,13 +1227,10 @@ def plan_cartesian_motion(self, frames_WCF, start_configuration=None, group=None
12301227 path_constraints_WCF_scaled = None
12311228
12321229 if self .attached_tool :
1233- if attached_collision_meshes :
1234- attached_collision_meshes .append (self .attached_tool .attached_collision_mesh )
1235- else :
1236- attached_collision_meshes = [self .attached_tool .attached_collision_mesh ]
1230+ attached_collision_meshes .append (self .attached_tool .attached_collision_mesh )
12371231
1238- options ['path_constraints' ] = path_constraints
12391232 options ['attached_collision_meshes' ] = attached_collision_meshes
1233+ options ['path_constraints' ] = path_constraints
12401234 if max_step :
12411235 options ['max_step' ] = max_step / self .scale_factor
12421236
@@ -1335,7 +1329,7 @@ def plan_motion(self, goal_constraints, start_configuration=None, group=None, op
13351329 """
13361330 options = options or {}
13371331 path_constraints = options .get ('path_constraints' )
1338- attached_collision_meshes = options .get ('attached_collision_meshes' )
1332+ attached_collision_meshes = options .get ('attached_collision_meshes' , [] )
13391333
13401334 # TODO: for the motion plan request a list of possible goal constraints
13411335 # can be passed, from which the planner will try to find a path that
@@ -1379,13 +1373,10 @@ def plan_motion(self, goal_constraints, start_configuration=None, group=None, op
13791373 path_constraints_WCF_scaled = None
13801374
13811375 if self .attached_tool :
1382- if attached_collision_meshes :
1383- attached_collision_meshes .append (self .attached_tool .attached_collision_mesh )
1384- else :
1385- attached_collision_meshes = [self .attached_tool .attached_collision_mesh ]
1376+ attached_collision_meshes .append (self .attached_tool .attached_collision_mesh )
13861377
1387- options ['path_constraints' ] = path_constraints_WCF_scaled
13881378 options ['attached_collision_meshes' ] = attached_collision_meshes
1379+ options ['path_constraints' ] = path_constraints_WCF_scaled
13891380
13901381 trajectory = self .client .plan_motion (
13911382 robot = self ,
0 commit comments