plane_time_ensync_for_recognition.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import rospy
3 
4 PKG='jsk_pcl_ros'
5 
6 import imp
7 ## import message_filters
8 try:
9  imp.find_module(PKG)
10 except:
11  import roslib;roslib.load_manifest(PKG)
12 
13 from sensor_msgs.msg import PointCloud2
14 from jsk_recognition_msgs.msg import PolygonArray, ModelCoefficientsArray
15 
16 
18  global remain_polygon_msg
19  remain_polygon_msg = msg
21  global remain_coefficients_msg
22  remain_coefficients_msg = msg
23 def timer_cb(msg):
24  global remain_polygon_msg, remain_coefficients_msg
25  if remain_polygon_msg and remain_coefficients_msg:
26  remain_polygon_msg.header.stamp = msg.header.stamp
27  remain_polygon_msg.header.seq = msg.header.seq
28  remain_coefficients_msg.header.stamp = msg.header.stamp
29  remain_coefficients_msg.header.seq = msg.header.seq
30  polygons_pub.publish(remain_polygon_msg)
31  coefficients_pub.publish(remain_coefficients_msg)
32  remain_polygon_msg = False
33  remain_coefficients_msg = False
34 
35 if __name__ == "__main__":
36  rospy.init_node('time_ensync', anonymous=True)
37  polygons_pub = rospy.Publisher('ensynced_planes', PolygonArray)
38  coefficients_pub = rospy.Publisher('ensynced_planes_coefficients', ModelCoefficientsArray)
39  rospy.Subscriber("timer", PointCloud2, timer_cb)
40  rospy.Subscriber("planes", PolygonArray, input_polygons_cb)
41  rospy.Subscriber("planes_coefficients", ModelCoefficientsArray, input_coefficients_cb)
42  remain_polygon_msg = False
43  remain_coefficients_msg = False
44  rospy.spin()


jsk_pcl_ros
Author(s): Yohei Kakiuchi
autogenerated on Mon May 3 2021 03:03:47