00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Robot Group Leipzig * 00003 * martius@informatik.uni-leipzig.de * 00004 * fhesse@informatik.uni-leipzig.de * 00005 * der@informatik.uni-leipzig.de * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 * * 00022 * $Log: selectiveone2onewiring.h,v $ 00023 * Revision 1.1.2.1 2005/11/16 11:24:28 martius 00024 * moved to selforg 00025 * 00026 * Revision 1.2 2005/10/24 13:32:07 fhesse 00027 * comments adjusted and in doxygen style 00028 * 00029 * Revision 1.1 2005/08/22 17:28:13 martius 00030 * a 1 to 1 wiring that supports the selection of some sensors only 00031 * 00032 * * 00033 ***************************************************************************/ 00034 #ifndef __SELECTIVEONE2ONEWIRING_H 00035 #define __SELECTIVEONE2ONEWIRING_H 00036 00037 #include "one2onewiring.h" 00038 00039 typedef bool (*select_predicate)(unsigned int index, unsigned int len); 00040 00041 bool select_all(unsigned int index, unsigned int len); 00042 bool select_firsthalf(unsigned int index, unsigned int len); 00043 00044 00045 /** 00046 * Implements a selective one to one wireing of robot sensors to inputs of the controller 00047 * and controller outputs to robot motors. 00048 */ 00049 class SelectiveOne2OneWiring : public One2OneWiring{ 00050 public: 00051 /** constructor 00052 @param noise NoiseGenerator that is used for adding noise to sensor values 00053 @param sel_sensor select_predicate describung what sensors should be selected 00054 */ 00055 SelectiveOne2OneWiring(NoiseGenerator* noise, select_predicate sel_sensor); 00056 virtual ~SelectiveOne2OneWiring(); 00057 00058 /** initializes the number of sensors and motors on robot side, calculate 00059 number of sensors and motors on controller side 00060 */ 00061 virtual bool init(int robotsensornumber, int robotmotornumber); 00062 00063 /// Realizes one to one wiring from robot sensors to controller sensors. 00064 // @param rsensors pointer to array of sensorvalues from robot 00065 // @param rsensornumber number of sensors from robot 00066 // @param csensors pointer to array of sensorvalues for controller 00067 // @param csensornumber number of sensors to controller 00068 // @param noise size of the noise added to the sensors 00069 virtual bool wireSensors(const sensor* rsensors, int rsensornumber, 00070 sensor* csensors, int csensornumber, 00071 double noise); 00072 00073 protected: 00074 select_predicate sel_sensor; 00075 00076 }; 00077 00078 #endif