cloud_on_plane_info.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import rospy
3 from jsk_rviz_plugins.msg import OverlayText
4 from std_msgs.msg import Float32
5 from threading import Lock
6 from jsk_rviz_plugins.overlay_text_interface import OverlayTextInterface
7 from jsk_recognition_msgs.msg import BoolStamped
8 
9 g_lock = Lock()
10 g_msg = None
11 def callback(msg):
12  global g_msg
13  with g_lock:
14  g_msg = msg
15 def publish_text(event):
16  with g_lock:
17  if g_msg:
18  if g_msg.data:
19  text_interface.publish('Is Object On Plane?: ON')
20  else:
21  text_interface.publish('Is Object On Plane?: <span style="color: red">Off</span>')
22 
23 
24 if __name__ == "__main__":
25  rospy.init_node("cloud_on_plane_info")
26  text_interface = OverlayTextInterface("~text")
27  sub = rospy.Subscriber("~input", BoolStamped, callback)
28  rospy.Timer(rospy.Duration(0.1), publish_text)
29  rospy.spin()


jsk_pcl_ros_utils
Author(s): Yohei Kakiuchi
autogenerated on Mon May 3 2021 03:03:15