3 from __future__ 
import absolute_import
 
    4 from __future__ 
import division
 
    5 from __future__ 
import print_function
 
    7 import dynamic_reconfigure.server
 
    8 from geometry_msgs.msg 
import PolygonStamped
 
    9 from jsk_recognition_msgs.msg 
import PolygonArray
 
   10 from jsk_topic_tools 
import ConnectionBasedTransport
 
   11 from jsk_topic_tools.log_utils 
import logerr_throttle
 
   12 from jsk_recognition_utils.cfg 
import PolygonArrayToPolygonConfig
 
   19         super(self.__class__, self).
__init__()
 
   20         self.
pub = self.advertise(
'~output', PolygonStamped, queue_size=1)
 
   21         dynamic_reconfigure.server.Server(PolygonArrayToPolygonConfig,
 
   25         self.
sub = rospy.Subscriber(
'~input', PolygonArray, self.
_convert)
 
   35         polygon_msg = PolygonStamped()
 
   36         polygon_msg.header = msg.header
 
   39         elif self.
index < len(msg.polygons):
 
   40             polygon_msg = msg.polygons[self.
index]
 
   41             self.
pub.publish(polygon_msg)
 
   44                             'Invalid index {} is specified ' 
   45                             'for polygon array whose size is {}' 
   49 if __name__ == 
'__main__':
 
   50     rospy.init_node(
'polygon_array_to_polygon')