def search_object(tf_listener): """ Searches for objects using the detector. Returns: a list of (pos, dims, names) where pos is a PoseStamped(converted in the self.frame fame with the object pose if the object is found), dims is a Vector3 specifing the x,y,z dimensions of the box and names are the names of the objects. None if no object is found """ detector = GenericDetector() res = detector.detect() if not res: return None coll_res = detector.call_collision_map_processing(res) isinstance(coll_res, TabletopCollisionMapProcessingResponse) rospy.loginfo("%d objects found, changing their poses into frame %s", len(coll_res.graspable_objects),frame) poses = [] dims = [] for graspable in coll_res.graspable_objects: cluster = graspable.cluster box_pose = detector.detect_bounding_box(cluster).pose tf_listener.waitForTransform(frame, box_pose.header.frame_id, rospy.Time(0), rospy.Duration(1) ) object_pose = tf_listener.transformPose(frame, box_pose) poses.append(object_pose) dims.append(detector.last_box_msg.box_dims) return poses, dims, coll_res.collision_object_names