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


Python JointTrajectoryPoint.velocities[jnt]方法代码示例

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


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

示例1: _get_bezier_point

# 需要导入模块: from trajectory_msgs.msg import JointTrajectoryPoint [as 别名]
# 或者: from trajectory_msgs.msg.JointTrajectoryPoint import velocities[jnt] [as 别名]
 def _get_bezier_point(self, b_matrix, idx, t, cmd_time, dimensions_dict):
     pnt = JointTrajectoryPoint()
     pnt.time_from_start = rospy.Duration(cmd_time)
     num_joints = b_matrix.shape[0]
     pnt.positions = [0.0] * num_joints
     if dimensions_dict["velocities"]:
         pnt.velocities = [0.0] * num_joints
     if dimensions_dict["accelerations"]:
         pnt.accelerations = [0.0] * num_joints
     for jnt in range(num_joints):
         b_point = bezier.bezier_point(b_matrix[jnt, :, :, :], idx, t)
         # Positions at specified time
         pnt.positions[jnt] = b_point[0]
         # Velocities at specified time
         if dimensions_dict["velocities"]:
             pnt.velocities[jnt] = b_point[1]
         # Accelerations at specified time
         if dimensions_dict["accelerations"]:
             pnt.accelerations[jnt] = b_point[-1]
     return pnt
开发者ID:tnn9,项目名称:nurse_robot,代码行数:22,代码来源:joint_trajectory_action.py

示例2: _get_point

# 需要导入模块: from trajectory_msgs.msg import JointTrajectoryPoint [as 别名]
# 或者: from trajectory_msgs.msg.JointTrajectoryPoint import velocities[jnt] [as 别名]
    def _get_point(self, joint_names, time):
        pnt = JointTrajectoryPoint()
        pnt.time_from_start = rospy.Duration(time)
        pnt.positions = [0.0] * len(joint_names)
        pnt.velocities = [0.0] * len(joint_names)
        pnt.accelerations = [0.0] * len(joint_names)
        time2 = math.pow(time, 2)
        time3 = math.pow(time, 3)
        time4 = math.pow(time, 4)
        time5 = math.pow(time, 5)

        for jnt in xrange(len(joint_names)):
            # Positions at specified time
            pnt.positions[jnt] = (self._coeff[jnt][0]
                                  + time * self._coeff[jnt][1]
                                  + time2 * self._coeff[jnt][2]
                                  + time3 * self._coeff[jnt][3]
                                  + time4 * self._coeff[jnt][4]
                                  + time5 * self._coeff[jnt][5]
                                  )

            # Velocities at specified time
            pnt.velocities[jnt] = (self._coeff[jnt][1]
                                   + 2.0 * time * self._coeff[jnt][2]
                                   + (3.0 * time2
                                      * self._coeff[jnt][3])
                                   + (4.0 * time3
                                      * self._coeff[jnt][4])
                                   + (5.0 * time4
                                      * self._coeff[jnt][5])
                                   )

            # Accelerations at specified time
            pnt.accelerations[jnt] = (2.0 * self._coeff[jnt][2]
                                      + 6.0 * time * self._coeff[jnt][3]
                                      + (12.0 * time2
                                         * self._coeff[jnt][4])
                                      + (20.0 * time3
                                         * self._coeff[jnt][5])
                                      )
        return pnt
开发者ID:BaxterTU2014,项目名称:baxter_interface,代码行数:43,代码来源:joint_trajectory_action.py


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