overlay_text_interface.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 from jsk_rviz_plugins.cfg import OverlayTextInterfaceConfig
4 from jsk_rviz_plugins.msg import OverlayText
5 from dynamic_reconfigure.server import Server
6 import rospy
7 
9  def __init__(self, topic):
10  self.srv = Server(OverlayTextInterfaceConfig, self.callback)
11  self.pub = rospy.Publisher(topic, OverlayText)
12  def callback(self, config, level):
13  self.config = config
14  return config
15  def publish(self, text):
16  msg = OverlayText()
17  msg.text = text
18  msg.width = self.config.width
19  msg.height = self.config.height
20  msg.top = self.config.top
21  msg.left = self.config.left
22  msg.fg_color.a = self.config.fg_alpha
23  msg.fg_color.r = self.config.fg_red
24  msg.fg_color.g = self.config.fg_green
25  msg.fg_color.b = self.config.fg_blue
26  msg.bg_color.a = self.config.bg_alpha
27  msg.bg_color.r = self.config.bg_red
28  msg.bg_color.g = self.config.bg_green
29  msg.bg_color.b = self.config.bg_blue
30  msg.text_size = self.config.text_size
31  self.pub.publish(msg)


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Sat Mar 20 2021 03:03:18