Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:tutorials:python-interface-cart-goals [2019/01/02 19:32]
kevin created
wiki:tutorials:python-interface-cart-goals [2019/09/20 14:14] (current)
simon
Line 1: Line 1:
-This tutorial explains how you can solve cartesian goals with Giskard using the python Interface. +=====Sending Cartesian Goals===== 
- +The GiskardWrapper class has a method called ​''​set_cart_goal(root_link,​ tip_link, position)'' ​to set cartesian goals. The first argument specifies the root and the second argument the tip of the kinematic chain that will be used to solve this goal. The third argument is a ''​PoseStamped'' ​that describes the goal position of the tip link. Below is a small code example, where a goal is set for both hands at the same time.
-The GiskardWrapper class has a method called ​//set_cart_goal("root_link""tip_link", position)// to set cartesian goals. The first argument specifies the root and the second argument the tip of the kinematic chain that will be used to solve this goal. The third argument is a //PoseStamped// that describes the goal position of the tip link. Below is a small code example.+
  
 <code python> <code python>
 import rospy import rospy
 from giskardpy.python_interface import GiskardWrapper from giskardpy.python_interface import GiskardWrapper
-from geometry_msgs.msg import PoseStamped+from geometry_msgs.msg import PoseStamped, Point, Quaternion
  
 # init ros node # init ros node
 rospy.init_node(u'​test'​) rospy.init_node(u'​test'​)
 +giskard_wrapper = GiskardWrapper()
  
-create ​PoseStamped that describes the goal position +Create ​a goal for the right hand 
-= PoseStamped() +root = u'​base_link'​ 
-p.header.frame_id = u'map+r_goal ​= PoseStamped() 
-p.header.stamp = rospy.get_rostime() +r_goal.header.frame_id = 'r_gripper_tool_frame
-p.pose.position.x = 0.4 +r_goal.header.stamp = rospy.get_rostime() 
-p.pose.position.y ​= 0.+r_goal.pose.position = Point(-0.1, 0, 0) 
-p.pose.position.z 1.0 +r_goal.pose.orientation ​Quaternion(0, 0, 0, 1) 
-p.pose.orientation.w = 1+giskard_wrapper.set_cart_goal(root,​ '​r_gripper_tool_frame',​ r_goal) 
 + 
 +# Create a goal for the left hand 
 +l_goal = PoseStamped() 
 +l_goal.header.frame_id = '​l_gripper_tool_frame'​ 
 +l_goal.header.stamp = rospy.get_rostime() 
 +l_goal.pose.position = Point(-0.05, 0, 0) 
 +l_goal.pose.orientation = Quaternion(0,​ 0, 0, 1
 +giskard_wrapper.set_cart_goal(root,​ '​l_gripper_tool_frame',​ l_goal)
  
-# create a GiskardWrapper object and execute the cartesian goal 
-giskard_wrapper = GiskardWrapper() 
-giskard_wrapper.set_cart_goal(u'​base_link',​ u'​l_gripper_tool_frame',​ p) 
 giskard_wrapper.plan_and_execute() giskard_wrapper.plan_and_execute()
 </​code>​ </​code>​