当前位置: 首页>>代码示例>>Python>>正文


Python GripUtils.open_grippers方法代码示例

本文整理汇总了Python中pr2_simple_arm_motions.GripUtils.open_grippers方法的典型用法代码示例。如果您正苦于以下问题:Python GripUtils.open_grippers方法的具体用法?Python GripUtils.open_grippers怎么用?Python GripUtils.open_grippers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pr2_simple_arm_motions.GripUtils的用法示例。


在下文中一共展示了GripUtils.open_grippers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: table1ToTable2

# 需要导入模块: from pr2_simple_arm_motions import GripUtils [as 别名]
# 或者: from pr2_simple_arm_motions.GripUtils import open_grippers [as 别名]
def table1ToTable2(width):
	global numStacked
	GripUtils.go_to_relative_multi(0, 0, 0.2, True, 0, 0, 0.2, True, "base_footprint", None)
	goFromAToB("Table1", "Table2")
	GripUtils.go_to_relative_multi(0, 0, -0.2+0.02*numStacked, True, 0, 0, -0.2+0.02*numStacked, True, "base_footprint", None)
	numStacked += 1
	GripUtils.open_grippers()
开发者ID:rgleichman,项目名称:berkeley_demos,代码行数:9,代码来源:hackathon_demo_navigation.py

示例2: executeDrag

# 需要导入模块: from pr2_simple_arm_motions import GripUtils [as 别名]
# 或者: from pr2_simple_arm_motions.GripUtils import open_grippers [as 别名]
    def executeDrag(self,gripPts,endPts,color='blue'):
        """
        drag from gripPts to endPts
        """          
        startpoints = []
        for vertex in gripPts:
            pt_world = self.convert_to_world_frame(vertex)
            now = rospy.Time.now()
            self.listener.waitForTransform("base_footprint",pt_world.header.frame_id,now,rospy.Duration(10.0))            
            pt_transformed = self.listener.transformPoint("base_footprint",pt_world)                        
            startpoints.append(pt_transformed)

        

        #print "grabbed (x,y,z)",startpoints[0].point.x,startpoints[0].point.y,startpoints[0].point.z
        

        if not GripUtils.grab_points(point_l=startpoints[0],roll_l=-pi/2,yaw_l=-pi/3,pitch_l=pi/4,x_offset_l=-0.01, z_offset_l=0.005,approach= True,
                                     point_r=startpoints[1],roll_r=pi/2,yaw_r= pi/3,pitch_r=pi/4,x_offset_r=-0.01, z_offset_r=0.005):
            print "failure"
            return False
        else:
            print "grabbed (x,y,z)",startpoints[0].point.x,startpoints[0].point.y,startpoints[0].point.z
            print "done"

        midpoints = []
        for vertex in endPts:
            pt_world = self.dupl_PointStamped(vertex)#self.convert_to_world_frame(vertex)            
            midpoints.append(pt_world)

        frame_l = frame_r = midpoints[0].header.frame_id
        if not GripUtils.go_to_multi (x_l=midpoints[0].point.x,y_l=midpoints[0].point.y,z_l=midpoints[0].point.z,roll_l=-pi/2,yaw_l=-pi/2,pitch_l=pi/4,grip_l=True,frame_l=frame_l
                                                                      ,x_r=midpoints[1].point.x, y_r= midpoints[1].point.y ,z_r= midpoints[1].point.z ,roll_r=pi/2,yaw_r=pi/2,pitch_r=pi/4,grip_r=True,frame_r=frame_r,dur=5):
            print "failure"
            #return False
        else:
            print "dragging done"

        if (color == 'blue'):
            GripUtils.open_grippers()
            
        return True
开发者ID:karts25,项目名称:PR2-Towel-Folding,代码行数:44,代码来源:poly_gui_bridge.py

示例3: execute

# 需要导入模块: from pr2_simple_arm_motions import GripUtils [as 别名]
# 或者: from pr2_simple_arm_motions.GripUtils import open_grippers [as 别名]
 def execute(self,userdata):
     if not GripUtils.open_grippers():
         return FAILURE
     return SUCCESS
开发者ID:rgleichman,项目名称:berkeley_demos,代码行数:6,代码来源:cycle.py

示例4: executeBiGrip

