set a joint contrainst on goal target
Hello,
I use Moveit on Franka ros. I try to set a Joint constrainst on goto goal. It seems the JointContrainst seems not to be used.
Here is the code I use:
def set_robot_joint_constrainst(self):
constraints = Constraints()
constraints.name = "Keep gripper horizontal"
current_joint = self.move_group.get_current_joint_values()
# Create an orientation constraint for the right gripper
jcm = JointConstraint()
jcm.position = 0.0;
jcm.tolerance_above = 0.3;
jcm.tolerance_below = -0.3;
joint_constraint_list = []
joint_constraint_list.append(jcm)
constraint_list = moveit_msgs.msg.Constraints()
constraint_list.name = 'test'
constraint_list.joint_constraints = joint_constraint_list
self.move_group.set_path_constraints(constraint_list)
And the code to generate pose target:
def set_robot_position(self, pose_info):
pose_goal = geometry_msgs.msg.Pose()
pose_goal.position.x = pose_info["position"][0]
pose_goal.position.y = pose_info["position"][1]
pose_goal.position.z = pose_info["position"][2]
pose_goal.orientation.x = pose_info["orientation"][0]
pose_goal.orientation.y = pose_info["orientation"][1]
pose_goal.orientation.z = pose_info["orientation"][2]
pose_goal.orientation.w = pose_info["orientation"][3]
self.move_group.set_start_state_to_current_state()
self.move_group.set_pose_target(pose_goal)
self.move_group.set_max_velocity_scaling_factor(0.2)
self.move_group.go(wait=True)
self.move_group.stop()
self.move_group.clear_pose_targets()
current_pose = self.move_group.get_current_pose().pose
I use a goto python function in MoveGroupCommander to set the targer ( position and orientation of the end effector). But in real the first joint is doing a strange move. This is the reason why I want to constraint it position between value.