Fawkes API  Fawkes Development Version
transform_publisher.h
00001 /***************************************************************************
00002  *  transform_publisher.h - Fawkes transform publisher (based on ROS tf)
00003  *
00004  *  Created: Tue Oct 25 22:17:54 2011
00005  *  Copyright  2011  Tim Niemueller [www.niemueller.de]
00006  ****************************************************************************/
00007 
00008 /*  This program is free software; you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; either version 2 of the License, or
00011  *  (at your option) any later version. A runtime exception applies to
00012  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00013  *
00014  *  This program is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU Library General Public License for more details.
00018  *
00019  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00020  */
00021 
00022 /* This code is based on ROS tf with the following copyright and license:
00023  *
00024  * Copyright (c) 2008, Willow Garage, Inc.
00025  * All rights reserved.
00026  * 
00027  * Redistribution and use in source and binary forms, with or without
00028  * modification, are permitted provided that the following conditions are met:
00029  * 
00030  *     * Redistributions of source code must retain the above copyright
00031  *       notice, this list of conditions and the following disclaimer.
00032  *     * Redistributions in binary form must reproduce the above copyright
00033  *       notice, this list of conditions and the following disclaimer in the
00034  *       documentation and/or other materials provided with the distribution.
00035  *     * Neither the name of the Willow Garage, Inc. nor the names of its
00036  *       contributors may be used to endorse or promote products derived from
00037  *       this software without specific prior written permission.
00038  * 
00039  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00040  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00041  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00042  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00043  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00044  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00045  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00046  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00047  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00048  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00049  * POSSIBILITY OF SUCH DAMAGE.
00050  */
00051 
00052 #ifndef __LIBS_TF_TRANSFORM_PUBLISHER_H_
00053 #define __LIBS_TF_TRANSFORM_PUBLISHER_H_
00054 
00055 #include <tf/types.h>
00056 #include <utils/time/time.h>
00057 
00058 namespace fawkes {
00059 
00060   class BlackBoard;
00061   class TransformInterface;
00062   class Mutex;
00063 
00064   namespace tf {
00065 #if 0 /* just to make Emacs auto-indent happy */
00066   }
00067 }
00068 #endif
00069 
00070 class TransformPublisher
00071 {
00072  public:
00073   TransformPublisher(BlackBoard *bb, const char *bb_iface_id);
00074   virtual ~TransformPublisher();
00075 
00076   virtual void send_transform(const StampedTransform &transform);
00077 
00078   virtual void send_transform(const Transform &transform,
00079                               const fawkes::Time &time,
00080                               const std::string frame,
00081                               const std::string child_frame)
00082   { send_transform(StampedTransform(transform, time, frame, child_frame)); }
00083 
00084  private:
00085   bool __enabled;
00086   BlackBoard *__bb;
00087   TransformInterface *__tfif;
00088   Mutex *__mutex;
00089 };
00090 
00091 
00092 } // end namespace tf
00093 } // end namespace fawkes
00094 
00095 #endif