@@ -63,6 +63,7 @@ def __init__(self, moveit_group_name:str, fixed_frame:str=None) -> None:
6363 # create lock for synchronization
6464 self .action_lock = threading .Lock ()
6565 # define constants (should import from config)
66+ self .JUMP_THRESHOLD = 0.0 # max ratio of joint change over average change
6667 self .TF_PUB_RATE = rospy .get_param ('general_commander/tf_rate' , 10 ) # default to 10 Hz
6768 self .CARTE_PLANNING_STEP_SIZE = rospy .get_param ('general_commander/step_size' , 0.01 ) # meters
6869 self .GROUP_NAME = moveit_group_name
@@ -712,7 +713,7 @@ def move_displacement(self, dx=0.0, dy=0.0, dz=0.0, accept_fraction=0.9999, wait
712713 target_pose .pose .position .z += dz
713714 waypoints = [current_pose .pose , target_pose .pose ]
714715 # changed for new moveit version
715- (plan , fraction ) = self .move_group .compute_cartesian_path (waypoints , self .CARTE_PLANNING_STEP_SIZE )
716+ (plan , fraction ) = self .move_group .compute_cartesian_path (waypoints , self .CARTE_PLANNING_STEP_SIZE , self . JUMP_THRESHOLD )
716717 if fraction < accept_fraction :
717718 rospy .logerr (f'Planning failed' )
718719 self .commander_state = GeneralCommanderStates .ABORTED
@@ -773,7 +774,7 @@ def move_to_position(self, x:float=None, y:float=None, z:float=None, accept_frac
773774 waypoints = [current_in_world_frame .pose , target_in_world_frame .pose ]
774775 self .commander_state = GeneralCommanderStates .BUSY
775776 # changed for new moveit version
776- (plan , fraction ) = self .move_group .compute_cartesian_path (waypoints , self .CARTE_PLANNING_STEP_SIZE )
777+ (plan , fraction ) = self .move_group .compute_cartesian_path (waypoints , self .CARTE_PLANNING_STEP_SIZE , self . JUMP_THRESHOLD )
777778 if fraction < accept_fraction :
778779 rospy .logerr (f'The commander (move_to_position): planning failed due to collision ({ fraction } )' )
779780 self .commander_state , self .commander_state .message = GeneralCommanderStates .ABORTED , 'PLANNING_FAILED_DUE_TO_COLLISION'
@@ -834,7 +835,7 @@ def move_to_multi_positions(self, xyz_list, reference_frame:str=None, wait=True)
834835
835836 self .commander_state = GeneralCommanderStates .BUSY
836837 # changed for new moveit version
837- (plan , fraction ) = self .move_group .compute_cartesian_path (waypoints_list , self .CARTE_PLANNING_STEP_SIZE )
838+ (plan , fraction ) = self .move_group .compute_cartesian_path (waypoints_list , self .CARTE_PLANNING_STEP_SIZE , self . JUMP_THRESHOLD )
838839 if fraction < 0.999 :
839840 rospy .logerr (f'The commander (move_to_multi_positions): planning failed due to collision ({ fraction } )' )
840841 self .commander_state , self .commander_state .message = GeneralCommanderStates .ABORTED , 'PLANNING_FAILED_DUE_TO_COLLISION'
@@ -1017,7 +1018,7 @@ def move_to_multi_poses(self, waypoints_list, reference_frame:str=None, wait=Tru
10171018
10181019 self .commander_state = GeneralCommanderStates .BUSY
10191020 # changed for new moveit version
1020- (plan , fraction ) = self .move_group .compute_cartesian_path (processed_waypoints_list , self .CARTE_PLANNING_STEP_SIZE )
1021+ (plan , fraction ) = self .move_group .compute_cartesian_path (processed_waypoints_list , self .CARTE_PLANNING_STEP_SIZE , self . JUMP_THRESHOLD )
10211022 if fraction < 0.999 :
10221023 rospy .logerr (f'The commander (move_to_multi_poses): planning failed due to collision ({ fraction } )' )
10231024 self .commander_state , self .commander_state .message = GeneralCommanderStates .ABORTED , 'PLANNING_FAILED_DUE_TO_COLLISION'
0 commit comments