19 from diagnostic_msgs.msg
import DiagnosticArray, DiagnosticStatus
25 self.
_fake_diag_pub = rospy.Publisher(
'/diagnostics', DiagnosticArray, queue_size=1)
29 msg = DiagnosticArray()
30 msg.header.stamp = rospy.get_rostime()
32 hostname_list = self.
_options.diag_hostnames.split(
", ")
33 for hostname
in hostname_list:
34 status = DiagnosticStatus()
35 status.name = hostname
36 status.level = DiagnosticStatus.OK
37 status.message =
"fake diagnostics"
38 status.hardware_id = hostname
39 msg.status.append(status)
43 if __name__ ==
'__main__':
46 parser = optparse.OptionParser(usage=
"usage: fake_diagnostics.py [--diag-hostnames=hostname1, hostname2, ...]")
47 parser.add_option(
"--diag-hostnames", dest=
"diag_hostnames",
48 help=
"Fake Diagnostics")
49 options, args = parser.parse_args(rospy.myargv())
51 rospy.init_node(
'fake_diagnostics')