本文整理汇总了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
示例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
示例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':