3 from jsk_network_tools.msg
import FC2OCS, OCS2FC
5 from threading
import Lock, Thread
7 from struct
import Struct
13 from roslib.message
import get_message_class
14 from std_msgs.msg
import Time
15 import diagnostic_updater
16 from diagnostic_msgs.msg
import DiagnosticStatus
19 def __init__(self, server, buffer_size, format, message, pub):
26 recv_data, addr = self.server.recvfrom(self.
buffer_size)
29 print "received:", msg
33 message_class_str = rospy.get_param(
"~message",
34 "jsk_network_tools/FC2OCS")
38 raise Exception(
"invalid topic type: %s"%message_class_str)
42 self.diagnostic_updater.setHardwareID(
"none")
46 self.
receive_ip = rospy.get_param(
"~receive_ip",
"127.0.0.1")
49 self.socket_server.settimeout(
None)
55 "~last_received_time", Time)
58 "~last_publish_output_time", Time)
62 self.diagnostic_updater.update()
69 stat.summary(DiagnosticStatus.OK,
"OK")
71 now = rospy.Time.now()
72 stat.add(
"Uptime [sec]",
74 stat.add(
"Time from the last reception [sec]",
76 stat.add(
"Time from the last publish ~output [sec]",
82 while not rospy.is_shutdown():
91 rospy.logdebug(
"received:", msg)
93 if __name__ ==
"__main__":
94 rospy.init_node(
"silverhammer_lowspeed_receiver")
def diagnosticTimerCallback(self, event)
def diagnosticCallback(self, stat)
last_publish_output_time_pub
def __init__(self, server, buffer_size, format, message, pub)