Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * ros.cpp - ROS aspect for Fawkes 00004 * 00005 * Created: Thu May 05 15:53:31 2011 00006 * Copyright 2006-2011 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #include <plugins/ros/aspect/ros.h> 00025 #include <ros/node_handle.h> 00026 00027 namespace fawkes { 00028 #if 0 /* just to make Emacs auto-indent happy */ 00029 } 00030 #endif 00031 00032 /** @class ROSAspect <plugins/ros/aspect/ros.h> 00033 * Thread aspect to get access to a ROS node handle. 00034 * Give this aspect to your thread to interact with the central ROS 00035 * node handle. 00036 * 00037 * @ingroup Aspects 00038 * @author Tim Niemueller 00039 */ 00040 00041 /** @var fawkes:LockPtr<ros::NodeHandle> ROSAspect::rosnode 00042 * Central ROS node handle. Make sure you use proper locking in your 00043 * application when using the class, or chaos and havoc will come upon you. 00044 */ 00045 00046 /** Constructor. */ 00047 ROSAspect::ROSAspect() 00048 { 00049 add_aspect("ROSAspect"); 00050 } 00051 00052 00053 /** Virtual empty destructor. */ 00054 ROSAspect::~ROSAspect() 00055 { 00056 } 00057 00058 00059 /** Init ROS aspect. 00060 * This set the ROS node handle. 00061 * It is guaranteed that this is called for an ROS Thread before start 00062 * is called (when running regularly inside Fawkes). 00063 * @param rosnode ROS node handle 00064 */ 00065 void 00066 ROSAspect::init_ROSAspect(LockPtr<ros::NodeHandle> rosnode) 00067 { 00068 this->rosnode = rosnode; 00069 } 00070 00071 /** Finalize ROS aspect. 00072 * This clears the ROS node handle. 00073 */ 00074 void 00075 ROSAspect::finalize_ROSAspect() 00076 { 00077 rosnode.clear(); 00078 } 00079 00080 } // end namespace fawkes