30 from tf.listener
import TransformListener
32 from moveit_msgs.msg
import MoveGroupAction, MoveGroupGoal
33 from moveit_msgs.msg
import Constraints, JointConstraint, PositionConstraint, OrientationConstraint, BoundingVolume
34 from shape_msgs.msg
import SolidPrimitive
46 def __init__(self, group, frame, listener=None, plan_only=False, move_group="move_group"):
71 supported_args = (
"max_velocity_scaling_factor",
73 "planning_scene_diff",
77 for arg
in kwargs.keys():
78 if not arg
in supported_args:
79 rospy.loginfo(
"moveToJointPosition: unsupported argument: %s",
89 g.request.start_state = kwargs[
"start_state"]
91 g.request.start_state.is_diff =
True 95 for i
in range(len(joints)):
96 c1.joint_constraints.append(JointConstraint())
97 c1.joint_constraints[i].joint_name = joints[i]
98 c1.joint_constraints[i].position = positions[i]
99 c1.joint_constraints[i].tolerance_above = tolerance
100 c1.joint_constraints[i].tolerance_below = tolerance
101 c1.joint_constraints[i].weight = 1.0
102 g.request.goal_constraints.append(c1)
110 g.request.planner_id = kwargs[
"planner_id"]
116 g.request.group_name = self.
_group 120 g.request.num_planning_attempts = kwargs[
"num_attempts"]
122 g.request.num_planning_attempts = 1
126 g.request.allowed_planning_time = kwargs[
"planning_time"]
132 g.request.max_velocity_scaling_factor = kwargs[
"max_velocity_scaling_factor"]
138 g.planning_options.planning_scene_diff = kwargs[
"planning_scene_diff"]
140 g.planning_options.planning_scene_diff.is_diff =
True 141 g.planning_options.planning_scene_diff.robot_state.is_diff =
True 145 g.planning_options.plan_only = kwargs[
"plan_only"]
147 g.planning_options.plan_only = self.
plan_only 150 g.planning_options.look_around =
False 151 g.planning_options.replan =
False 157 return self.
_action.get_result()
169 supported_args = (
"max_velocity_scaling_factor",
174 for arg
in kwargs.keys():
175 if not arg
in supported_args:
176 rospy.loginfo(
"moveToPose: unsupported argument: %s",
187 g.request.start_state = kwargs[
"start_state"]
189 g.request.start_state.is_diff =
True 194 c1.position_constraints.append(PositionConstraint())
195 c1.position_constraints[0].header.frame_id = self.
_fixed_frame 196 c1.position_constraints[0].link_name = gripper_frame
199 s.dimensions = [tolerance * tolerance]
201 b.primitives.append(s)
202 b.primitive_poses.append(pose_transformed.pose)
203 c1.position_constraints[0].constraint_region = b
204 c1.position_constraints[0].weight = 1.0
206 c1.orientation_constraints.append(OrientationConstraint())
207 c1.orientation_constraints[0].header.frame_id = self.
_fixed_frame 208 c1.orientation_constraints[0].orientation = pose_transformed.pose.orientation
209 c1.orientation_constraints[0].link_name = gripper_frame
210 c1.orientation_constraints[0].absolute_x_axis_tolerance = tolerance
211 c1.orientation_constraints[0].absolute_y_axis_tolerance = tolerance
212 c1.orientation_constraints[0].absolute_z_axis_tolerance = tolerance
213 c1.orientation_constraints[0].weight = 1.0
215 g.request.goal_constraints.append(c1)
223 g.request.planner_id = kwargs[
"planner_id"]
229 g.request.group_name = self.
_group 233 g.request.num_planning_attempts = kwargs[
"num_attempts"]
235 g.request.num_planning_attempts = 1
239 g.request.allowed_planning_time = kwargs[
"planning_time"]
245 g.request.max_velocity_scaling_factor = kwargs[
"max_velocity_scaling_factor"]
250 g.planning_options.planning_scene_diff.is_diff =
True 251 g.planning_options.planning_scene_diff.robot_state.is_diff =
True 255 g.planning_options.plan_only = kwargs[
"plan_only"]
257 g.planning_options.plan_only = self.
plan_only 260 g.planning_options.look_around =
False 261 g.planning_options.replan =
False 267 return self.
_action.get_result()
def setPlanningTime(self, time)
Set default planning time to be used for future planning request.
def moveToPose(self, pose_stamped, gripper_frame, tolerance=0.01, wait=True, kwargs)
Move the arm, based on a goal pose_stamped for the end effector.
def setPlannerId(self, planner_id)
Sets the planner_id used for all future planning requests.
def get_move_action(self)
def __init__(self, group, frame, listener=None, plan_only=False, move_group="move_group")
Constructor for this utility.
def moveToJointPosition(self, joints, positions, tolerance=0.01, wait=True, kwargs)
Move the arm to set of joint position goals.
Pure python interface to move_group action.