tracker_status_info.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 # it depends on jsk_rviz_plugins
00004 
00005 import rospy
00006 from jsk_rviz_plugins.msg import OverlayText
00007 from std_msgs.msg import Float32
00008 from threading import Lock
00009 from jsk_rviz_plugins.overlay_text_interface import OverlayTextInterface
00010 from jsk_recognition_msgs.msg import TrackerStatus
00011 g_lock = Lock()
00012 g_tracker_status_msg = None
00013 def tracker_status_callback(msg):
00014     global g_tracker_status_msg
00015     with g_lock:
00016         g_tracker_status_msg = msg
00017 def publish_text(event):
00018     with g_lock:
00019         if g_tracker_status_msg:
00020             if g_tracker_status_msg.is_tracking:
00021                 status_interface.publish('Tracker Status: <span style="color: red;">Tracking</span>')
00022             else:
00023                 status_interface.publish('Tracker Status: Stable')
00024 
00025 
00026 if __name__ == "__main__":
00027     rospy.init_node("tracker_status_info")
00028     status_interface = OverlayTextInterface("~text")
00029     sub = rospy.Subscriber("~input", TrackerStatus, tracker_status_callback)
00030     rospy.Timer(rospy.Duration(0.1), publish_text)
00031     rospy.spin()


jsk_pcl_ros
Author(s): Yohei Kakiuchi
autogenerated on Sun Oct 8 2017 02:43:50