Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

AliceCommunication.h

Go to the documentation of this file.
00001 /*
00002     Enki - a fast 2D robot simulator
00003     Copyright (C) 1999-2005 Stephane Magnenat <nct@ysagoon.com>
00004     Copyright (C) 2004-2005 Markus Waibel <markus.waibel@epfl.ch>
00005     Copyright (C) 2005 Laboratory of Intelligent Systems, EPFL, Lausanne
00006     See AUTHORS for details
00007 
00008     This program is free software; the authors of any publication 
00009     arising from research using this software are asked to add the 
00010     following reference:
00011     Enki - a fast 2D robot simulator part of the Teem framework
00012     http://teem.epfl.ch
00013     Stephane Magnenat <stephane.magnenat@epfl.ch>,
00014     Markus Waibel <markus.waibel@epfl.ch>
00015     Laboratory of Intelligent Systems, EPFL, Lausanne.
00016 
00017     You can redistribute this program and/or modify
00018     it under the terms of the GNU General Public License as published by
00019     the Free Software Foundation; either version 2 of the License, or
00020     (at your option) any later version.
00021 
00022     This program is distributed in the hope that it will be useful,
00023     but WITHOUT ANY WARRANTY; without even the implied warranty of
00024     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00025     GNU General Public License for more details.
00026 
00027     You should have received a copy of the GNU General Public License
00028     along with this program; if not, write to the Free Software
00029     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00030 */
00031 
00032 #ifndef __ALICE_COMMUNICATION_H
00033 #define __ALICE_COMMUNICATION_H
00034 
00035 #include <enki/PhysicalEngine.h>
00036 #include <enki/Interaction.h>
00037 
00043 namespace Enki
00044 {
00046 
00049     class AliceCommunication : public LocalInteraction
00050     {
00051     protected:
00053         std::vector<std::pair<An::Vector, double> > sensors;
00055         std::vector<An::Vector> realSensors;
00057         bool updatedRealSensors;
00058         
00060         void computeRealSensors(void);
00061     
00063         bool enabled;
00065         unsigned transmitValue;
00066         
00068         bool wasReceived;
00070         unsigned receivedSensor;
00072         unsigned receivedValue;
00074         double smallestDistance2;
00075          
00076     public:
00078         AliceCommunication(double r, Robot *owner);
00080         void init();
00082         void objectStep(double dt, PhysicalObject *po, World *w);
00083         
00085         void addSensor(An::Vector pos, double ray);
00087         void setTransmitValue(unsigned val);
00089         void setTransmit(bool enabled);
00091         bool wasCommunication(void);
00093         bool wasCommunicationSent(void);
00095         unsigned getSensorId(void);
00097         unsigned char getSensorValue(void);
00098     };
00099 }
00100 
00101 #endif
00102 

Generated on Mon Oct 24 17:33:58 2005 for Enki by  doxygen 1.4.2