本文整理汇总了Python中sensor_msgs.msg.JointState.position[vrep_joint_index]方法的典型用法代码示例。如果您正苦于以下问题:Python JointState.position[vrep_joint_index]方法的具体用法?Python JointState.position[vrep_joint_index]怎么用?Python JointState.position[vrep_joint_index]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sensor_msgs.msg.JointState
的用法示例。
在下文中一共展示了JointState.position[vrep_joint_index]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: jointStateConverter
# 需要导入模块: from sensor_msgs.msg import JointState [as 别名]
# 或者: from sensor_msgs.msg.JointState import position[vrep_joint_index] [as 别名]
def jointStateConverter(vrep_joint_state):
vrep_joint_names = {"Shoulder_Joint" : "Mico_joint1", "Arm_Joint": "Mico_joint2", "Forearm_Joint" : "Mico_joint3", "Wrist_1_Joint" : "Mico_joint4","Wrist_2_Joint":"Mico_joint5","Hand_Joint":"Mico_joint6"}
joint_names = list(vrep_joint_state.name)
position_offset = [3.14, -1.57, 1.57, 3.14, 3.14,3.14]
output = JointState()
output.name =["Shoulder_Joint", "Arm_Joint", "Forearm_Joint", "Wrist_1_Joint","Wrist_2_Joint","Hand_Joint"]
output.position = [0] * len(output.name)
output.velocity = [0] * len(output.name)
output.effort = [0] * len(output.name)
for i in range(0,len(joint_names)):
if joint_names[i] in vrep_joint_names.values():
vrep_joint_index = int(joint_names[i][-1]) - 1
output.position[vrep_joint_index] = vrep_joint_state.position[i] - position_offset[vrep_joint_index]
output.velocity[vrep_joint_index] = vrep_joint_state.velocity[i]
output.effort[vrep_joint_index] = vrep_joint_state.effort[i]
#output.position = list(vrep_joint_state.position[0:6])
output.position[4] = -1*output.position[4]
#for i in range(0,6):
#output.position[i] = 1
# output.position[i] = output.position[i] - position_offset[i]
#output.velocity = vrep_joint_state.velocity[0:6]
#output.effort = vrep_joint_state.effort[0:6]
pub1.publish(output)