# 需要导入模块: from pr2_simple_arm_motions import GripUtils [as 别名]
# 或者: from pr2_simple_arm_motions.GripUtils import open_grippers [as 别名]
    def executeBiGrip(self, fold_traj):
        tilts = fold_traj.tilts
        approach_points = fold_traj.approach_points
        grip_points = fold_traj.grip_points
        quarter_points = fold_traj.quarter_points
        weight_points = fold_traj.weight_points
        vertical_points = fold_traj.vertical_points
        goal_points = fold_traj.goal_points

        print "hi from bigrip"
        rolls = [pi/2,pi/2]
        #rolls  = [-pi/2,-pi/2]
        #rolls = [0,0]
        pitches = [pi/4,pi/4]
        #pitches = [0,0]
        if not fold_traj.red:
            self.executeSmooth(self.last_traj)
            
            self.fold_stance("b")
            arms = self.getArms(fold_traj)
            #Initially, both are in "approach" mode
            (target1,target2) = self.gripPoints(point=approach_points[0],grip=False,tilt=tilts[0],arm=arms[0],preferred_pitch=pi/4,preferred_roll=rolls[0],
                point2=approach_points[1],grip2=False,tilt2=tilts[1],arm2=arms[1],preferred_pitch2=pi/4,preferred_roll2=rolls[1])
            #pitches[0] = target1.pitch
            #Do the first pickup and nothing with the other arm
            self.gripPoints(point=grip_points[0],grip=False,tilt=tilts[0],arm=arms[0],preferred_pitch=0
,preferred_roll=rolls[0],grab=True)
            StanceUtils.close_gripper(arms[0])
            #Do the second pickup, with the first arm interpolated
            first_dx = vertical_points[0].point.x - grip_points[0].point.x
            first_dy = vertical_points[0].point.y - grip_points[0].point.y
            first_dz = vertical_points[0].point.z - grip_points[0].point.z
            second_dx = vertical_points[1].point.x - grip_points[1].point.x
            second_dy = vertical_points[1].point.y - grip_points[1].point.y
            second_dz = vertical_points[1].point.z - grip_points[1].point.z
            interp_dx = first_dx - second_dx
            interp_dy = first_dy - second_dy
            interp_dz = first_dz - second_dz
            interp_x = grip_points[0].point.x + interp_dx
            interp_y = grip_points[0].point.y + interp_dy
            interp_z = grip_points[0].point.z + interp_dz
            interp_pt = PointStamped()
            interp_pt.point.x = interp_x
            interp_pt.point.y = interp_y
            interp_pt.point.z = interp_z
            interp_pt.header.frame_id = grip_points[0].header.frame_id
            #Go to the second approach point
            (target2,nothing) = self.gripPoints(point=interp_pt,grip=True,tilt=tilts[0],arm=arms[0],preferred_pitch=pi/4,preferred_roll=rolls[0],
                                                point2=approach_points[1],arm2=arms[1],grip2=False,tilt2=tilts[1],preferred_pitch2=pi/4,preferred_roll2=rolls[1])
            #pitches[1] = target2.pitch
            self.gripPoints (point=interp_pt,grip=True,tilt=tilts[0],arm=arms[0],preferred_pitch=pi/4,preferred_roll=rolls[0]
                            ,point2=grip_points[1],grip2=False,tilt2=tilts[1],arm2=arms[1],preferred_pitch2=pi/4,preferred_roll2=rolls[1])
            self.gripPoints(point=grip_points[1],grip=False,tilt=tilts[1],arm=arms[1],preferred_pitch=pi/4,preferred_roll=rolls[1],grab=True)

            StanceUtils.close_gripper(arms[1])
        else:
            arms = self.getArms(fold_traj)
        #Bring both to middle

        self.gripPoints (point=vertical_points[0],grip=True,tilt=tilts[0],arm=arms[0],preferred_pitch=pi/2,preferred_roll=rolls[0]
                        ,point2=vertical_points[1],grip2=True,tilt2=tilts[1],arm2=arms[1],preferred_pitch2=pi/2,preferred_roll2=rolls[1]) #FIX pi/4 -> pi/2

        #Set first one down
        first_dx = goal_points[0].point.x - vertical_points[0].point.x
        first_dy = goal_points[0].point.y - vertical_points[0].point.y
        first_dz = goal_points[0].point.z - vertical_points[0].point.z
        second_dx = goal_points[1].point.x - vertical_points[1].point.x
        second_dy = goal_points[1].point.y - vertical_points[1].point.y
        second_dz = goal_points[1].point.z - vertical_points[1].point.z
        interp_dx = first_dx - second_dx
        interp_dy = first_dy - second_dy
        interp_dz = first_dz - second_dz
        interp_x = goal_points[0].point.x - interp_dx
        interp_y = goal_points[0].point.y - interp_dy
        interp_z = goal_points[0].point.z - interp_dz
        interp_pt = PointStamped()
        interp_pt.point.x = interp_x
        interp_pt.point.y = interp_y
        interp_pt.point.z = interp_z
        interp_pt.header.frame_id = grip_points[0].header.frame_id
        self.gripPoints  (point=interp_pt,grip=True,tilt=tilts[0],arm=arms[0],preferred_pitch=pi/2,preferred_roll=rolls[0]
                         ,point2=goal_points[1],grip2=True,tilt2=tilts[1],arm2=arms[1],preferred_pitch2=pi/2,preferred_roll2=rolls[1])
        #Finally, set last one down
        self.gripPoints(point=goal_points[0],grip=True,tilt=tilts[0],arm=arms[0],preferred_pitch=pi/2,preferred_roll=rolls[0]
                        ,point2=goal_points[1],grip2=True,tilt2=tilts[1],arm2=arms[1],preferred_pitch2=pi/2,preferred_roll2=rolls[1])
        GripUtils.open_grippers()
        goal_points[0].point.z += 0.03
        goal_points[1].point.z += 0.03
        self.gripPoints(point=goal_points[0],grip=False,tilt=tilts[0],arm=arms[0],preferred_pitch=pi/2,preferred_roll=rolls[0]
                        ,point2=goal_points[1],grip2=False,tilt2=tilts[1],arm2=arms[1],preferred_pitch2=pi/2,preferred_roll2=rolls[1])
        self.last_traj = fold_traj
开发者ID:karts25,项目名称:PR2-Towel-Folding,代码行数:93,代码来源:fold_executor.py


注:本文中的pr2_simple_arm_motions.GripUtils.open_grippers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。