marker_appender.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import rospy
00003 
00004 PKG='jsk_pcl_ros'
00005 
00006 import imp
00007 try:
00008     imp.find_module(PKG)
00009 except:
00010     import roslib;roslib.load_manifest(PKG)
00011 
00012 from visualization_msgs.msg import Marker, MarkerArray
00013 
00014 marker_array = None
00015 def callback(msg):
00016   global marker_array, marker_array_pub
00017   if not marker_array:
00018     marker_array = MarkerArray()
00019   msg.id = len(marker_array.markers)
00020   marker_array.markers.append(msg)
00021   marker_array_pub.publish(marker_array)
00022 
00023 def main():
00024   global marker_array_pub
00025   rospy.init_node("marker_appender")
00026   marker_array_pub = rospy.Publisher("marker_array", MarkerArray)
00027   s = rospy.Subscriber("marker", Marker, callback)
00028   rospy.spin()
00029 
00030 if __name__ == "__main__":
00031   main()


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