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


Python JointState.position[:]方法代码示例

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


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

示例1: joint_goal

# 需要导入模块: from sensor_msgs.msg import JointState [as 别名]
# 或者: from sensor_msgs.msg.JointState import position[:] [as 别名]
 def joint_goal(self):
     rospy.loginfo(rospy.get_caller_id() + " -> starting joint goal")
     # set in position joint mode
     self.set_state_block("DVRK_POSITION_GOAL_JOINT")
     # get current position
     initial_joint_position = []
     initial_joint_position[:] = self._position_joint_desired
     rospy.loginfo(
         rospy.get_caller_id() + " -> testing goal joint position for 2 joints of %i", len(initial_joint_position)
     )
     amplitude = math.radians(10.0)
     # create a new goal starting with current position
     goal = JointState()
     goal.position[:] = initial_joint_position
     # first motion
     goal.position[0] = initial_joint_position[0] + amplitude
     goal.position[1] = initial_joint_position[1] - amplitude
     self.set_position_goal_joint_publish_and_wait(goal)
     # second motion
     goal.position[0] = initial_joint_position[0] - amplitude
     goal.position[1] = initial_joint_position[1] + amplitude
     self.set_position_goal_joint_publish_and_wait(goal)
     # back to initial position
     goal.position[:] = initial_joint_position
     self.set_position_goal_joint_publish_and_wait(goal)
     rospy.loginfo(rospy.get_caller_id() + " <- joint goal complete")
开发者ID:BerkeleyAutomation,项目名称:dvrk-ros,代码行数:28,代码来源:dvrk_arm_test.py

示例2: move_joint

# 需要导入模块: from sensor_msgs.msg import JointState [as 别名]
# 或者: from sensor_msgs.msg.JointState import position[:] [as 别名]
    def move_joint(self, end_joint):
        """Move the arm to the end vector, this only works with the SUJs in simulated mode.

        :param end_joint: the list of joints in which you should conclude movement
        # go to that position directly"""
        joint_state = JointState()
        joint_state.position[:] = end_joint.flat
        self.__set_position_joint_pub.publish(joint_state)
开发者ID:jhu-dvrk,项目名称:dvrk-ros,代码行数:10,代码来源:suj.py

示例3: set_position_goal_joint

# 需要导入模块: from sensor_msgs.msg import JointState [as 别名]
# 或者: from sensor_msgs.msg.JointState import position[:] [as 别名]
 def set_position_goal_joint(self, goal):
     self._goal_reached_event.clear()
     self._goal_reached = False
     joint_state = JointState()
     joint_state.position[:] = goal
     self._set_position_goal_joint_publisher.publish(joint_state)
     self._goal_reached_event.wait(180) # 3 minutes at most
     if not self._goal_reached:
         rospy.signal_shutdown('failed to reach goal')
         sys.exit(-1)
开发者ID:lz89,项目名称:dvrk-ros,代码行数:12,代码来源:dvrk_calibrate_potentiometers.py

示例4: __move_joint_goal

# 需要导入模块: from sensor_msgs.msg import JointState [as 别名]
# 或者: from sensor_msgs.msg.JointState import position[:] [as 别名]
    def __move_joint_goal(self, end_joint):
        """Move the arm to the end vector by bypassing the trajectory generator.

        :param end_joint: the list of joints in which you should conclude movement
        :returns: true if you had succesfully move
        :rtype: Bool"""
        if (not self.__dvrk_set_state('DVRK_POSITION_GOAL_JOINT')):
            return False
        joint_state = JointState()
        joint_state.position[:] = end_joint.flat
        return self.__set_position_goal_joint_publish_and_wait(joint_state)
开发者ID:lz89,项目名称:dvrk-ros,代码行数:13,代码来源:arm.py

示例5: __move_joint_direct

# 需要导入模块: from sensor_msgs.msg import JointState [as 别名]
# 或者: from sensor_msgs.msg.JointState import position[:] [as 别名]
    def __move_joint_direct(self, end_joint):
        """Move the arm to the end vector by passing the trajectory generator.

        :param end_joint: the list of joints in which you should conclude movement
        :returns: true if you had succesfully move
        :rtype: Bool"""
        # go to that position directly
        joint_state = JointState()
        joint_state.position[:] = end_joint.flat
        self.__set_position_joint_pub.publish(joint_state)
        return True
开发者ID:jhu-dvrk,项目名称:dvrk-ros,代码行数:13,代码来源:arm.py

示例6: __move_joint_goal

# 需要导入模块: from sensor_msgs.msg import JointState [as 别名]
# 或者: from sensor_msgs.msg.JointState import position[:] [as 别名]
 def __move_joint_goal(self, end_joint):
     """Move the robot to the end vector by bypassing the trajectory generator.
     :param end_joint: the list of joints in which you should conclude movement
     :returns: true if you had succesfully move
     :rtype: Bool"""
     rospy.loginfo(rospy.get_caller_id() + ' -> starting move joint goal')
     if (self.__check_input_type(end_joint, [list,float])):
         if (not self.__dvrk_set_state('DVRK_POSITION_GOAL_JOINT')):
             return False
         joint_state = JointState()
         joint_state.position[:] = end_joint
         self.__set_position_goal_joint_publish_and_wait(joint_state)
         return True
