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

How to Set Goal Pose for MoveGroupCommander?

asked 2014-01-19 14:52:55 -0500

daalt gravatar image

updated 2014-01-28 17:19:05 -0500

ngrennan gravatar image

I'm trying to set a planning goal for MoveIt! but I keep getting an "Unable to sample any valid states for goal tree" error. My Python code is shown below. Anything wrong with this?

group = MoveGroupCommander("robot_arm_group")
group.allow_replanning(True)

#set start state
group.set_start_state_to_current_state()

#set goal state
target_pose = PoseStamped()
target_pose.header.frame_id = 'base_link' 
target_pose.header.stamp = rospy.Time.now() 
target_pose.pose.position.x = 1.3 
target_pose.pose.position.y = 0.4
target_pose.pose.position.z = 0.6
target_pose.pose.orientation.x = 0.0 
target_pose.pose.orientation.y = 0.0 
target_pose.pose.orientation.z = 0.0 
target_pose.pose.orientation.w = 1.0 

group.set_pose_target(target_pose, end_effector_link="forearm")

group.go()
edit retag flag offensive close merge delete

Comments

Which tipe of robot are you using? This may be a units issue, x position is 1.3 meters?

E1000ii gravatar image E1000ii  ( 2014-05-13 04:01:22 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2014-05-13 04:14:03 -0500

E1000ii gravatar image

From your code what i thing its happening is that when you execute go() the pose is not estored. I can not remeber well now. But i thing a i faced this issue in the past. So here is something you can test. you can invoke group.go(targe_pose). That worked for me. And in orther to see if youre specifying invalid poses I recoment you to start the target_pose with group.get_current_pose()

And start playing from ther to see if making little modifications to this pose the robot moves.

tpose = group.get_current_pose()
print type(tpose)
print tpose
#modify pose
tpose.pose.position.z = z #<put here z> 
tpose.pose.position.x = x #<put here new x>
tpose.pose.position.y = y #<put here new y>
#plan and execute
group.go(tpose,wait = True)

If after running the go you get the same error it's probable that you are specifying a pose that is not possible due to robots limits (may be orientation or joints limits)

edit flag offensive delete link more

Comments

lol this problem took me hours... thank you ! damn documentation

PizzaTime gravatar image PizzaTime  ( 2016-03-28 18:20:07 -0500 )edit

This solution saved me ! after trying for somany days. THANK YOU.

Buldoza gravatar image Buldoza  ( 2019-02-01 11:40:44 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2014-01-19 14:52:55 -0500

Seen: 2,301 times

Last updated: May 13 '14