4 This is a test script to generate console messages for testing / 11 import rosgraph_msgs
as rm
12 from rosgraph_msgs.msg
import Log
15 def __init__(self, filename, function, line, name, level, msg):
19 self.log.level = level
21 self.log.file =
'/home/tallest/workspaces/gir/src/' + filename
23 self.log.function = function
26 self.log.header.stamp = rospy.Time.now()
28 if isinstance(self.
msg, str):
29 self.log.msg = self.
msg 31 self.log.msg = self.
msg()
37 LogT(
'typewriter/src/linebreak.cpp',
'break_lines', 50,
38 '/typewriter/output', Log.DEBUG,
"Breaking\nLines."),
39 LogT(
'taco_system/src/taste_evaluator.cpp',
'calc_spicy', 225,
40 '/taste/taco_manager', Log.WARN,
lambda : (
'sample exceeds max capsaicin levels (%.2f)' % random.uniform(12, 19))),
41 LogT(
'squirrel_observer/src/distraction.cpp',
'handle_distraction', 891,
42 '/vision/squirrel', Log.INFO,
'squirrel detected! sending voice notification'),
43 LogT(
'squirrel_observer/src/classification.cpp',
'handle_distraction', 891,
44 '/vision/squirrel', Log.WARN,
'covariance too high, classifying as squirrel to be on safe side'),
45 LogT(
'order_processing/src/obedience.cpp',
'process_orders', 12,
46 '/behavior/mission', Log.ERROR,
'implement me!'),
47 LogT(
'joint_control/src/joint_trajectory.cpp',
'iteration', 348,
48 '/mobility/knee_controller', Log.WARN,
'low stability margin detected'),
49 LogT(
'laser/src/safety_lock.cpp',
'activate_lock', 921,
50 '/weapons/laser_eyes', Log.FATAL,
'segmentation fault')
53 rospy.init_node(
'console_pub')
54 rosout = rospy.Publisher(
'/rosout', Log, queue_size=0)
56 while not rospy.is_shutdown():
57 rospy.sleep(random.uniform(0.001, 0.1))
58 msg = random.choice(log_templates).generate()
def __init__(self, filename, function, line, name, level, msg)