Go to the documentation of this file.00001
00002
00003 import roslib
00004 import rospy
00005 import math
00006 from std_msgs.msg import Float64
00007 from random import random
00008 def main():
00009 rospy.init_node("sin")
00010 pub = rospy.Publisher("/sin", Float64)
00011 counter = 0
00012 RESOLUTION = 100
00013 while not rospy.is_shutdown():
00014 if counter == RESOLUTION:
00015 counter = 0
00016 val = math.sin(2 * math.pi / RESOLUTION * counter)
00017 pub.publish(Float64(val))
00018 rospy.sleep(0.05)
00019 counter = counter + 1
00020
00021
00022 if __name__ == "__main__":
00023 main()