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


Python GripUtils.go_to_pts方法代码示例

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


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

示例1: execute

# 需要导入模块: from pr2_simple_arm_motions import GripUtils [as 别名]
# 或者: from pr2_simple_arm_motions.GripUtils import go_to_pts [as 别名]
    def execute(self, userdata):

        initial_separation = 0.11
        print 'Smooth distance: %d' % self.distance
        if self.arm=="b":
            rospy.loginfo('Self.arm is b')
            outcome = SUCCESS
            #Put arms together, with a gap of initial_separation between grippers
            if not GripUtils.go_to_pts(point_l=self.location,grip_r=True, grip_l=True, point_r=self.location,
                    roll_l=pi/2,yaw_l=0,pitch_l=-pi/2,y_offset_l=initial_separation/2.0,z_offset_l=0.05
                    ,link_frame_l="l_wrist_back_frame",
                    roll_r=pi/2,yaw_r=0,pitch_r=-pi/2,y_offset_r=-1*initial_separation/2.0,z_offset_r=0.05
                    ,link_frame_r="r_wrist_back_frame",dur=4.0):
                outcome = FAILURE
            rospy.loginfo('Smooth on table goto 1: Success is %s', outcome==SUCCESS)
            if not GripUtils.go_to_pts(point_l=self.location,grip_r=True, grip_l=True, point_r=self.location,
                    roll_l=pi/2,yaw_l=0,pitch_l=-pi/2,y_offset_l=initial_separation/2.0,z_offset_l=0.00,
                    link_frame_l="l_wrist_back_frame",
                    roll_r=pi/2,yaw_r=0,pitch_r=-pi/2,y_offset_r=-1*initial_separation/2.0,z_offset_r=0.00,
                    link_frame_r="r_wrist_back_frame",dur=2.0):
                outcome = FAILURE
            rospy.loginfo('Smooth on table goto 2: Success is %s', outcome==SUCCESS)
            if not GripUtils.go_to_pts(point_l=self.location,grip_r=True, grip_l=True, point_r=self.location,
                    roll_l=pi/2,yaw_l=0,pitch_l=-pi/2,
                    y_offset_l=(self.distance+initial_separation)/2.0, z_offset_l=0.00,
                    link_frame_l="l_wrist_back_frame",
                    roll_r=pi/2,yaw_r=0,pitch_r=-pi/2,
                    y_offset_r=-1*(self.distance+initial_separation)/2.0, z_offset_r=0.00,
                    link_frame_r="r_wrist_back_frame",dur=2.0):
                outcome = FAILURE
            rospy.loginfo('Smooth on table goto 3: Success is %s', outcome==SUCCESS)
            GripUtils.recall_arm("b")
            return outcome
        else:
            #Right is negative in the y axis
            if self.arm=="r":
                y_multiplier = -1
            else:
                y_multiplier = 1
            rospy.loginfo('arm is %s, y multiplier is %s' % (self.arm, y_multiplier))
            print 'Location: %s' % str(self.location)
            if not GripUtils.go_to_pt(point=self.location,grip=True,roll=pi/2,yaw=0,pitch=-pi/2,
                    z_offset=0.05,arm=self.arm,
                    link_frame="%s_wrist_back_frame"%self.arm,dur=4.0, verbose=True):
                return FAILURE
            rospy.loginfo('Step 2')
            if not GripUtils.go_to_pt(point=self.location,grip=True,roll=pi/2,yaw=0,pitch=-pi/2,
                    z_offset=-0.01,arm=self.arm,
                    link_frame="%s_wrist_back_frame"%self.arm,dur=2.0, verbose=True):
                #return FAILURE
                pass
            rospy.loginfo('Step 3')
            print 'Offset: %f' % (y_multiplier*self.distance) 
            if not GripUtils.go_to_pt(point=self.location,grip=True,roll=pi/2,yaw=0,pitch=-pi/2,
                    y_offset=y_multiplier*self.distance,z_offset=-0.01,arm=self.arm,
                    link_frame="%s_wrist_back_frame"%self.arm,dur=2.0, verbose=True):
                return FAILURE
            rospy.loginfo('Step 4.  Done!')
        return SUCCESS    
开发者ID:rll,项目名称:berkeley_utils,代码行数:61,代码来源:SmachUtils.py

示例2: smooth

