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

Grasp a box with youbot

asked 2015-03-22 17:26:16 -0500

Gomes117 gravatar image

Hello

I am currently trying to grasp several small boxes with the youbot. I have set it up with MoveIt, but I cannot figure out how to give it valid a valid pose. I am not concerning myself with proper object recognition(via sensors), so I am trying to get the object position from Gazebo and give it to MoveIt to move the arm next to the box. Currently I am getting the position of the box using the GetModelState service call. But if I feed the pose it returns me to moveit it once again tells me that I have specified a wrong pose. Here is the code:

robot = moveit_commander.RobotCommander()
scene = moveit_commander.PlanningSceneInterface()       
arm = moveit_commander.MoveGroupCommander("arm")    
def listener():
    rospy.init_node('listener',anonymous=True)
    rospy.wait_for_service("/gazebo/get_model_state")
    try:
        gms = rospy.ServiceProxy("/gazebo/get_model_state",GetModelState)
        response = gms("box","youbot::arm_link_5")
        youbot_node.plan(response)
    except rospy.ServiceException, e:
        print "Service call failsed: %s"%e

def plan(targetPose):
    pose_target = geometry_msgs.msg.PoseStamped()
    pose_target.header.stamp = rospy.Time.now()
    pose_target.header.frame_id = "/odom"
    pose_target.pose = targetPose.pose
    print "============================="
    print pose_target
    arm.go(pose_target)

So any idea what I should do to move my arm to the proper position, and then grasp the box?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-03-23 02:04:41 -0500

Is MoveIt saying that the pose is invalid, or that it is unreachable? It may be that the way the axes of the box are defined results in the gripper trying to go to a crazy orientation which would result in the wrist colliding with the box or going outside its reachable region in some other way. You can experiment with this by setting the orientation of the pose to point directly away from the robot, for example. Then you can just debug the Cartesian position by itself rather than also trying to debug the orientation at the same time.

I would also suggest checking the coordinate frames you are working with. I suspect that /gazebo/get_model_state is returning some sort of global coordinate frame, but you probably want to define the MoveIt target in a frame fixed to the robot base. You can use the tf library to do this.

edit flag offensive delete link more

Comments

Sorry for the delay. I didn't have time to go back to ROS. Anyway the exact error is: moveit_commander.exception.MoveItCommanderException: Error setting joint target. Is IK running? Also about tf. How do I check which coordinate frame is gazebo returning and how to transform to odom?

Gomes117 gravatar image Gomes117  ( 2015-04-05 08:54:39 -0500 )edit
1

There are lots of different strategies, but when debugging transform frames I find that the tf plugin in rviz is helpful.

Morgan gravatar image Morgan  ( 2015-04-07 18:54:51 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-03-22 17:26:16 -0500

Seen: 583 times

Last updated: Mar 23 '15