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


Python Limb.joint_names方法代码示例

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


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

示例1: track

# 需要导入模块: from baxter_interface import Limb [as 别名]
# 或者: from baxter_interface.Limb import joint_names [as 别名]
class track():
    
    def __init__(self):
        
        self.centerx = 365
        self.centery = 120
        self.coefx = 0.1/(526-369)
        self.coefy = 0.1/(237-90)
        self.count = 0
        self.hdr = Header(stamp=rospy.Time.now(), frame_id='base')
        self.gripper = Gripper("right")
        self.gripper.calibrate()
        self.gripper.set_moving_force(0.1)
        rospy.sleep(0.5)
        self.gripper.set_holding_force(0.1)
        rospy.sleep(0.5)
        self.busy = False
        self.gripper_distance = 100
        self.subscribe_gripper()
        self.robotx = -1
        self.roboty = -1
        self.framenumber = 0
        self.history = np.arange(0,20)*-1
        self.newPosition = True
        self.bowlcamera = None
        self.kin = baxter_kinematics('right')
        self.J = self.kin.jacobian()
        self.J_inv = self.kin.jacobian_pseudo_inverse()
        self.jointVelocity = np.asarray([1,2,3,4,5,6,7],np.float32)
        self.control_arm = Limb("right")
        self.control_joint_names = self.control_arm.joint_names()
        self.dx = 0
        self.dy = 0
        self.distance = 1000
        self.finish = False
        self.found = 0
        ifr = rospy.Subscriber("/robot/range/right_hand_range/state", Range, self._read_distance)


    def _read_distance(self,data):
        self.distance = data.range

    def vision_request_right(self, controlID, requestID):
        
        try:
            
            rospy.wait_for_service('vision_server_vertical')
            vision_server_req = rospy.ServiceProxy('vision_server_vertical', VisionVertical)
            return vision_server_req(controlID, requestID)
        
        except (rospy.ServiceException,rospy.ROSInterruptException), e:
            print "Service call failed: %s" % e
            self.clean_shutdown_service()
开发者ID:YZHANGFPE,项目名称:test,代码行数:55,代码来源:MD_pour.py

示例2: track

