Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 """
00020 This is an example showing how to publish command messages to the hand.
00021 """
00022
00023
00024 import roslib; roslib.load_manifest('sr_example')
00025 import rospy
00026 import time
00027 import math
00028
00029 from std_msgs.msg import Float64
00030
00031
00032 controller_type = "_position_controller"
00033
00034 def talker():
00035 """
00036 The Publisher publishes two commands to move joint FFJ0 and RFJ0
00037
00038 """
00039 joint1 = 'ffj0'
00040 joint2 = 'rfj0'
00041
00042
00043 rospy.init_node('shadowhand_command_publisher_python')
00044
00045 pub1 = rospy.Publisher('sh_'+ joint1 + controller_type + '/command', Float64, latch=True)
00046 pub2 = rospy.Publisher('sh_'+ joint2 + controller_type + '/command', Float64, latch=True)
00047
00048
00049
00050
00051 new_target_1 = math.radians(0.0)
00052 new_target_2 = math.radians(0.0)
00053
00054 time.sleep(1)
00055 print "publishing"
00056
00057
00058 pub1.publish(new_target_1)
00059
00060
00061 pub2.publish(new_target_2)
00062
00063
00064 if __name__ == '__main__':
00065 try:
00066 talker()
00067 except rospy.ROSInterruptException: pass