本文整理汇总了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
示例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
示例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
示例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()
#.........这里部分代码省略.........