Ejemplo n.º 1
0
def add_timestamp(msg, count):
    from utility import get_hostname, ExitLoop
    now = rospy.Time.now()
    msg.header.frame_id = get_hostname() + '_' + str(count)
    msg.header.stamp.secs = now.secs
    msg.header.stamp.nsecs = now.nsecs
    return msg
Ejemplo n.º 2
0
#!/usr/bin/env python

import roslib
import rospy
import utility
from cloud_robot.msg import Complex 
from random import random

node_name = "complex_pub_" + utility.get_hostname()
rospy.init_node(node_name)
pub = rospy.Publisher('complex', Complex, queue_size = 20)
rate = rospy.Rate(2)

while not rospy.is_shutdown(): 
    msg = Complex()
    msg.real = random()
    msg.imaginary = random()
    pub.publish(msg)
    print "publish Complex real: %f imaginary: %f" % (msg.real, msg.imaginary)
    rate.sleep()
Ejemplo n.º 3
0
def add_timestamp(msg, count):
    now = rospy.Time.now()
    msg.header.frame_id = get_hostname() + '_' + str(count)
    msg.header.stamp.secs = now.secs
    msg.header.stamp.nsecs = now.nsecs
    return msg