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 import rospy
00019 import math
00020 from std_msgs.msg import Float64MultiArray
00021
00022 def velPub():
00023 rospy.init_node("test_publisher_vel", anonymous=True)
00024
00025 pub_vel = rospy.Publisher("joint_group_velocity_controller/command", Float64MultiArray, queue_size=1)
00026 rospy.sleep(1.0)
00027
00028 freq = 100.0
00029 r = rospy.Rate(freq)
00030
00031 joint_idx = 2
00032
00033 a = 0.1
00034 b = 0.1 * (2.0*math.pi/freq)
00035 c = 0.0
00036 d = 0.0
00037 i = 0.0
00038
00039 vel_msg = Float64MultiArray()
00040 vel_msg.data = [0.0] * 7
00041
00042 while not rospy.is_shutdown():
00043 vel = a*math.sin(b*i+c) + d
00044
00045 vel_msg.data[joint_idx] = vel
00046 pub_vel.publish(vel_msg)
00047 i += 1.0
00048 r.sleep()
00049
00050 if __name__ == '__main__':
00051 try:
00052 velPub()
00053 except rospy.ROSInterruptException: pass