本文整理匯總了Python中baxter_interface.Gripper.command_position方法的典型用法代碼示例。如果您正苦於以下問題:Python Gripper.command_position方法的具體用法?Python Gripper.command_position怎麽用?Python Gripper.command_position使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類baxter_interface.Gripper
的用法示例。
在下文中一共展示了Gripper.command_position方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: serve
# 需要導入模塊: from baxter_interface import Gripper [as 別名]
# 或者: from baxter_interface.Gripper import command_position [as 別名]
def serve():
tf_listener = tf.TransformListener()
robot = moveit_commander.RobotCommander()
scene = moveit_commander.PlanningSceneInterface()
gripper_left = Gripper("left")
gripper_right = Gripper("right")
group_left = moveit_commander.MoveGroupCommander("left_arm")
group_right = moveit_commander.MoveGroupCommander("right_arm")
group_left.set_planner_id('RRTConnectkConfigDefault')
group_right.set_planner_id('RRTConnectkConfigDefault')
# parameters
press_faucet = True
place_cup = False
gripper_position_threshold = 4.6
# clean the scene
scene.remove_world_object()
# forward kinematic object
kin = baxter_kinematics('left')
rospy.loginfo("Time to kill the process")
start_time = rospy.get_time()
while (rospy.get_time() - start_time < 1.0):
if rospy.is_shutdown():
no_detection = True
press_faucet = False
break
joint_states = {
'observe_r':
[-0.7255729118408204,
-0.4893398707763672,
0.022626216595458985,
1.9788352141113283,
-1.549704089190674,
-1.5301458341674805,
-0.016106798254394532],
'observe_l':
[0.7255729118408204,
-0.4893398707763672,
0.022626216595458985,
1.9788352141113283,
1.549704089190674,
-1.5301458341674805,
-0.016106798254394532]
}
if place_cup:
group_left.set_joint_value_target(joint_states['observe_l'])
plan_valid = False
while not rospy.is_shutdown() and not plan_valid:
plan = group_left.plan()
plan_valid = plan_validate(plan, 100,100,100)
print plan_valid
group_left.execute(plan)
# step 1
pose1 = Pose()
pose1.position.x = 0.551
pose1.position.y = 0.615
pose1.position.z = -0.0728
pose1.orientation.x = -0.0140
pose1.orientation.y = 0.866
pose1.orientation.z = -0.0272
pose1.orientation.w = 0.499
# execute_valid_plan(group_left, pose1)
# print group_left.get_current_joint_values()
group_left.set_joint_value_target([0.08283496245117188, -0.26192721923217777, 0.0609757362487793, 1.7851701398620607, 0.9625729432983399, -1.0622816943969726, -0.14841264105834961])
rospy.sleep(1)
plan_valid = False
while not rospy.is_shutdown() and not plan_valid:
plan = group_left.plan()
plan_valid = plan_validate(plan, 100,100,100)
print plan_valid
group_left.execute(plan)
# step 2
pose2 = get_pose_with_sleep(group_left)
pose2.pose.position.x+= 0.15
plan = plan_with_orientation_lock(group_left, pose2)
group_left.execute(plan)
gripper_left.command_position(40)
# step 3
rospy.sleep(1)
#.........這裏部分代碼省略.........