29 This is a system monitor node for xiaoqiang. Monitor items are power, odom, brightness etc. 30 System status will be published at report 37 from geometry_msgs.msg
import Pose
38 from nav_msgs.msg
import Odometry
39 from sensor_msgs.msg
import Image
40 from std_msgs.msg
import Bool, Float64, String, UInt32
41 from xiaoqiang_msgs.msg
import Status
46 STATUS.image_status =
False 47 STATUS.odom_status =
False 48 STATUS.orb_start_status =
False 49 STATUS.orb_init_status =
False 51 STATUS.orb_scale_status =
False 54 STATUS_LOCK = threading.Lock()
59 STATUS.brightness = brightness.data
66 STATUS.image_status =
True 68 STATUS.image_status =
False 74 STATUS.power = power.data-0.3
81 STATUS.odom_status =
True 83 STATUS.odom_status =
False 90 STATUS.orb_start_status =
True 92 STATUS.orb_start_status =
False 98 if camera_pose !=
None:
99 STATUS.orb_init_status =
True 101 STATUS.orb_init_status =
False 102 STATUS_LOCK.release()
106 STATUS_LOCK.acquire()
107 STATUS.orb_scale_status = flag.data
108 STATUS_LOCK.release()
113 rospy.init_node(
"monitor", anonymous=
True)
114 rospy.Subscriber(
"/camera_node/brightness", UInt32, get_brightness)
115 rospy.Subscriber(
"/camera_node/image_raw", Image, get_image)
116 rospy.Subscriber(
"/orb_slam/frame", Image, get_orb_start_status)
117 rospy.Subscriber(
"/xiaoqiang_driver/power", Float64, get_power)
118 rospy.Subscriber(
"/xiaoqiang_driver/odom", Odometry, get_odom)
119 rospy.Subscriber(
"/orb_slam/camera", rospy.msg.AnyMsg,
120 get_orb_tracking_flag)
121 rospy.Subscriber(
"/orb_slam/scale_status", Bool, get_orb_scale_status)
122 REPORT_PUB = rospy.Publisher(
123 '/xiaoqiang_monitor/report', Status, queue_size=0)
126 if __name__ ==
"__main__":
130 while not rospy.is_shutdown():
131 STATUS_LOCK.acquire()
133 REPORT_PUB.publish(STATUS)
135 STATUS.brightness = 0
137 STATUS.image_status =
False 138 STATUS.odom_status =
False 139 STATUS.orb_init_status =
False 140 STATUS.orb_start_status =
False 141 STATUS.orb_scale_status =
False 142 STATUS_LOCK.release()
def get_orb_scale_status(flag)
def get_orb_tracking_flag(camera_pose)
def get_brightness(brightness)
def get_orb_start_status(orb_frame)