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.2 2006/07/14 12:24:02 martius 00024 * selforg becomes HEAD 00025 * 00026 * Revision 1.1.2.1 2005/11/16 11:24:28 martius 00027 * moved to selforg 00028 * 00029 * Revision 1.2 2005/10/24 13:32:07 fhesse 00030 * comments adjusted and in doxygen style 00031 * 00032 * Revision 1.1 2005/08/22 17:28:13 martius 00033 * a 1 to 1 wiring that supports the selection of some sensors only 00034 * 00035 * * 00036 ***************************************************************************/ 00037 #ifndef __SELECTIVEONE2ONEWIRING_H 00038 #define __SELECTIVEONE2ONEWIRING_H 00039 00040 #include "one2onewiring.h" 00041 00042 typedef bool (*select_predicate)(unsigned int index, unsigned int len); 00043 00044 bool select_all(unsigned int index, unsigned int len); 00045 bool select_firsthalf(unsigned int index, unsigned int len); 00046 00047 00048 /** 00049 * Implements a selective one to one wireing of robot sensors to inputs of the controller 00050 * and controller outputs to robot motors. 00051 */ 00052 class SelectiveOne2OneWiring : public One2OneWiring{ 00053 public: 00054 /** constructor 00055 @param noise NoiseGenerator that is used for adding noise to sensor values 00056 @param sel_sensor select_predicate describung what sensors should be selected 00057 */ 00058 SelectiveOne2OneWiring(NoiseGenerator* noise, select_predicate sel_sensor); 00059 virtual ~SelectiveOne2OneWiring(); 00060 00061 /** initializes the number of sensors and motors on robot side, calculate 00062 number of sensors and motors on controller side 00063 */ 00064 virtual bool init(int robotsensornumber, int robotmotornumber); 00065 00066 /// Realizes one to one wiring from robot sensors to controller sensors. 00067 // @param rsensors pointer to array of sensorvalues from robot 00068 // @param rsensornumber number of sensors from robot 00069 // @param csensors pointer to array of sensorvalues for controller 00070 // @param csensornumber number of sensors to controller 00071 // @param noise size of the noise added to the sensors 00072 virtual bool wireSensors(const sensor* rsensors, int rsensornumber, 00073 sensor* csensors, int csensornumber, 00074 double noise); 00075 00076 protected: 00077 select_predicate sel_sensor; 00078 00079 }; 00080 00081 #endif
1.4.7