move_joint.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import roslib
00004 roslib.load_manifest( 'rospy' )
00005 roslib.load_manifest( 'std_msgs' )
00006 
00007 import rospy
00008 
00009 from std_msgs.msg import Float64, Int8
00010 
00011 import numpy as np
00012 
00013 rospy.init_node( 'move_joint_node' )
00014 topic = 'r_shoulder_pan_controller/command'
00015 
00016 topic = 'r_forearm_roll_controller/command'
00017 
00018 pub = rospy.Publisher( topic, Float64 )
00019 
00020 update_pub = rospy.Publisher( '/joint_state_viz/update', Int8 )
00021 
00022 soft_lower_limit = -np.pi
00023 soft_upper_limit = np.pi
00024 
00025 # soft_lower_limit = -2.1353981634
00026 # soft_upper_limit = 0.564601836603
00027 
00028 counter = 0
00029 
00030 while not rospy.is_shutdown():
00031     
00032     counter = counter + 1
00033     print( '----- %d -----'%counter )
00034     
00035     pos = np.random.rand() * ( soft_upper_limit - soft_lower_limit ) + soft_lower_limit
00036     rospy.loginfo( 'move to pos %6.4f'%pos )
00037     
00038     update_pub.publish( 0 )
00039     rospy.sleep( 0.5 )
00040     pub.publish( pos )
00041     rospy.sleep( 1 )
00042     update_pub.publish( 1 )
00043 
00044     if counter == 500:
00045         break


kelsey_sandbox
Author(s): kelsey
autogenerated on Wed Nov 27 2013 11:52:04