Fawkes API
Fawkes Development Version
|
00001 /*************************************************************************** 00002 * transform_listener.h - Fawkes transform listener (based on ROS tf) 00003 * 00004 * Created: Mon Oct 24 18:09:47 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_LISTENER_H_ 00053 #define __LIBS_TF_TRANSFORM_LISTENER_H_ 00054 00055 #include <tf/types.h> 00056 #include <tf/transformer.h> 00057 00058 #include <blackboard/interface_listener.h> 00059 #include <blackboard/interface_observer.h> 00060 00061 #include <list> 00062 00063 namespace fawkes { 00064 00065 class BlackBoard; 00066 class TransformInterface; 00067 00068 namespace tf { 00069 #if 0 /* just to make Emacs auto-indent happy */ 00070 } 00071 } 00072 #endif 00073 00074 class TransformListener 00075 : public Transformer, 00076 public BlackBoardInterfaceObserver, 00077 public BlackBoardInterfaceListener 00078 { 00079 public: 00080 TransformListener(BlackBoard *bb); 00081 virtual ~TransformListener(); 00082 00083 std::string resolve(const std::string& frame_name); 00084 00085 // for BlackBoardInterfaceObserver 00086 virtual void bb_interface_created(const char *type, const char *id) throw(); 00087 00088 // for BlackBoardInterfaceListener 00089 virtual void bb_interface_data_changed(Interface *interface) throw(); 00090 virtual void bb_interface_writer_removed(Interface *interface, 00091 unsigned int instance_serial) throw(); 00092 virtual void bb_interface_reader_removed(Interface *interface, 00093 unsigned int instance_serial) throw(); 00094 00095 private: 00096 void conditional_close(Interface *interface) throw(); 00097 00098 private: 00099 BlackBoard *__bb; 00100 std::list<TransformInterface *> __tfifs; 00101 00102 }; 00103 00104 } // end namespace tf 00105 } // end namespace fawkes 00106 00107 #endif