pointcloud_information.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 try:
3  from jsk_rviz_plugins.msg import *
4 except:
5  import roslib;roslib.load_manifest("jsk_rviz_plugins")
6  from jsk_rviz_plugins.msg import *
7 
8 from sensor_msgs.msg import PointCloud2
9 from std_msgs.msg import ColorRGBA, Float32
10 import rospy
11 
12 text_pub = rospy.Publisher("output_text", OverlayText)
13 
14 def cloud_cb(cloud):
15  point_num = cloud.width * cloud.height
16 
17  point_type = ""
18  for field in cloud.fields:
19  point_type +=field.name
20  frame_id = cloud.header.frame_id
21 
22  text = OverlayText()
23  text.width = 500
24  text.height = 80
25  text.left = 10
26  text.top = 10
27  text.text_size = 12
28  text.line_width = 2
29  text.font = "DejaVu Sans Mono"
30  text.text = """Point Cloud Num : %d
31 PointType : %s
32 PointFrame : %s
33 """ % (point_num, point_type, frame_id)
34  text.fg_color = ColorRGBA(25 / 255.0, 1.0, 240.0 / 255.0, 1.0)
35  text.bg_color = ColorRGBA(0.0, 0.0, 0.0, 0.2)
36  text_pub.publish(text)
37 
38 
39 if __name__ == "__main__":
40  rospy.init_node("pointcloud_information_text")
41  rospy.Subscriber("input", PointCloud2, cloud_cb)
42  rospy.spin()
msg
pointcloud_information.cloud_cb
def cloud_cb(cloud)
Definition: pointcloud_information.py:14


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Fri Aug 2 2024 08:50:14