# 需要导入模块: from baxter_interface import Limb [as 别名]
# 或者: from baxter_interface.Limb import joint_names [as 别名]
class track():
    
    def __init__(self):
        
        self.centerx = 365
        self.centery = 120
        self.coefx = 0.1/(526-369)
        self.coefy = 0.1/(237-90)
        self.count = 0
        self.hdr = Header(stamp=rospy.Time.now(), frame_id='base')

        self.gripper_left = Gripper("left")
        self.gripper_left.calibrate()
        self.gripper_left.set_moving_force(0.01)
        rospy.sleep(0.5)
        self.gripper_left.set_holding_force(0.01)
        rospy.sleep(0.5)
        self.gripper_right = Gripper("right")
        self.gripper_right.calibrate()
        rospy.sleep(1)
        self.busy = False
        self.gripper_distance = 100
        self.subscribe_gripper()
        self.robotx = -1
        self.roboty = -1
        self.framenumber = 0
        self.history = np.arange(0,20)*-1
        self.newPosition = True
        self.bowlcamera = None
        self.kin_right = baxter_kinematics('right')
        self.kin_left = baxter_kinematics('left')
        self.J = self.kin_right.jacobian()
        self.J_inv = self.kin_right.jacobian_pseudo_inverse()
        self.jointVelocity = np.asarray([1,2,3,4,5,6,7],np.float32)
        self.control_arm = Limb("right")
        self.left_arm = Limb("left")
        self.control_joint_names = self.control_arm.joint_names()
        self.dx = 0
        self.dy = 0
        self.distance = 1000
        self.finish = False
        self.found = 0
        self.pour_x = 0
        self.pour_y = 0
        ifr = rospy.Subscriber("/robot/range/right_hand_range/state", Range, self._read_distance)
        self.joint_states = {

            'observe':{
                        'right_e0': -0.631,
                        'right_e1': 0.870,
                        'right_s0': 0.742, 
                        'right_s1': -0.6087,
                        'right_w0': 0.508,
                        'right_w1': 1.386,
                        'right_w2': -0.5538,
                    },
                    'observe_ladle':{
                        'right_e0': -0.829,
                        'right_e1': 0.831,
                        'right_s0': 0.678, 
                        'right_s1': -0.53,
                        'right_w0': 0.716,
                        'right_w1': 1.466,
                        'right_w2': -0.8099,
                    },
                    'observe_left':{
                        'left_w0': 2.761932405432129, 
                        'left_w1': -1.5700293346069336, 
                        'left_w2': -0.8893253607604981, 
                        'left_e0': -0.9805972175354004, 
                        'left_e1': 1.8300390778564455, 
                        'left_s0': 1.4783739826354982, 
                        'left_s1': -0.9503010970092775,

                    },
                    'stir':{
                        'right_e0': -0.179,
                        'right_e1': 1.403,
                        'right_s0': 0.381, 
                        'right_s1': -0.655,
                        'right_w0': 1.3,
                        'right_w1': 2.04,
                        'right_w2': 0.612,

                    },
                    'observe_vertical':{
                        'right_e0': 0.699,
                        'right_e1': 1.451,
                        'right_s0': -1.689, 
                        'right_s1': 0.516,
                        'right_w0': 0.204,
                        'right_w1': 0.935,
                        'right_w2': -2.706,
                    },
                    'observe_midpoint':{
                        'right_e0': -0.606,
                        'right_e1': 0.968,
                        'right_s0': 0.0, 
                        'right_s1': -0.645,
                        'right_w0': 0.465,
#.........这里部分代码省略.........
开发者ID:YZHANGFPE,项目名称:test,代码行数:103,代码来源:open_cap.py

示例3: track

# 需要导入模块: from baxter_interface import Limb [as 别名]
# 或者: from baxter_interface.Limb import joint_names [as 别名]
class track():
    
    def __init__(self):
        
        self.centerx = 365
        self.centery = 120
        self.coefx = 0.1/(526-369)
        self.coefy = 0.1/(237-90)
        self.count = 0
        self.hdr = Header(stamp=rospy.Time.now(), frame_id='base')
        self.gripper = Gripper("right")
        self.gripper.calibrate()
        rospy.sleep(2)
        # self.gripper.set_moving_force(0.1)
        # rospy.sleep(0.5)
        # self.gripper.set_holding_force(0.1)
        # rospy.sleep(0.5)
        self.busy = False
        self.gripper_distance = 100
        self.subscribe_gripper()
        self.robotx = -1
        self.roboty = -1
        self.framenumber = 0
        self.history = np.arange(0,20)*-1
        self.newPosition = True
        self.bowlcamera = None
        self.kin = baxter_kinematics('right')
        self.J = self.kin.jacobian()
        self.J_inv = self.kin.jacobian_pseudo_inverse()
        self.jointVelocity = np.asarray([1,2,3,4,5,6,7],np.float32)
        self.control_arm = Limb("right")
        self.control_joint_names = self.control_arm.joint_names()
        self.dx = 0
        self.dy = 0
        self.distance = 1000
        self.finish = False
        self.found = 0
        ifr = rospy.Subscriber("/robot/range/right_hand_range/state", Range, self._read_distance)
        self.joint_states = {
            # 'observe':{
            #     'right_e0': -0.365,
            #     'right_e1': 1.061,
            #     'right_s0': 0.920, 
            #     'right_s1': -0.539,
            #     'right_w0': 0.350,
            #     'right_w1': 1.105,
            #     'right_w2': -0.221,
            # },
            'observe':{
                'right_e0': -0.631,
                'right_e1': 0.870,
                'right_s0': 0.742, 
                'right_s1': -0.6087,
                'right_w0': 0.508,
                'right_w1': 1.386,
                'right_w2': -0.5538,
            },
            
            'observe_vertical':{
                'right_e0': 0.699,
                'right_e1': 1.451,
                'right_s0': -1.689, 
                'right_s1': 0.516,
                'right_w0': 0.204,
                'right_w1': 0.935,
                'right_w2': -2.706,
            },
            'observe_ladle':{
                'right_e0': -0.829,
                'right_e1': 0.831,
                'right_s0': 0.678, 
                'right_s1': -0.53,
                'right_w0': 0.716,
                'right_w1': 1.466,
                'right_w2': -0.8099,
            },
        
        }


    def _read_distance(self,data):
        self.distance = data.range

    def vision_request_right(self, controlID, requestID):
        
        try:
            
            rospy.wait_for_service('vision_server_vertical')
            vision_server_req = rospy.ServiceProxy('vision_server_vertical', VisionVertical)
            return vision_server_req(controlID, requestID)
        
        except (rospy.ServiceException,rospy.ROSInterruptException), e:
            print "Service call failed: %s" % e
            self.clean_shutdown_service()
开发者ID:YZHANGFPE,项目名称:test,代码行数:96,代码来源:MDDemo.py

示例4: vision_server

# 需要导入模块: from baxter_interface import Limb [as 别名]
# 或者: from baxter_interface.Limb import joint_names [as 别名]
class vision_server():
    
    def __init__(self):

        rospy.init_node('vision_server_right')
        
        self.pub = rospy.Publisher('/robot/xdisplay', Image, latch=True)
        self.busy = False
        self.dx = 0
        self.dy = 0
        self.avg_dx = -1
        self.avg_dy = -1
        self.H = homography()
        self.framenumber = 0
        self.history_x = np.arange(0,10)*-1
        self.history_y = np.arange(0,10)*-1
        self.bowlcamera = None
        self.newPosition = True
        self.foundBowl = 0
        self.centerx = 400
        
        #self.centerx = 250
        self.centery = 150
        #self.centery = 190
        self.coefx = 0.1/(526-369)
        self.coefy = 0.1/(237-90)
        self.v_joint = np.arange(7)
        self.v_end = np.arange(6)
        self.cmd = {}
        self.found = False
        self.finish = 0
        self.distance = 10
        self.gripper = Gripper("right")
        #self.gripper.calibrate()

        cv2.namedWindow('image')
        self.np_image = np.zeros((400,640,3), np.uint8)
        cv2.imshow('image',self.np_image)
        #self._set_threshold()

        
        s = rospy.Service('vision_server_vertical', Vision, self.handle_vision_req)
        camera_topic = '/cameras/right_hand_camera/image'
        self.right_camera = rospy.Subscriber(camera_topic, Image, self._on_camera)
        ifr = rospy.Subscriber("/robot/range/right_hand_range/state", Range, self._read_distance)
        print "\nReady to use right hand vision server\n" 

        self.kin = baxter_kinematics('right')
        self.J = self.kin.jacobian()
        self.J_inv = self.kin.jacobian_pseudo_inverse()
        self.jointVelocity = np.asarray([1,2,3,4,5,6,7],np.float32)
        self.control_arm = Limb("right")
        self.control_joint_names = self.control_arm.joint_names()
        
        #print np.dot(self.J,self.jointVelocity)

    def _read_distance(self,data):

        self.distance = data.range



    def _set_threshold(self):
        
        cv2.createTrackbar('Min R(H)','image',0,255,nothing)
        cv2.createTrackbar('Max R(H)','image',255,255,nothing)
        cv2.createTrackbar('Min G(S)','image',0,255,nothing)
        cv2.createTrackbar('Max G(S)','image',255,255,nothing)
        cv2.createTrackbar('Min B(V)','image',0,255,nothing)
        cv2.createTrackbar('Max B(V)','image',255,255,nothing)

    def get_joint_velocity(self):
        cmd = {}
        velocity_list = np.asarray([1,2,3,4,5,6,7],np.float32)
        for idx, name in enumerate(self.control_joint_names):
            v = self.control_arm.joint_velocity( self.control_joint_names[idx])
            velocity_list[idx] = v
            cmd[name] = v 
        return velocity_list

    def list_to_dic(self,ls):
        cmd = {}
        for idx, name in enumerate(self.control_joint_names):
            v = ls.item(idx)
            cmd[name] = v 
        return cmd

    def PID(self):

        Kp = 0.5
        vy = -Kp*self.dx
        vx = -Kp*self.dy
        return vx,vy

    def _on_camera(self, data):

        self.busy = True
        self.framenumber += 1
        index = self.framenumber % 10
        cv2.namedWindow('image')
#.........这里部分代码省略.........
开发者ID:YZHANGFPE,项目名称:pick_challenge,代码行数:103,代码来源:vision_server_vertical.py


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