simple_lazy_transport.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import roslib.message
4 import rospy
5 
6 from topic_tools import LazyTransport
7 
8 
10  def __init__(self):
11  super(self.__class__, self).__init__()
12  msg_name = rospy.get_param('~msg_name')
13  self.msg_class = roslib.message.get_message_class(msg_name)
14  self._pub = self.advertise('~output', self.msg_class, queue_size=1)
15 
16  def subscribe(self):
17  self._sub = rospy.Subscriber('~input', self.msg_class, self._process)
18 
19  def unsubscribe(self):
20  self._sub.unregister()
21 
22  def _process(self, img_msg):
23  self._pub.publish(img_msg)
24 
25 
26 if __name__ == '__main__':
27  rospy.init_node('simple_transport')
29  rospy.spin()
simple_lazy_transport.SimpleLazyTransport.unsubscribe
def unsubscribe(self)
Definition: simple_lazy_transport.py:19
simple_lazy_transport.SimpleLazyTransport.msg_class
msg_class
Definition: simple_lazy_transport.py:13
topic_tools.LazyTransport.advertise
def advertise(self, *args, **kwargs)
Definition: __init__.py:70
simple_lazy_transport.SimpleLazyTransport
Definition: simple_lazy_transport.py:9
topic_tools.LazyTransport
Definition: __init__.py:18
simple_lazy_transport.SimpleLazyTransport._pub
_pub
Definition: simple_lazy_transport.py:14
simple_lazy_transport.SimpleLazyTransport._sub
_sub
Definition: simple_lazy_transport.py:17
simple_lazy_transport.SimpleLazyTransport.__init__
def __init__(self)
Definition: simple_lazy_transport.py:10
simple_lazy_transport.SimpleLazyTransport.subscribe
def subscribe(self)
Definition: simple_lazy_transport.py:16
simple_lazy_transport.SimpleLazyTransport._process
def _process(self, img_msg)
Definition: simple_lazy_transport.py:22


topic_tools
Author(s): Morgan Quigley, Brian Gerkey, Dirk Thomas , Jacob Perron
autogenerated on Thu Nov 23 2023 04:02:10