capture_rviz_text.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 from jsk_rviz_plugins.msg import OverlayText
5 from std_msgs.msg import Int32
6 
7 
8 def callback(msg):
9  global pub
10  count = msg.data
11  text = OverlayText()
12  color = (52, 152, 219)
13  text.fg_color.r = color[0] / 255.0
14  text.fg_color.g = color[1] / 255.0
15  text.fg_color.b = color[2] / 255.0
16  text.fg_color.a = 1.0
17  text.bg_color.a = 0.0
18  text.text = "Samples: %d" % (count)
19  text.width = 500
20  text.height = 100
21  text.left = 10
22  text.top = 10
23  text.text_size = 30
24  pub.publish(text)
25 
26 def main():
27  global pub
28  pub = rospy.Publisher("capture_text", OverlayText)
29  sub = rospy.Subscriber("capture_count", Int32, callback)
30  rospy.spin()
31 
32 if __name__ == "__main__":
33  rospy.init_node("capture_rviz_text")
34  main()


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Thu Jun 1 2023 02:45:58