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


Python Limb.set_joint_positions方法代碼示例

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


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

示例1: set_joints

# 需要導入模塊: from baxter_interface import Limb [as 別名]
# 或者: from baxter_interface.Limb import set_joint_positions [as 別名]
def set_joints( target_angles_right, target_angles_left):

    right = Limb("right")
    left = Limb("left")
    
    reach_right = False
    reach_left = False
    

    while not reach_right or not reach_left:

            right.set_joint_positions(target_angles_right)
            left.set_joint_positions(target_angles_left)
            current_angles_right = right.joint_angles()
            current_angles_left = left.joint_angles()

            

            for k, v in current_angles_right.iteritems():
                if abs(target_angles_right[k] - v) > 0.01:
                    reach_right = False
                    break
                reach_right = True

            for k, v in current_angles_left.iteritems():
                if abs(target_angles_left[k] - v) > 0.01:
                    reach_left = False
                    break
                reach_left = True
開發者ID:YZHANGFPE,項目名稱:test,代碼行數:31,代碼來源:MD_pour.py

示例2: set_joints

# 需要導入模塊: from baxter_interface import Limb [as 別名]
# 或者: from baxter_interface.Limb import set_joint_positions [as 別名]
def set_joints( target_angles_right = None, target_angles_left = None,timeout= 40000):

    right = Limb("right")
    left = Limb("left")
    
    if target_angles_right == None:
        reach_right = True
    else:
        reach_right = False
    

    if target_angles_left == None:
        reach_left = True
    else:
        reach_left = False
    
    time = 0

    while not reach_right or not reach_left:

            if target_angles_right: right.set_joint_positions(target_angles_right)
            if target_angles_left: left.set_joint_positions(target_angles_left)
            current_angles_right = right.joint_angles()
            current_angles_left = left.joint_angles()

            
            if reach_right == False:
                for k, v in current_angles_right.iteritems():
                    if abs(target_angles_right[k] - v) > 0.01:
                        reach_right = False
                        break
                    reach_right = True

            if reach_left == False:
                for k, v in current_angles_left.iteritems():
                    if abs(target_angles_left[k] - v) > 0.01:
                        reach_left = False
                        break
                    reach_left = True

            time+=1
            if time > timeout:
                print "Time out"
                break
開發者ID:YZHANGFPE,項目名稱:pick_challenge,代碼行數:46,代碼來源:MarchVideo.py

示例3: Header

# 需要導入模塊: from baxter_interface import Limb [as 別名]
# 或者: from baxter_interface.Limb import set_joint_positions [as 別名]
    hdr = Header(stamp=rospy.Time.now(), frame_id='base')
    ikreq.pose_stamp.append(pose)

    try:
        rospy.wait_for_service(ns, 5.0)
        resp = iksvc(ikreq)
    except (rospy.ServiceException, rospy.ROSException), e:
        rospy.logerr("Service call failed: %s" % (e,))
        return 0

    if (resp.isValid[0]):
        #print("SUCCESS - Valid Joint Solution Found:")
        # Format solution into Limb API-compatible dictionary
        limb_joints = dict(zip(resp.joints[0].name, resp.joints[0].position))
        arm = Limb("right")
        arm.set_joint_positions(limb_joints)
        return 1
        #rospy.sleep(0.05)

    else:
        print("INVALID POSE - No Valid Joint Solution Found.")
        return 0

def ik_pykdl(arm, kin, pose, arm_position = 'right'):
    position = pose.pose.position
    orientation = pose.pose.orientation
    pos = [position.x,position.y,position.z]
    rot = [orientation.x,orientation.y,orientation.z,orientation.w]
    joint_angles = kin.inverse_kinematics(pos,rot)
    if joint_angles:
        if arm_position == 'right':
開發者ID:YZHANGFPE,項目名稱:pick_challenge,代碼行數:33,代碼來源:MarchVideo.py


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