enki/robots/alice/AliceCommunication.h

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

Generated on Sun Mar 1 03:10:09 2009 for Enki by  doxygen 1.5.1