O --- O
libPEDSIM Documentation
[HOME] [EXAMPLES] [ECOSYSTEM] [DOCUMENTATION] [DOWNLOAD]
O --- O
ped_agent.h
1 //
2 // pedsim - A microscopic pedestrian simulation system.
3 // Copyright (c) by Christian Gloor
4 //
5 
6 
7 #ifndef _ped_agent_h_
8 #define _ped_agent_h_ 1
9 
10 //disable warnings on 255 char debug symbols
11 #pragma warning (disable : 4786)
12 //disable warnings on extern before template instantiation
13 #pragma warning (disable : 4231)
14 
15 #ifdef _WIN32
16 #ifdef _DLL
17 # define LIBEXPORT __declspec(dllexport)
18 # define EXPIMP_TEMPLATE
19 #else
20 # define LIBEXPORT __declspec(dllimport)
21 # define EXPIMP_TEMPLATE extern
22 #endif
23 #else
24 # define LIBEXPORT
25 # define EXPIMP_TEMPLATE
26 #endif
27 
28 #include "ped_vector.h"
29 #include "ped_waypoint.h"
30 
31 #include <deque>
32 #include <set>
33 #include <vector>
34 #include <cstdio>
35 
36 using namespace std;
37 
38 EXPIMP_TEMPLATE template class LIBEXPORT std::deque<Ped::Twaypoint*>;
39 
40 namespace Ped {
41  class Tscene;
42 
51  class LIBEXPORT Tagent {
52 
53  public:
54  Tagent();
55  virtual ~Tagent();
56 
57  virtual void computeForces();
58  virtual void move(double stepSizeIn);
59  virtual Tvector desiredForce();
60  virtual Tvector socialForce(const set<const Ped::Tagent*> &neighbors);
61  virtual Tvector obstacleForce(const set<const Ped::Tagent*> &neighbors);
62  virtual Tvector lookaheadForce(Tvector desired, const set<const Ped::Tagent*> &neighbors);
63  virtual Tvector myForce(Tvector desired, const set<const Ped::Tagent*> &neighbors);
64 
65  void setType(int t) { this->type = t; };
66  int getType() const { return type; };
67 
68  void setVmax(double vmax);
69  double getVmax();
70 
71  void setFollow(int id);
72  int getFollow() const;
73 
74  int getid() const { return id; };
75 
76  void setPosition(double px, double py, double pz);
77  void setPosition(const Tvector &pos) { p = pos; };
78  Tvector getPosition() const { return p; }
79  Tvector getVelocity() const { return v; }
80  Tvector getAcceleration() const { return a; }
81 
82  void setfactorsocialforce(double f);
83  void setfactorobstacleforce(double f);
84  void setfactordesiredforce(double f);
85  void setfactorlookaheadforce(double f);
86 
87  void setscene(Tscene* s);
88  Tscene* getscene();
89 
90  void addWaypoint(Twaypoint* wp);
91  bool removeWaypoint(const Twaypoint* wp);
92  void clearWaypoints();
93  deque<Twaypoint*> getWaypoints() { return waypoints; };
94 
95  // void removeAgentFromNeighbors(const Tagent* agentIn);
96 
97  bool reachedDestination() const { return (destination == NULL); };
98  void setWaypointBehavior(int mode) { waypointbehavior = mode; };
99 
100  enum WaypointBehavior {
101  BEHAVIOR_CIRCULAR = 0,
102  BEHAVIOR_ONCE = 1
103  };
104 
105 
106  protected:
107  int id;
111  int type;
112  double vmax;
113  int follow;
114 
115  Ped::Tvector desiredDirection;
116 
117  Ped::Tscene* scene;
118 
119  deque<Twaypoint*> waypoints;
123 
124  bool mlLookAhead;
125 
126  double factordesiredforce;
127  double factorsocialforce;
128  double factorobstacleforce;
129  double factorlookaheadforce;
130 
131  double obstacleForceSigma;
132 
133  Ped::Tvector desiredforce;
134  Ped::Tvector socialforce;
135  Ped::Tvector obstacleforce;
136  Ped::Tvector lookaheadforce;
137  Ped::Tvector myforce;
138 
139  double relaxationTime;
140 
141  double agentRadius;
142 
143  // set<const Ped::Tagent*> neighbors;
144 
145  long timestep;
146  };
147 }
148 #endif
Tvector a
current acceleration of the agent
Definition: ped_agent.h:110
Tvector p
current position of the agent
Definition: ped_agent.h:108
deque< Twaypoint * > waypoints
coordinates of the next destinations
Definition: ped_agent.h:119
Twaypoint * lastdestination
coordinates of the last destination
Definition: ped_agent.h:121
int waypointbehavior
waypoints are round queues or not.
Definition: ped_agent.h:122
double vmax
individual max velocity per agent
Definition: ped_agent.h:112
int id
agent number
Definition: ped_agent.h:107
Twaypoint * destination
coordinates of the next destination
Definition: ped_agent.h:120
Tvector v
velocity of the agent
Definition: ped_agent.h:109
O --- O

⁠(c) Christian Gloor [ c|h|g|l|o|o|r|@|s|i|l|m|a|r|i|l|.|o|r|g| ]