ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

set a joint contrainst on goal target

asked 2022-10-14 08:33:27 -0500

dev4all12358 gravatar image

updated 2022-10-15 07:49:47 -0500

Mike Scheutzow gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-10-15 07:33:11 -0500

Mike Scheutzow gravatar image

updated 2022-10-15 08:07:12 -0500

I have not used this feature myself, so I don't know for sure that it is actually implemented in moveit and ompl. But some preliminary investigation turned up a few things:

  • You are not setting all the fields of the JointConstraint message. I would expect joint_name and weight to be mandatory, as weight defaults to 0.0.

  • If the constraint is still not being applied, do a web search for the property enforce_joint_model_state_space for file ompl_planning.yaml. But setting this to true apparently has other negative side-effects.

  • Success may depend on which ompl planner you are using. Some planners may not support this constraint feature?

edit flag offensive delete link more

Comments

@Mike Scheutzow. Thank you for the answer. I will try what you advice me. I use MoveGroupCommander. Is there a way to know which planner I use and to set an other if needed?

dev4all12358 gravatar image dev4all12358  ( 2022-10-17 02:27:37 -0500 )edit

There is a method get_planner_id() in moveit_commander, but I don't remember if this just tells you that ompl subsystem is being used, or if it gives you the actual ompl planner name.

You might also check in your ompl_planning.yaml file for the property default_planner_config.

Please post a comment here if you get it working, and tell us what you did - there's very little discussion of using JointContraints, so it'd be helpful to the community.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-10-17 08:00:39 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-10-14 08:33:27 -0500

Seen: 47 times

Last updated: Oct 15 '22