Go to the documentation of this file.00001
00002 from ros import rospy
00003 from ros import rosjava_test_msgs
00004 import rosjava_test_msgs.msg
00005 import random
00006
00007 def publisher():
00008 rospy.init_node('composite_publisher')
00009 pub = rospy.Publisher('composite_in', rosjava_test_msgs.msg.Composite)
00010 r = rospy.Rate(10)
00011 m = rosjava_test_msgs.msg.Composite()
00012 m.a.x = random.random() * 10000.
00013 m.a.y = random.random() * 10000.
00014 m.a.z = random.random() * 10000.
00015 m.a.w = m.a.x + m.a.y + m.a.z
00016
00017 m.b.x = m.a.x
00018 m.b.y = m.a.y
00019 m.b.z = m.a.z
00020
00021 while not rospy.is_shutdown():
00022 pub.publish(m)
00023 r.sleep()
00024
00025 if __name__ == '__main__':
00026 publisher()