rxplot_stress_test_datagen.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import roslib
00003 roslib.load_manifest('rxtools')
00004 # maybe not so kosher but then again we probably don't want geometry_msgs in the manifest
00005 # just for these tests, nor do we want to create a whole new package just for the tests:
00006 roslib.load_manifest('geometry_msgs') 
00007 import rospy
00008 
00009 from geometry_msgs.msg import Vector3Stamped
00010 
00011 import numpy as np
00012 
00013 def main():
00014     rospy.init_node('rxplot_stress_test_datagen')
00015     r = rospy.Rate(50)
00016     pub = rospy.Publisher('data', Vector3Stamped)
00017     t_start = rospy.Time.now()
00018     T = 5.0
00019     msg = Vector3Stamped()
00020     while not rospy.is_shutdown():
00021         msg.header.stamp = rospy.Time.now()
00022         t = (msg.header.stamp - t_start).to_sec()
00023         msg.vector.x = np.sin(t/T*2*np.pi)
00024         msg.vector.y = np.cos(t/T*2*np.pi)
00025         msg.vector.z = msg.vector.x**2 - msg.vector.y**2
00026         pub.publish(msg)
00027         r.sleep()
00028         
00029 if __name__ == "__main__":
00030     main()


rxtools
Author(s): Josh Faust, Rob Wheeler, Ken Conley
autogenerated on Mon Oct 6 2014 07:25:59