本文整理汇总了Python中trajectory_msgs.msg.JointTrajectory.joint_name方法的典型用法代码示例。如果您正苦于以下问题:Python JointTrajectory.joint_name方法的具体用法?Python JointTrajectory.joint_name怎么用?Python JointTrajectory.joint_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trajectory_msgs.msg.JointTrajectory
的用法示例。
在下文中一共展示了JointTrajectory.joint_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_controller
# 需要导入模块: from trajectory_msgs.msg import JointTrajectory [as 别名]
# 或者: from trajectory_msgs.msg.JointTrajectory import joint_name [as 别名]
def test_controller(self):
from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint
topic = "/pr2/torso_controller/command"
rospy.init_node("test_pr2_torso_controller", log_level=rospy.DEBUG, disable_signals=True)
rospy.loginfo("Preparing to publish on %s" % topic)
ctl = rospy.Publisher(topic, JointTrajectory)
self.assertEquals(getjoint("torso_lift_joint"), 0.0)
duration = 0.1
traj = JointTrajectory()
traj.joint_name = "torso_lift_joint"
initialpoint = JointTrajectoryPoint()
initialpoint.positions = 0.0
initialpoint.velocities = 0.0
initialpoint.time_from_start = rospy.Duration(0.0)
finalpoint = JointTrajectoryPoint()
finalpoint.positions = 0.195
finalpoint.velocities = 0.0
finalpoint.time_from_start = rospy.Duration(duration)
# First, move up
traj.points = [initialpoint, finalpoint]
ctl.publish(traj)
time.sleep(duration + 0.1)
self.assertEquals(getjoint("torso_lift_joint"), 0.195)
# Go back to initial position
finalpoint.time_from_start = rospy.Duration(0.0)
initialpoint.time_from_start = rospy.Duration(duration)
traj.points = [finalpoint, initialpoint]
ctl.publish(traj)
time.sleep(duration + 0.1)
self.assertEquals(getjoint("torso_lift_joint"), 0.0)