Go to the documentation of this file.00001
00002
00003 from jsk_rviz_plugins.cfg import OverlayTextInterfaceConfig
00004 from jsk_rviz_plugins.msg import OverlayText
00005 from dynamic_reconfigure.server import Server
00006 import rospy
00007
00008 class OverlayTextInterface():
00009 def __init__(self, topic):
00010 self.srv = Server(OverlayTextInterfaceConfig, self.callback)
00011 self.pub = rospy.Publisher(topic, OverlayText)
00012 def callback(self, config, level):
00013 self.config = config
00014 return config
00015 def publish(self, text):
00016 msg = OverlayText()
00017 msg.text = text
00018 msg.width = self.config.width
00019 msg.height = self.config.height
00020 msg.top = self.config.top
00021 msg.left = self.config.left
00022 msg.fg_color.a = self.config.fg_alpha
00023 msg.fg_color.r = self.config.fg_red
00024 msg.fg_color.g = self.config.fg_green
00025 msg.fg_color.b = self.config.fg_blue
00026 msg.bg_color.a = self.config.bg_alpha
00027 msg.bg_color.r = self.config.bg_red
00028 msg.bg_color.g = self.config.bg_green
00029 msg.bg_color.b = self.config.bg_blue
00030 msg.text_size = self.config.text_size
00031 self.pub.publish(msg)