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 __FORCEBOOSTWIRING_H 00025 #define __FORCEBOOSTWIRING_H 00026 00027 #include "abstractwiring.h" 00028 #include "matrix.h" 00029 #include "configurable.h" 00030 00031 /** Implements one to one wiring that integrates the mismatch 00032 between motor commands (understood as target values) and 00033 sensor values and adds them to the controller output 00034 If more sensors than motors are used it uses just the first m sensors. 00035 */ 00036 class ForceBoostWiring: public AbstractWiring, public Configurable { 00037 public: 00038 /** constructor 00039 @param noise NoiseGenerator that is used for adding noise to sensor values 00040 @param plotMode see AbstractWiring 00041 @param boost factor for mismatch integration 00042 @param exportBoostError whether to export force boost error to inspectables 00043 (guilogger) 00044 */ 00045 ForceBoostWiring(NoiseGenerator* noise, double boost=0, bool exportBoostError=false, 00046 int plotMode=Controller, const std::string& name = "ForceBoostWiring"); 00047 00048 /** destructor 00049 */ 00050 virtual ~ForceBoostWiring(); 00051 00052 virtual void reset(); 00053 protected: 00054 00055 /** initializes the number of sensors and motors on robot side, calculate 00056 number of sensors and motors on controller side 00057 */ 00058 virtual bool initIntern(); 00059 00060 /** Realizes one to one wiring from robot sensors to controller sensors. 00061 @param rsensors pointer to array of sensorvalues from robot 00062 @param rsensornumber number of sensors from robot 00063 @param csensors pointer to array of sensorvalues for controller 00064 @param csensornumber number of sensors to controller 00065 @param noise size of the noise added to the sensors 00066 */ 00067 virtual bool wireSensorsIntern(const sensor* rsensors, int rsensornumber, 00068 sensor* csensors, int csensornumber, 00069 double noise); 00070 00071 /** Realizes one to one wiring from controller motor outputs to robot motors. 00072 @param rmotors pointer to array of motorvalues for robot 00073 @param rmotornumber number of robot motors 00074 @param cmotors pointer to array of motorvalues from controller 00075 @param cmotornumber number of motorvalues from controller 00076 */ 00077 virtual bool wireMotorsIntern(motor* rmotors, int rmotornumber, 00078 const motor* cmotors, int cmotornumber); 00079 00080 00081 protected: 00082 double boost; 00083 matrix::Matrix error; 00084 matrix::Matrix sens; 00085 }; 00086 00087 #endif