Go to the documentation of this file.00001
00002
00003 import roslib
00004
00005 roslib.load_manifest( 'rospy' )
00006 roslib.load_manifest( 'robot_msgs' )
00007
00008 import rospy
00009 import robot_msgs.msg
00010
00011 import sys
00012 import time
00013
00014 def main():
00015 if len( sys.argv ) > 1:
00016 topic = str( sys.argv[1] )
00017 else:
00018 print 'Usage:', sys.argv[0], '<topic>'
00019 sys.exit( 1 )
00020
00021 rospy.init_node( 'set_joint_position', anonymous=True )
00022 pub = rospy.Publisher( topic, robot_msgs.msg.JointCmd )
00023
00024 cmd = robot_msgs.msg.JointCmd()
00025
00026 while( True ):
00027 print 'New position: ',
00028 cmd.positions = [ float( sys.stdin.readline() ) ]
00029 print 'New velocity: ',
00030 cmd.velocity = [ float( sys.stdin.readline() ) ]
00031 pub.publish( cmd )
00032
00033 if __name__ == '__main__':
00034 main()
00035