tracker_status_info.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # it depends on jsk_rviz_plugins
4 
5 import rospy
6 from jsk_rviz_plugins.msg import OverlayText
7 from std_msgs.msg import Float32
8 from threading import Lock
9 from jsk_rviz_plugins.overlay_text_interface import OverlayTextInterface
10 from jsk_recognition_msgs.msg import TrackerStatus
11 g_lock = Lock()
12 g_tracker_status_msg = None
14  global g_tracker_status_msg
15  with g_lock:
16  g_tracker_status_msg = msg
17 def publish_text(event):
18  with g_lock:
19  if g_tracker_status_msg:
20  if g_tracker_status_msg.is_tracking:
21  status_interface.publish('Tracker Status: <span style="color: red;">Tracking</span>')
22  else:
23  status_interface.publish('Tracker Status: Stable')
24 
25 
26 if __name__ == "__main__":
27  rospy.init_node("tracker_status_info")
28  status_interface = OverlayTextInterface("~text")
29  sub = rospy.Subscriber("~input", TrackerStatus, tracker_status_callback)
30  rospy.Timer(rospy.Duration(0.1), publish_text)
31  rospy.spin()
tracker_status_info.publish_text
def publish_text(event)
Definition: tracker_status_info.py:17
msg
tracker_status_info.tracker_status_callback
def tracker_status_callback(msg)
Definition: tracker_status_info.py:13
jsk_rviz_plugins::overlay_text_interface
jsk_rviz_plugins::overlay_text_interface::OverlayTextInterface


jsk_pcl_ros
Author(s): Yohei Kakiuchi
autogenerated on Tue Jan 7 2025 04:05:45