object_clusters_publisher.py
Go to the documentation of this file.
00001 """
00002 Module defining several outputs for the object recognition pipeline
00003 """
00004 
00005 from ecto import BlackBoxCellInfo as CellInfo, BlackBoxForward as Forward
00006 from object_recognition_core.io.sink import SinkBase
00007 from object_recognition_ros import init_ros
00008 from object_recognition_ros.ecto_cells.ecto_object_recognition_msgs import Publisher_RecognizedObjectArray
00009 from object_recognition_clusters.ecto_cells.io_clusters import PointCloudMsgAssembler
00010 import ecto
00011 
00012 ########################################################################################################################
00013 
00014 class ObjectClustersPublisher(ecto.BlackBox, SinkBase):
00015     """
00016     Class publishing the clusters of tabletop on a RecognizedObjectsArray topic
00017     """
00018     def __init__(self, *args, **kwargs):
00019         init_ros()
00020         ecto.BlackBox.__init__(self, *args, **kwargs)
00021         SinkBase.__init__(self)
00022 
00023     @classmethod
00024     def declare_cells(cls, p):
00025         return {'msg_assembler': CellInfo(PointCloudMsgAssembler),
00026                 'passthrough': ecto.PassthroughN(items=dict(pose_results='The final results'))
00027                 }
00028 
00029     @staticmethod
00030     def declare_direct_params(p):
00031         p.declare('latched', 'Determines if the topics will be latched.', False)
00032         p.declare('recognized_object_array_topic', 'The ROS topic to use for the recognized object', 'recognized_object_array')
00033 
00034     @staticmethod
00035     def declare_forwards(_p):
00036         p = {}
00037         i = {'msg_assembler': [Forward('clusters3d'), Forward('image_message')],
00038              'passthrough': [Forward('pose_results')]}
00039         o = {}
00040         return (p,i,o)
00041 
00042     def configure(self, p, _i, _o):
00043         self._recognized_object_array = Publisher_RecognizedObjectArray(topic_name=p.recognized_object_array_topic, latched=p.latched)
00044 
00045     def connections(self, _p):
00046         # connect to a publishing cell
00047         connections = [ self.msg_assembler['msg'] >> self._recognized_object_array['input']]
00048 
00049         return connections


object_recognition_clusters
Author(s): Bence Magyar , Kaijen Hsiao
autogenerated on Wed Aug 26 2015 14:58:56