Example #1
0
def publisher():
    rospy.init_node('string_publisher')
    pub = rospy.Publisher('string_in', std_msgs.msg.String)
    m = std_msgs.msg.String(rospy.get_name())
    r = rospy.Rate(10)
    while not rospy.is_shutdown():
        pub.publish(m)
        r.sleep()
Example #2
0
def publisher():
    rospy.init_node('testheader_publisher')
    pub = rospy.Publisher('test_header_in', rosjava_test_msgs.msg.TestHeader)
    r = rospy.Rate(10)
    m = rosjava_test_msgs.msg.TestHeader()
    m.caller_id = rospy.get_name()
    m.header.stamp = rospy.get_rostime()
    while not rospy.is_shutdown():
        pub.publish(m)
        r.sleep()
def publisher():
    rospy.init_node('int64_publisher')
    pub = rospy.Publisher('int64_in', std_msgs.msg.Int64)
    i = 0
    r = rospy.Rate(10)
    m = std_msgs.msg.Int64(i)
    while not rospy.is_shutdown():
        pub.publish(m)
        i += 1
        m.data = i
        r.sleep()
def publisher():
  rospy.init_node('composite_publisher')
  pub = rospy.Publisher('composite_in', test_ros.msg.Composite)
  r = rospy.Rate(10)
  m = test_ros.msg.Composite()
  m.a.x = random.random() * 10000.
  m.a.y = random.random() * 10000.
  m.a.z = random.random() * 10000.
  m.a.w = m.a.x + m.a.y + m.a.z
  
  m.b.x = m.a.x
  m.b.y = m.a.y
  m.b.z = m.a.z
  
  while not rospy.is_shutdown():
    pub.publish(m)
    r.sleep()