本文整理匯總了Python中baxter_interface.Limb方法的典型用法代碼示例。如果您正苦於以下問題:Python baxter_interface.Limb方法的具體用法?Python baxter_interface.Limb怎麽用?Python baxter_interface.Limb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類baxter_interface
的用法示例。
在下文中一共展示了baxter_interface.Limb方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: limb_pose
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def limb_pose(limb_name):
"""Get limb pose at time of OK cuff button press."""
button = CuffOKButton(limb_name)
rate = rospy.Rate(20) # rate at which we check whether button was
# pressed or not
rospy.loginfo(
'Waiting for %s OK cuff button press to save pose' % limb_name)
while not button.pressed and not rospy.is_shutdown():
rate.sleep()
joint_pose = baxter_interface.Limb(limb_name).joint_angles()
# Now convert joint coordinates to end effector cartesian
# coordinates using forward kinematics.
kinematics = baxter_kinematics(limb_name)
endpoint_pose = kinematics.forward_position_kinematics(joint_pose)
# How is this different from
# baxter_interface.Limb(limb_name).endpoint_pose()
print()
print('baxter_interface endpoint pose:')
print(baxter_interface.Limb(limb_name).endpoint_pose())
print('pykdl forward kinematics endpoint pose:')
print(endpoint_pose)
print()
return endpoint_pose
示例2: __init__
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def __init__(self, limb_name, gripper=None):
super(Baxter, self).__init__(base='base')
self.limb_name = limb_name
self.other_limb_name = {'right': 'left',
'left': 'right'}[limb_name]
self.limb = baxter_interface.Limb(limb_name)
self.limb.set_joint_position_speed(0.1)
if gripper is None:
self.gripper = BaxterGripper(limb_name)
else:
self.gripper = gripper(limb_name)
# Enable actuators (doesn't seem to work?) I need to rosrun
# robot_enable.py -e
baxter_interface.RobotEnable().enable()
# Calibrate gripper
self.gripper.calibrate()
self.kinematics = baxter_kinematics(self.limb_name)
示例3: __init__
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def __init__(self, arm):
""" Initialize and start actionlib server. """
self.as_goal = {'left': baxterGoal(), 'right': baxterGoal()}
self.as_feed = {'left': baxterFeedback(), 'right': baxterFeedback()}
self.as_res = {'left': baxterResult(), 'right': baxterResult()}
self.action_server_left = actionlib.SimpleActionServer("baxter_action_server_left", baxterAction,
self.execute_left, auto_start=False)
self.action_server_right = actionlib.SimpleActionServer("baxter_action_server_right", baxterAction,
self.execute_right, auto_start=False)
self.left_arm = Limb('left')
self.right_arm = Limb('right')
self.left_gripper = Gripper('left')
self.right_gripper = Gripper('right')
self.left_gripper.calibrate()
self.arm = arm
示例4: __init__
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def __init__(self, limb_name, gripper=None):
self.limb_name = limb_name
self.limb = baxter_interface.Limb(limb_name)
if gripper is None:
self.gripper = baxter_interface.Gripper(limb_name)
else:
self.gripper = gripper(limb_name)
# Enable actuators (doesn't seem to work?) I need to rosrun
# robot_enable.py -e
baxter_interface.RobotEnable().enable()
# Calibrate gripper
self.gripper.calibrate()
示例5: limb_pose
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def limb_pose(limb_name):
button = CuffOKButton(limb_name)
rate = rospy.Rate(20)
joint_pose = baxter_interface.Limb(limb_name).joint_angles()
kinematics = baxter_kinematics(limb_name)
endpoint_pose = kinematics.forward_position_kinematics(joint_pose)
return endpoint_pose
示例6: __init__
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def __init__(self, limb_name, gripper=None):
self.limb_name = limb_name
self.limb = baxter_interface.Limb(limb_name)
if gripper is None:
self.gripper = baxter_interface.Gripper(limb_name)
else:
self.gripper = gripper(limb_name)
baxter_interface.RobotEnable().enable()
示例7: map_keyboardL
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def map_keyboardL(self):
rs = baxter_interface.RobotEnable(CHECK_VERSION)
init_state = rs.state().enabled
limb_0 = baxter_interface.Gripper(self.limb_name, CHECK_VERSION)
#baxter_interface.Limb(limb_name).set_joint_position_speed(0.7)
self.move((0,1,0),0.01)
示例8: limb_pose
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def limb_pose(limb_name):
"""Get limb pose at time of OK cuff button press."""
button = CuffOKButton(limb_name)
rate = rospy.Rate(20) # rate at which we check whether button was
# pressed or not
rospy.loginfo(
'Waiting for %s OK cuff button press to save pose' % limb_name)
while not button.pressed and not rospy.is_shutdown():
rate.sleep()
joint_pose = baxter_interface.Limb(limb_name).joint_angles()
# Now convert joint coordinates to end effector cartesian
# coordinates using forward kinematics.
kinematics = baxter_kinematics(limb_name)
endpoint_pose = kinematics.forward_position_kinematics(joint_pose)
return endpoint_pose
開發者ID:correlllab,項目名稱:cu-perception-manipulation-stack,代碼行數:17,代碼來源:demo_vision_poseest_pickplace.py
示例9: __init__
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def __init__(self, P=1/30000):
self.limb_name = 'left'
self.other_limb_name = 'right'
self.limb = baxter_interface.Limb(self.limb_name)
self.err_pub = rospy.Publisher('/error', Float64, queue_size=1)
self.P = P
self.kinematics = baxter_kinematics(self.limb_name)
self.jinv = self.kinematics.jacobian_pseudo_inverse()
示例10: __init__
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def __init__(self, limb, reconfig_server):
self._dyn = reconfig_server
self.movearm = []
# control parameters
self._rate = 1000.0 # Hz
self._missed_cmds = 20.0 # Missed cycles before triggering timeout
# create our limb instance
self._limb = baxter_interface.Limb(limb)
# initialize parameters
self._springs = dict()
self._damping = dict()
self._start_angles = dict()
self.left_joint_names = []
self.i = 1
self.joint_names = []
self.sum_sqr_error = 0
# create cuff disable publisher
cuff_ns = 'robot/limb/' + limb + '/suppress_cuff_interaction'
self._pub_cuff_disable = rospy.Publisher(cuff_ns, Empty, queue_size=1)
# verify robot is enabled
print("Getting robot state... ")
self._rs = baxter_interface.RobotEnable(CHECK_VERSION)
self._init_state = self._rs.state().enabled
print("Enabling robot... ")
self._rs.enable()
print("Running. Ctrl-c to quit")
示例11: limb_pose
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def limb_pose(limb_name):
"""Get limb pose at time of OK cuff button press.
The returned pose matches """
button = CuffOKButton(limb_name)
rate = rospy.Rate(20) # rate at which we check whether button was
# pressed or not
rospy.loginfo(
'Waiting for %s OK cuff button press to save pose' % limb_name)
while not button.pressed and not rospy.is_shutdown():
rate.sleep()
endpoint_pose = baxter_interface.Limb(limb_name).endpoint_pose()
pose_list = ([getattr(endpoint_pose['position'], i) for i in
('x', 'y', 'z')] +
[getattr(endpoint_pose['orientation'], i) for i in
('x', 'y', 'z', 'w')])
return pose_list
# How is
# baxter_kinematics(limb_name).forward_position_kinematics(
# baxter_interface.Limb(limb_name).joint_angles())
# different from
# baxter_interface.Limb(limb_name).endpoint_pose()
# After some testing, we find that the differences are
# negligible. In rviz, pretty much the same. In numerical terms,
# they agree to at least two significant figures.
# Eg:
"""
baxter_interface endpoint pose:
{'position': Point(x=0.8175678653720638,
y=0.11419185934519176,
z=-0.18813767395654984),
'orientation': Quaternion(x=0.9983899777382322,
y=-0.008582355126430147,
z=0.051452248110337225,
w=-0.022281420437849815)}
pykdl forward kinematics endpoint pose:
[ 0.81954073 0.11447536 -0.18811824
0.9983032 -0.00843487 0.0532936 -0.02189443]"""
示例12: __init__
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def __init__(self):
"""Initialize and start actionlib client."""
self.left_client = actionlib.SimpleActionClient("baxter_action_server_left", baxterAction)
self.left_client.wait_for_server(rospy.Duration(10.0))
self.listener = tf.TransformListener()
self.left_arm = Limb('left')
# Get ROS parameters set up from launch file
self.left_rod_offset = rospy.get_param('~left_rod')
self.right_rod_offset = rospy.get_param('~right_rod')
self.center_rod_offset = rospy.get_param('~center_rod')
示例13: __init__
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def __init__(self, arm):
# initialise arm communication channel
if arm == "right":
self.pub = rospy.Publisher('arm_rendezvous_right', String, queue_size=5)
self.sub = rospy.Subscriber('arm_rendezvous_left', String, self.store_sub)
self.RZsub = rospy.Subscriber('rendezvous_point', String, self.store_RZsub) #Right listens for RZ point
elif arm == "left":
self.pub = rospy.Publisher('arm_rendezvous_left', String, queue_size=5)
self.sub = rospy.Subscriber('arm_rendezvous_right', String, self.store_sub)
self.RZpub = rospy.Publisher('rendezvous_point', String, queue_size=5) #Left sends the RZ point
else:
print "ERROR - initialisation - no valid arm selected"
return
print "Rendezvous Channel Initialised"
self.state = 0 #Initial State
self.sub_data = 0 #Initial State
self.RZ = ""
# initialise ros node
self.rate = rospy.Rate(5) #5hz when continuously sending
# gripper ("left" or "right")
self.gripper = baxter_interface.Gripper(arm)
# arm ("left" or "right")
self.limb = arm
self.limb_interface = baxter_interface.Limb(self.limb)
示例14: main
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def main():
rospy.init_node('execute')
rs = baxter_interface.RobotEnable(CHECK_VERSION)
rs.enable()
arm = baxter_interface.Limb('left')
gripper = baxter_interface.Gripper('left')
gripper.calibrate()
def open_grippers(msg):
if msg.state == DigitalIOState.PRESSED:
gripper.open()
rospy.Subscriber('/robot/digital_io/left_upper_button/state', DigitalIOState, open_grippers)
# target position
target_x = 0.7
target_y = 0.3
initial_z = 0.1
target_z = -0.17
target_theta = np.pi / 4
planar_grasp(arm, gripper, target_x, target_y, initial_z, target_z, target_theta)
rospy.spin()
print 'executed trajectory'
return 0
示例15: arm_goaway
# 需要導入模塊: import baxter_interface [as 別名]
# 或者: from baxter_interface import Limb [as 別名]
def arm_goaway():
left2_w0 = rospy.get_param('left2_w0', default=0)
left2_w1 = rospy.get_param('left2_w1', default=0)
left2_w2 = rospy.get_param('left2_w2', default=0)
left2_e0 = rospy.get_param('left2_e0', default=0)
left2_e1 = rospy.get_param('left2_e1', default=0)
left2_s0 = rospy.get_param('left2_s0', default=0)
left2_s1 = rospy.get_param('left2_s1', default=0)
# Send the left arm to the desired position
away = {'left_w0': left2_w0, 'left_w1': left2_w1, 'left_w2': left2_w2, 'left_e0': left2_e0, 'left_e1': left2_e1,
'left_s0': left2_s0, 'left_s1': left2_s1}
limb = baxter_interface.Limb('left')
limb.move_to_joint_positions(away)