# 需要导入模块: from pr2_simple_arm_motions import GripUtils [as 别名]
# 或者: from pr2_simple_arm_motions.GripUtils import go_to_pts [as 别名]
def smooth(arm='b'):
    location = PointStamped()
    location.point.x = 0.5
    location.header.frame_id = "table_height"
    distance = TABLE_WIDTH/3
    initial_separation = 0.11
    GripUtils.recall_arm(arm)
    if arm == 'b':
        #Put arms together, with a gap of initial_separation between grippers
        if not GripUtils.go_to_pts(point_l=location,grip_r=True, grip_l=True, point_r=location,
                roll_l=pi/2,yaw_l=0,pitch_l=-pi/2,y_offset_l=initial_separation/2.0,z_offset_l=0.05
                ,link_frame_l="l_wrist_back_frame",
                roll_r=pi/2,yaw_r=0,pitch_r=-pi/2,y_offset_r=-1*initial_separation/2.0,z_offset_r=0.05
                ,link_frame_r="r_wrist_back_frame",dur=4.0):
            success = False
        if not GripUtils.go_to_pts(point_l=location,grip_r=True, grip_l=True, point_r=location,
                roll_l=pi/2,yaw_l=0,pitch_l=-pi/2,y_offset_l=initial_separation/2.0,z_offset_l=-0.03, 
                link_frame_l="l_wrist_back_frame",
                roll_r=pi/2,yaw_r=0,pitch_r=-pi/2,y_offset_r=-1*initial_separation/2.0,z_offset_r=-0.03, 
                link_frame_r="r_wrist_back_frame",dur=2.0):
            success = False
        if not GripUtils.go_to_pts(point_l=location,grip_r=True, grip_l=True, point_r=location,
                roll_l=pi/2,yaw_l=0,pitch_l=-pi/2,
                y_offset_l=(distance+initial_separation)/2.0, z_offset_l=-0.03,
                link_frame_l="l_wrist_back_frame",
                roll_r=pi/2,yaw_r=0,pitch_r=-pi/2,
                y_offset_r=-1*(distance+initial_separation)/2.0, z_offset_r=-0.03,
                link_frame_r="r_wrist_back_frame",dur=2.0):
            success = False
    else:
        #Right is negative in the y axis
        if arm=="r":
            y_multiplier = -1
        else:
            y_multiplier = 1
        location.point.y -= y_multiplier*distance/2
        if not GripUtils.go_to_pt(point=location,grip=True,roll=pi/2,yaw=0,pitch=-pi/2,
                z_offset=0.05,arm=arm,
                link_frame="%s_wrist_back_frame"%arm,dur=4.0):
            success = False
        if not GripUtils.go_to_pt(point=location,grip=True,roll=pi/2,yaw=0,pitch=-pi/2,
                z_offset=-0.01,arm=arm,
                link_frame="%s_wrist_back_frame"%arm,dur=2.0):
            success = False
        if not GripUtils.go_to_pt(point=location,grip=True,roll=pi/2,yaw=0,pitch=-pi/2,
                y_offset=y_multiplier*distance,z_offset=-0.01,arm=arm,
                link_frame="%s_wrist_back_frame"%arm,dur=2.0):
            success = False
    GripUtils.recall_arm(arm)
    return True
开发者ID:rgleichman,项目名称:berkeley_demos,代码行数:52,代码来源:demo.py

示例3: execute

# 需要导入模块: from pr2_simple_arm_motions import GripUtils [as 别名]
# 或者: from pr2_simple_arm_motions.GripUtils import go_to_pts [as 别名]
    def execute(self,userdata):
        bl = userdata.bl
        br = userdata.br
        tl = userdata.tl
        tr = userdata.tr
        
        midleft = bl
        midleft.point.x = (bl.point.x + tl.point.x)/2
        midleft.point.y = (bl.point.y + tl.point.y)/2
        midleft.point.z = (bl.point.z + tl.point.z)/2

        midright = br
        midright.point.x = (br.point.x + tr.point.x)/2
        midright.point.y = (br.point.y + tr.point.y)/2
        midright.point.z = (br.point.z + tr.point.z)/2

        if not GripUtils.grab_point(midleft,roll=pi/2,yaw=-pi/2,pitch=pi/4,arm="l",x_offset=-0.01,z_offset=0.01,INIT_SCOOT_AMT = 0.01):
            return FAILURE
        if not GripUtils.grab_point(midright,roll=-pi/2,yaw=pi/2,pitch=pi/4,arm="r",x_offset=-0.01,z_offset=0.01,INIT_SCOOT_AMT = 0.01):
            return FAILURE
        if not GripUtils.go_to_pts(point_l=midleft,roll_l=pi/2,yaw_l=-pi/2,pitch_l=pi/4,grip_l=True,point_r=midright,roll_r=-pi/2,yaw_r=pi/2,pitch_r=pi/4,grip_r=True,z_offset_l=0.4,z_offset_r=0.4):
            return FAILURE
        return SUCCESS
开发者ID:rgleichman,项目名称:berkeley_demos,代码行数:25,代码来源:cycle.py


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