Enki  1.9
Interaction.h
Go to the documentation of this file.
1 /*
2  Enki - a fast 2D robot simulator
3  Copyright (C) 1999-2016 Stephane Magnenat <stephane at magnenat dot net>
4  Copyright (C) 2004-2005 Markus Waibel <markus dot waibel at epfl dot ch>
5  Copyright (c) 2004-2005 Antoine Beyeler <abeyeler at ab-ware dot com>
6  Copyright (C) 2005-2006 Laboratory of Intelligent Systems, EPFL, Lausanne
7  Copyright (C) 2006-2008 Laboratory of Robotics Systems, EPFL, Lausanne
8  See AUTHORS for details
9 
10  This program is free software; the authors of any publication
11  arising from research using this software are asked to add the
12  following reference:
13  Enki - a fast 2D robot simulator
14  http://home.gna.org/enki
15  Stephane Magnenat <stephane at magnenat dot net>,
16  Markus Waibel <markus dot waibel at epfl dot ch>
17  Laboratory of Intelligent Systems, EPFL, Lausanne.
18 
19  You can redistribute this program and/or modify
20  it under the terms of the GNU General Public License as published by
21  the Free Software Foundation; either version 2 of the License, or
22  (at your option) any later version.
23 
24  This program is distributed in the hope that it will be useful,
25  but WITHOUT ANY WARRANTY; without even the implied warranty of
26  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  GNU General Public License for more details.
28 
29  You should have received a copy of the GNU General Public License
30  along with this program; if not, write to the Free Software
31  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 */
33 
34 #ifndef __ENKI_INTERACTION_H
35 #define __ENKI_INTERACTION_H
36 
45 namespace Enki
46 {
47  class PhysicalObject;
48  class Robot;
49  class World;
50 
52 
54  {
55  protected:
57  double r;
58 
60  friend class Robot;
63 
64  public :
66  LocalInteraction():r(0) {}
68  LocalInteraction(double range, Robot* owner) : r(range), owner(owner) {}
70  virtual ~LocalInteraction() { }
72  virtual void init(double dt, World* w) { }
74 
79  virtual void objectStep(double dt, World* w, PhysicalObject *po) { }
81 
84  virtual void wallsStep(double dt, World* w) { }
86  virtual void finalize(double dt, World* w) { }
88  double getRange() const { return r; }
89  };
90 
92 
94  {
95  protected:
98 
99  public :
103  GlobalInteraction(Robot* owner) : owner(owner) {}
105  virtual ~GlobalInteraction() { }
107  virtual void init(double dt, World *w) { }
109  virtual void step(double dt, World *w) { }
111  virtual void finalize(double dt, World *w) { }
112  };
113 }
114 #endif
115 
virtual ~GlobalInteraction()
Destructor.
Definition: Interaction.h:105
virtual void finalize(double dt, World *w)
Finalize at each step.
Definition: Interaction.h:86
virtual void finalize(double dt, World *w)
Finalize at each step.
Definition: Interaction.h:111
virtual void init(double dt, World *w)
Init at each step.
Definition: Interaction.h:107
A situated object in the world with mass, geometry properties, physical properties, ...
Definition: PhysicalEngine.h:131
virtual void init(double dt, World *w)
Init at each step.
Definition: Interaction.h:72
Enki is the namespace of the Enki simulator. All Enki functions and classes excepted the math one are...
Definition: BluetoothBase.cpp:44
GlobalInteraction(Robot *owner)
Constructor.
Definition: Interaction.h:103
double r
Radius of the local interaction.
Definition: Interaction.h:57
Robot * owner
The physical object that owns the interaction.
Definition: Interaction.h:62
virtual void objectStep(double dt, World *w, PhysicalObject *po)
Interact with object.
Definition: Interaction.h:79
virtual ~LocalInteraction()
Destructor.
Definition: Interaction.h:70
LocalInteraction()
Constructor.
Definition: Interaction.h:66
The world is the container of all objects and robots.
Definition: PhysicalEngine.h:411
Interacts with the whole world.
Definition: Interaction.h:93
virtual void step(double dt, World *w)
Interact with world.
Definition: Interaction.h:109
LocalInteraction(double range, Robot *owner)
Constructor.
Definition: Interaction.h:68
Robot * owner
The physical object that owns the interaction.
Definition: Interaction.h:97
GlobalInteraction()
Constructor.
Definition: Interaction.h:101
double getRange() const
Return the range of the interaction.
Definition: Interaction.h:88
Interacts with another object or wall only up to a certain distance.
Definition: Interaction.h:53
virtual void wallsStep(double dt, World *w)
Interact with walls.
Definition: Interaction.h:84
A robot is a PhysicalObject that has additional interactions and a controller.
Definition: PhysicalEngine.h:379