array.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import roslib
4 import rospy
5 import math
6 from std_msgs.msg import Float64MultiArray
7 from random import random
8 def main():
9  rospy.init_node("array_sin_cos")
10  pub = rospy.Publisher("/array_sin_cos", Float64MultiArray, queue_size=1)
11  counter = 0
12  RESOLUTION = 100
13  while not rospy.is_shutdown():
14  if counter == RESOLUTION:
15  counter = 0
16  arr = Float64MultiArray()
17  arr.data = [math.sin(2 * math.pi / RESOLUTION * counter),
18  math.cos(2 * math.pi / RESOLUTION * counter),
19  -math.sin(2 * math.pi / RESOLUTION * counter),
20  -math.cos(2 * math.pi / RESOLUTION * counter)]
21  pub.publish(arr)
22  rospy.sleep(0.05)
23  counter = counter + 1
24 
25 
26 if __name__ == "__main__":
27  main()
28 
def main()
Definition: array.py:8


rwt_plot
Author(s): Ryohei Ueda
autogenerated on Fri Jun 2 2023 02:53:35