group.set_pose_target(pose_goal) function of move_group_python_interface

asked 2022-06-20 06:14:18 -0500

onkheisen gravatar image

updated 2022-06-20 09:57:31 -0500

I am trying the used the script of move_group_python_interface in order to work with my robot on Rviz, I want to set one coordinate of the space, and let this program calculate de inverse kinematic and simulate the action. I am working with Ubuntu 16.04, and moveit kinetic.

I added some flags in order to know how were the functions working, and group.set_pose_target(pose_goal) is not receiving anything

def go_to_pose_goal(self):

group = self.group

## BEGIN_SUB_TUTORIAL plan_to_pose
##
## Planning to a Pose Goal
## ^^^^^^^^^^^^^^^^^^^^^^^
## We can plan a motion for this group to a desired pose for the
## end-effector:

pose_goal = geometry_msgs.msg.Pose()
pose_goal.orientation.w = 1.0
pose_goal.position.x = 0.0
pose_goal.position.y = 0.0
pose_goal.position.z = 0.4

print group

group.set_pose_target(pose_goal)
print 'goal:', group.set_pose_target(pose_goal)

## Now, we call the planner to compute the plan and execute it.
plan = group.go(wait=True)
# Calling `stop()` ensures that there is no residual movement
print 'end plan'
group.stop()
# It is always good to clear your targets after planning with poses.
# Note: there is no equivalent function for clear_joint_value_targets()
group.clear_pose_targets()

current_pose = self.group.get_current_pose().pose
return all_close(pose_goal, current_pose, 0.01)

Being the definition of such function in /opt/ros/kinetic/lib/python2.7/dist-packages/moveit_commander/move_group.py

def set_pose_target(self, pose, end_effector_link = ""):
    """ Set the pose of the end-effector, if one is available. The expected input is a Pose message, a PoseStamped message or a list of 6 floats:"""
    """ [x, y, z, rot_x, rot_y, rot_z] or a list of 7 floats [x, y, z, qx, qy, qz, qw] """
    if len(end_effector_link) > 0 or self.has_end_effector_link():
        ok = False
        if type(pose) is PoseStamped:
            old = self.get_pose_reference_frame()
            self.set_pose_reference_frame(pose.header.frame_id)
            ok = self._g.set_pose_target(conversions.pose_to_list(pose.pose), end_effector_link)
            self.set_pose_reference_frame(old)
        elif type(pose) is Pose:
            ok = self._g.set_pose_target(conversions.pose_to_list(pose), end_effector_link)
        else:
            ok = self._g.set_pose_target(pose, end_effector_link)
        if not ok:
            raise MoveItCommanderException("Unable to set target pose")
    else:
        raise MoveItCommanderException("There is no end effector to set the pose for")

This is the out put on this node

<moveit_commander.move_group.MoveGroupCommander object at 0x7f85c68ce8d0>
position: 
x: 0.0
y: 0.0
z: 0.4
orientation: 
x: 0.0
y: 0.0
z: 0.0
w: 1.0

goal: None

[ INFO] [1655721419.146981797]: ABORTED: No motion plan found. No execution attempted.

end plan

And this one from moveit

[ INFO] [1655722886.275088188]: Combined planning and execution request received for MoveGroup action. 
[ INFO] [1655736882.674869844]: Combined planning and execution request received for MoveGroup action. Forwarding to planning and execution pipeline.
[ INFO] [1655736882.674976924]: Planning attempt 1 of at most 1
[ INFO] [1655736882.675475250]: Planner configuration 'arm' will use planner 'geometric::RRTConnect'. Additional configuration parameters will be set when the planner is constructed.
[ INFO] [1655736882.675695796]: RRTConnect: Starting planning with 1 states already in datastructure
[ INFO] [1655736887.677958969]: RRTConnect: Created 1 states (1 start + 0 goal)
[ INFO] [1655736887.677981304]: No solution found after 5.002348 seconds
[ INFO] [1655736887.693141362]: Unable to solve the ...
(more)
edit retag flag offensive close merge delete