Go to the documentation of this file.00001
00002
00003 import rospy
00004 from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint
00005
00006 class PR2Torso():
00007 def __init__(self):
00008 self.pub = rospy.Publisher("/torso_controller/command",JointTrajectory)
00009
00010 def set_position(self,goal):
00011 traj = JointTrajectory()
00012 traj_p = JointTrajectoryPoint()
00013 traj.joint_names = ["torso_lift_joint"]
00014 traj_p.positions = [goal]
00015 traj_p.velocities = [0.]
00016 traj_p.accelerations = [0.]
00017 traj_p.time_from_start = rospy.Duration(2.)
00018 traj.points.append(traj_p)
00019 self.pub.publish(traj)
00020
00021 if __name__=='__main__':
00022 rospy.init_node('move_torso')
00023 mt = PR2Torso()
00024 mt.set_position(0.015)
00025 rospy.spin()