本文整理汇总了Python中sensor_msgs.msg.JointState.name[id_dof]方法的典型用法代码示例。如果您正苦于以下问题:Python JointState.name[id_dof]方法的具体用法?Python JointState.name[id_dof]怎么用?Python JointState.name[id_dof]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sensor_msgs.msg.JointState
的用法示例。
在下文中一共展示了JointState.name[id_dof]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: publish_joint_state
# 需要导入模块: from sensor_msgs.msg import JointState [as 别名]
# 或者: from sensor_msgs.msg.JointState import name[id_dof] [as 别名]
def publish_joint_state(self):
for id_human, publisher in enumerate(self.joint_state_publishers):
joint_state = JointState()
joint_state.header.stamp = rospy.Time().now()
joint_state.name = [""] * len(self.joints)
joint_state.position = [0.] * len(self.joints)
for id_dof, joint in enumerate(self.joints):
joint_state.name[id_dof] = joint
# TODO REMOVE THAT SHOULDER HACK
# Should work on left arm model to avoid setting
# the shoulder in the parser
# if joint == "lShoulderX":
# joint_state.position[id_dof] = -pi / 2.
if joint in self.active_dofs:
i = self.active_dofs.index(joint)
joint_state.position[id_dof] = self.q_cur[id_human][i]
# Publish joint states
publisher.publish(joint_state)