开发者ID:bthananjeyan,项目名称:demo_recording,代码行数:15,代码来源:robot.py

示例7: __move_joint_goal

# 需要导入模块: from sensor_msgs.msg import JointState [as 别名]
# 或者: from sensor_msgs.msg.JointState import position[:] [as 别名]
    def __move_joint_goal(self, end_joint, blocking):
        """Move the arm to the end vector by bypassing the trajectory generator.

        :param end_joint: the list of joints in which you should conclude movement
        :returns: true if you had succesfully move
        :rtype: Bool"""
        joint_state = JointState()
        joint_state.position[:] = end_joint.flat
        if blocking:
            return self.__set_position_goal_joint_publish_and_wait(joint_state)
        else:
            self.__set_position_goal_joint_pub.publish(joint_state)
        return True
开发者ID:jhu-dvrk,项目名称:dvrk-ros,代码行数:15,代码来源:arm.py

示例8: __move_joint_direct

# 需要导入模块: from sensor_msgs.msg import JointState [as 别名]
# 或者: from sensor_msgs.msg.JointState import position[:] [as 别名]
 def __move_joint_direct(self, end_joint):
     """Move the robot to the end vector by passing the trajectory generator.
     :param end_joint: the list of joints in which you should conclude movement
     :returns: true if you had succesfully move
     :rtype: Bool"""
     rospy.loginfo(rospy.get_caller_id() + ' -> starting move joint direct')
     if (self.__check_input_type(end_joint, [list,float])):
         if not self.__dvrk_set_state('DVRK_POSITION_JOINT'):
             return False
         # go to that position directly
         joint_state = JointState()
         joint_state.position[:] = end_joint
         self.set_position_joint.publish(joint_state)
         rospy.loginfo(rospy.get_caller_id() + ' <- completing move joint direct')
         return True
开发者ID:bthananjeyan,项目名称:demo_recording,代码行数:17,代码来源:robot.py

示例9: prepare_cartesian

# 需要导入模块: from sensor_msgs.msg import JointState [as 别名]
# 或者: from sensor_msgs.msg.JointState import position[:] [as 别名]
 def prepare_cartesian(self):
     # make sure the camera is past the cannula and tool vertical
     initial_joint_position = self._position_joint_desired
     if ((self._robot_name == 'PSM1') or (self._robot_name == 'PSM2') or (self._robot_name == 'PSM3') or (self._robot_name == 'ECM')):
         # set in position joint mode
         self.set_state_block(state = 'DVRK_POSITION_GOAL_JOINT')
             # create a new goal starting with current position
         goal = JointState()
         goal.position[:] = initial_joint_position
         goal.position[0] = 0.0
         goal.position[1] = 0.0
         goal.position[2] = 0.12
         self._goal_reached_event.clear()
         self.set_position_goal_joint.publish(goal)
         self._goal_reached_event.wait(60) # 1 minute at most
         if not self._goal_reached:
             rospy.signal_shutdown('failed to reach goal')
             sys.exit(-1)
开发者ID:JKOK005,项目名称:dvrk-ros,代码行数:20,代码来源:dvrk_arm_test.py

示例10: joint_direct

# 需要导入模块: from sensor_msgs.msg import JointState [as 别名]
# 或者: from sensor_msgs.msg.JointState import position[:] [as 别名]
 def joint_direct(self):
     rospy.loginfo(rospy.get_caller_id() + ' -> starting joint direct')
     # set in position joint mode
     self.set_state_block('DVRK_POSITION_JOINT')
     # get current position
     initial_joint_position = []
     initial_joint_position[:] = self._position_joint_desired
     rospy.loginfo(rospy.get_caller_id() + " -> testing direct joint position for 2 joints of %i", len(initial_joint_position))
     amplitude = math.radians(10.0) # +/- 10 degrees
     duration = 5  # seconds
     rate = 200 # aiming for 200 Hz
     samples = duration * rate
     # create a new goal starting with current position
     goal = JointState()
     goal.position[:] = initial_joint_position
     for i in xrange(samples):
         goal.position[0] = initial_joint_position[0] + amplitude *  math.sin(i * math.radians(360.0) / samples)
         goal.position[1] = initial_joint_position[1] + amplitude *  math.sin(i * math.radians(360.0) / samples)
         self.set_position_joint.publish(goal)
         rospy.sleep(1.0 / rate)
     rospy.loginfo(rospy.get_caller_id() + ' <- joint direct complete')
开发者ID:JKOK005,项目名称:dvrk-ros,代码行数:23,代码来源:dvrk_arm_test.py


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