00001 /*************************************************************************** 00002 * Copyright (C) 2005-2011 LpzRobots development team * 00003 * Georg Martius <georg dot martius at web dot de> * 00004 * Frank Guettler <guettler at informatik dot uni-leipzig dot de * 00005 + * Frank Hesse <frank at nld dot ds dot mpg dot de> * 00006 * Ralf Der <ralfder at mis dot mpg dot de> * 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. * 00012 * * 00013 * This program is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this program; if not, write to the * 00020 * Free Software Foundation, Inc., * 00021 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00022 * * 00023 ***************************************************************************/ 00024 #ifndef __OPERATOR_H 00025 #define __OPERATOR_H 00026 00027 #include "globaldata.h" 00028 00029 #include "pose.h" 00030 00031 00032 namespace lpzrobots { 00033 /** 00034 An Operator observes an agent (robot) and manipulates it if necessary. 00035 For instance if the robot is falled over the operator can flip it back. 00036 This is an abstract base class and subclasses should overload at least 00037 observe(). 00038 */ 00039 00040 class OdeAgent; 00041 00042 class Operator : public Configurable { 00043 public: 00044 /** type of manipulation of the robot (for display) and or operation 00045 RemoveOperator means that the operator should be removed 00046 */ 00047 enum ManipType {None, Limit, Move, RemoveOperator}; 00048 /// description of action (for visualization) 00049 struct ManipDescr { 00050 ManipDescr() : show(false), size(0.05,0.05,0.05){ 00051 } 00052 bool show; 00053 Pos pos; 00054 Pose orientation; 00055 Pos size; 00056 00057 }; 00058 00059 Operator( const std::string& name, const std::string& revision) 00060 : Configurable(name, revision) 00061 { 00062 } 00063 00064 virtual ~Operator(){ 00065 } 00066 00067 /** called every simulation step 00068 @return what was done with the robot 00069 */ 00070 virtual ManipType observe(OdeAgent* agent, GlobalData& global, ManipDescr& descr) = 0; 00071 00072 }; 00073 00074 } 00075 00076 #endif