simple_image_transport.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 
00004 import rospy
00005 
00006 from sensor_msgs.msg import Image
00007 
00008 from jsk_topic_tools import ConnectionBasedTransport
00009 
00010 
00011 class SimpleImageTransport(ConnectionBasedTransport):
00012     def __init__(self):
00013         super(SimpleImageTransport, self).__init__()
00014         self._pub = self.advertise('~output', Image, queue_size=1)
00015 
00016     def subscribe(self):
00017         self.sub_img = rospy.Subscriber('~input', Image, self._process)
00018 
00019     def unsubscribe(self):
00020         self.sub_img.unregister()
00021 
00022     def _process(self, img_msg):
00023         self._pub.publish(img_msg)
00024 
00025 
00026 if __name__ == '__main__':
00027     rospy.init_node('sample_image_transport')
00028     img_trans = SimpleImageTransport()
00029     rospy.spin()


jsk_topic_tools
Author(s): Kei Okada , Yusuke Furuta
autogenerated on Fri Sep 8 2017 03:38:56