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


Python Limb.joint_angles方法代碼示例

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


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

示例1: set_joints

# 需要導入模塊: from baxter_interface import Limb [as 別名]
# 或者: from baxter_interface.Limb import joint_angles [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 joint_angles [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: Baxter_Deli

# 需要導入模塊: from baxter_interface import Limb [as 別名]
# 或者: from baxter_interface.Limb import joint_angles [as 別名]
class Baxter_Deli(object):
	
	def __init__(self):
		
		self.rightg = Gripper('right')
		self.rightg.set_holding_force(100)
		self.leftg = Gripper('left')
		self.right = Limb('right')
		self.left = Limb('left')
		self.head = Head()

		self.angles= list()

		
		rospy.Subscriber("command", String, self.command)
		rospy.spin()

	def command(self, comm):
		if comm.data == "left":
			self.angles.append(self.left.joint_angles())
		elif comm.data == "right":
			self.angles.append(self.right.joint_angles())
		elif comm.data == "done":
			print self.angles
開發者ID:aashi7,項目名稱:baxter_deli,代碼行數:26,代碼來源:joints_logger.py

示例4: Mimic

# 需要導入模塊: from baxter_interface import Limb [as 別名]
# 或者: from baxter_interface.Limb import joint_angles [as 別名]
class Mimic(object):
    IKSVC_LEFT_URI = 'ExternalTools/left/PositionKinematicsNode/IKService'
    IKSVC_RIGHT_URI = 'ExternalTools/right/PositionKinematicsNode/IKService'

    def __init__(self):
        self._tf = tf.TransformListener()
        self._rs = RobotEnable()

        self._left_arm = Limb('left')
        self._left_arm.set_joint_position_speed(0.5)
        self._right_arm = Limb('right')
        self._right_arm.set_joint_position_speed(0.5)

        self._left_arm_neutral = None
        self._right_arm_neutral = None

        self._left_iksvc = rospy.ServiceProxy(
            Mimic.IKSVC_LEFT_URI,
            SolvePositionIK)

        self._right_iksvc = rospy.ServiceProxy(
            Mimic.IKSVC_RIGHT_URI,
            SolvePositionIK)

        self._left_camera = CameraController('left_hand_camera')
        self._right_camera = CameraController('right_hand_camera')
        self._head_camera = CameraController('head_camera')

        self._left_camera.close()
        self._right_camera.close()
        self._head_camera.close()

        self._head_camera.resolution = CameraController.MODES[0]
        self._head_camera.open()

        self._head_camera_sub = rospy.Subscriber('/cameras/head_camera/image', Image,
            self._head_camera_sub_callback)
        self._xdisplay_pub = rospy.Publisher('/robot/xdisplay', Image, latch=True)

        self._out_of_range = False

        self._ik_smooth = 4
        self._ik_rate = 200
        self._avg_window = 1000

        self._r_trans_prev = []
        self._l_trans_prev = []

        self._r_ik_prev = []
        self._l_ik_prev = []

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

        self._mimic_timer = None
    
    ############################################################################

    def start(self):
        self._rs.enable()
        self._reset()

        self._mimic_timer = rospy.Timer(rospy.Duration(1.0 / self._ik_rate), self._mimic_callback)
        rate = rospy.Rate(self._avg_window)

        while not rospy.is_shutdown():
            try:
                (r_trans,r_rot) = self._tf.lookupTransform(
                    '/skeleton/user_1/right_hand', 
                    '/skeleton/user_1/torso', 
                    rospy.Time(0))

                (l_trans,l_rot) = self._tf.lookupTransform(
                    '/skeleton/user_1/left_hand', 
                    '/skeleton/user_1/torso', 
                    rospy.Time(0))

                self._l_trans_prev.append(l_trans)
                if (len(self._l_trans_prev) > self._avg_window):
                    self._l_trans_prev.pop(0)
                    
                self._r_trans_prev.append(r_trans)
                if (len(self._r_trans_prev) > self._avg_window):
                    self._r_trans_prev.pop(0)
                    
            except:
                self._out_of_range = True
                rate.sleep()
                continue
            
            rate.sleep()

    def _reset(self):
        if self._mimic_timer:
            self._mimic_timer.shutdown()

        self._left_arm.move_to_neutral()
        self._left_arm_neutral = self._left_arm.joint_angles()

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


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