當前位置: 首頁>>代碼示例>>Python>>正文


Python Limb.endpoint_pose方法代碼示例

本文整理匯總了Python中baxter_interface.Limb.endpoint_pose方法的典型用法代碼示例。如果您正苦於以下問題:Python Limb.endpoint_pose方法的具體用法?Python Limb.endpoint_pose怎麽用?Python Limb.endpoint_pose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在baxter_interface.Limb的用法示例。


在下文中一共展示了Limb.endpoint_pose方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: endpoint_pose

# 需要導入模塊: from baxter_interface import Limb [as 別名]
# 或者: from baxter_interface.Limb import endpoint_pose [as 別名]
 def endpoint_pose(self):
     """
     Returns the pose of the end effector
     :return: [[x, y, z], [x, y, z, w]]
     """
     pose = Limb.endpoint_pose(self)
     return [[pose['position'].x, pose['position'].y, pose['position'].z],
             [pose['orientation'].x, pose['orientation'].y, pose['orientation'].z, pose['orientation'].w]]
開發者ID:baxter-flowers,項目名稱:baxter_commander,代碼行數:10,代碼來源:commander.py

示例2: ik

# 需要導入模塊: from baxter_interface import Limb [as 別名]
# 或者: from baxter_interface.Limb import endpoint_pose [as 別名]
    
    tracker.busy = True
    

    done = False
    ik()
    
    #print("Controlling joints. Press ? for help, Esc to quit.")
    while not done and not rospy.is_shutdown():
        c = baxter_external_devices.getch()
        tracker.track()
        if tracker.busy == False:
            tracker.gripper.close()
            rospy.sleep(0.5)
            arm = Limb("right")
            ep_position = arm.endpoint_pose()['position']
            ep_orientation = arm.endpoint_pose()['orientation']
            place(right,ep_position,ep_orientation,pr,pr_place)
            tracker.gripper.open()
            rospy.sleep(0.5)
            pr_place.position.y += 0.2
            move(right,pr_place)
            #move(right,pr_init)
            print "I am done"
            done = True
        
        if c:
            #catch Esc or ctrl-c
            if c in ['\x1b', '\x03']:
                done = True
                print ("Program finished")
開發者ID:YZHANGFPE,項目名稱:pick_challenge,代碼行數:33,代碼來源:pick_client.py

示例3: IKHelper

# 需要導入模塊: from baxter_interface import Limb [as 別名]
# 或者: from baxter_interface.Limb import endpoint_pose [as 別名]
class IKHelper(object):
    """An abstraction layer for using Baxter's built in IK service."""

    ############################################################################

    def __init__(self):
        self._left_arm = Limb('left')
        self._left_arm.set_joint_position_speed(0.3)
        self._right_arm = Limb('right')
        self._right_arm.set_joint_position_speed(0.3)

        self._left_iksvc = rospy.ServiceProxy(
            _IKSVC_LEFT_URI,
            SolvePositionIK)

        self._right_iksvc = rospy.ServiceProxy(
            _IKSVC_RIGHT_URI,
            SolvePositionIK)

        self._joint_update_pub = rospy.Publisher(
            '/robot/joint_state_publish_rate', 
            UInt16)
        self._joint_update_pub.publish(250)

    ############################################################################

    def reset(self):
        """Reset both arms to their neutral positions."""   
    	self._left_arm.move_to_neutral()
        self._right_arm.move_to_neutral()

    def set_left(self, pos, rot=(0, math.pi, math.pi *0.5), wait=False):
        """Set the endpoint of the left arm to the supplied coordinates.

        Arguments:
            pos -- Position in space in (x, y, z) format.
            rot -- Rotation in space in (r, p, y) format. (defaults to pointing
                downwards.)

        Keyword arguments:
            wait -- If True, method will block until in position. (default 
                False)
        """
        self._set_arm(self._left_iksvc, self._left_arm, pos, rot, wait)

    def set_left(self, pos, rot=(0, math.pi, math.pi *0.5), wait=False):
        """Set the endpoint of the right arm to the supplied coordinates.

        Arguments:
            pos -- Position in space in (x, y, z) format.
            rot -- Rotation in space in (r, p, y) format. (defaults to pointing
                downwards.)

        Keyword arguments:
            wait -- If True, method will block until in position. (default 
                False)
        """
        self._set_arm(self._right_iksvc, self._right_arm, pos, rot, wait)

    def get_left(self):
        """Return the current endpoint pose of the left arm."""
        return self._left_arm.endpoint_pose()['position']
    
    def get_right(self):
        """Return the current endpoint pose of the left arm."""
        return self._right_arm.endpoint_pose()['position']

    def get_left_velocity(self):
        """Return the current endpoint velocity of the left arm."""
        return self._left_arm.endpoint_velocity()['linear']

    def get_right_velocity(self):
        """Return the current endpoint velocity of the right arm."""
        return self._right_arm.endpoint_velocity()['linear']

    def get_left_force(self):
        """Return the current endpoint force on the left arm."""
        return self._left_arm.endpoint_effort()['force']

    def get_right_force(self):
        """Return the current endpoint force on the right arm."""
        return self._right_arm.endpoint_effort()['force']

    ############################################################################

    def _set_arm(self, iksvc, limb, pos, rot, wait):
        resp = self._get_ik(iksvc, pos, rot)
        positions = resp[0]
        isValid = resp[1]
        if not isValid:
            print('invalid: {0} {1} {2}'.format(x, y, z))

        if not wait:
            limb.set_joint_positions(positions)
        else:
            limb.move_to_joint_positions(positions)

    def _get_ik(self, iksvc, pos, rot):
        q = quaternion_from_euler(rot[0], rot[1], rot[2])

#.........這裏部分代碼省略.........
開發者ID:Knifa,項目名稱:Glasgow-Baxter,代碼行數:103,代碼來源:baxter_ikhelper.py


注:本文中的baxter_interface.Limb.endpoint_pose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。