array.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import roslib
00004 import rospy
00005 import math
00006 from std_msgs.msg import Float64MultiArray
00007 from random import random
00008 def main():
00009     rospy.init_node("array_sin_cos")
00010     pub = rospy.Publisher("/array_sin_cos", Float64MultiArray)
00011     counter = 0
00012     RESOLUTION = 100
00013     while not rospy.is_shutdown():
00014         if counter == RESOLUTION:
00015             counter = 0
00016         arr = Float64MultiArray()
00017         arr.data = [math.sin(2 * math.pi / RESOLUTION * counter),
00018                     math.cos(2 * math.pi / RESOLUTION * counter),
00019                     -math.sin(2 * math.pi / RESOLUTION * counter),
00020                     -math.cos(2 * math.pi / RESOLUTION * counter)]
00021         pub.publish(arr)
00022         rospy.sleep(0.05)
00023         counter = counter + 1
00024 
00025 
00026 if __name__ == "__main__":
00027     main()
00028 


rwt_plot
Author(s): Ryohei Ueda
autogenerated on Thu Jun 6 2019 18:13:17