simple_image_transport.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 import rospy
5 
6 from sensor_msgs.msg import Image
7 
8 from jsk_topic_tools import ConnectionBasedTransport
9 
10 
11 class SimpleImageTransport(ConnectionBasedTransport):
12  def __init__(self):
13  super(SimpleImageTransport, self).__init__()
14  self._pub = self.advertise('~output', Image, queue_size=1)
15 
16  def subscribe(self):
17  self.sub_img = rospy.Subscriber('~input', Image, self._process)
18 
19  def unsubscribe(self):
20  self.sub_img.unregister()
21 
22  def _process(self, img_msg):
23  self._pub.publish(img_msg)
24 
25 
26 if __name__ == '__main__':
27  rospy.init_node('sample_image_transport')
28  img_trans = SimpleImageTransport()
29  rospy.spin()


jsk_topic_tools
Author(s): Kei Okada , Yusuke Furuta
autogenerated on Tue Feb 6 2018 03:45:19