Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PedVOAgent.h
Go to the documentation of this file.
1 /*
2 
3 License
4 
5 Menge
6 Copyright and trademark 2012-14 University of North Carolina at Chapel Hill.
7 All rights reserved.
8 
9 Permission to use, copy, modify, and distribute this software and its documentation
10 for educational, research, and non-profit purposes, without fee, and without a
11 written agreement is hereby granted, provided that the above copyright notice,
12 this paragraph, and the following four paragraphs appear in all copies.
13 
14 This software program and documentation are copyrighted by the University of North
15 Carolina at Chapel Hill. The software program and documentation are supplied "as is,"
16 without any accompanying services from the University of North Carolina at Chapel
17 Hill or the authors. The University of North Carolina at Chapel Hill and the
18 authors do not warrant that the operation of the program will be uninterrupted
19 or error-free. The end-user understands that the program was developed for research
20 purposes and is advised not to rely exclusively on the program for any reason.
21 
22 IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS
23 BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
24 DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
25 DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
26 AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY
29 DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
30 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY STATUTORY WARRANTY
31 OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
32 THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS
33 TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
34 
35 Any questions or comments should be sent to the authors {menge,geom}@cs.unc.edu
36 
37 */
38 
44 #ifndef __PEDVO_AGENT_H__
45 #define __PEDVO_AGENT_H__
46 
47 #include "BaseAgent.h"
48 #include "Math/Line.h"
49 
50 namespace PedVO {
55  public:
59  Agent();
60 
64  ~Agent();
65 
69  void computeNewVelocity();
70 
76  size_t computeORCALines();
77 
93  size_t computeORCALines( Vector2 & optVel, Vector2 & prefDir, float & prefSpeed );
94 
98  std::vector<Menge::Math::Line> _orcaLines;
99 
107  void setStrideParameters( float factor, float buffer );
108 
115  void adaptPreferredVelocity();
116 
123  inline float getStrideConst() const { return _strideConst; }
124 
131  inline float getSpeedConst() const { return _speedConst; }
132 
136  bool _denseAware;
137 
143 
148  float _speedConst;
149 
154 
159 
164 
165  // DEFAULT VALUES FOR THE AGENT PARAMTERS
169  static const float TAU;
170 
174  static const float TAU_OBST;
175 
179  static const float TURN_BIAS;
180 
184  static const float STRIDE_FACTOR;
185 
189  static const float STRIDE_BUFFER;
190 
191  friend class Simulator;
192 
193  protected:
204  void obstacleLine( size_t obstNbrID, const float invTau, bool flip );
205  };
206 
221  bool linearProgram1(const std::vector<Menge::Math::Line>& lines, size_t lineNo,
222  float radius, const Vector2& optVelocity,
223  bool directionOpt, float turnBias, Vector2& result);
224 
237  size_t linearProgram2(const std::vector<Menge::Math::Line>& lines, float radius,
238  const Vector2& optVelocity, bool directionOpt,
239  float turnBias,
240  Vector2& result);
241 
253  void linearProgram3(const std::vector<Menge::Math::Line>& lines, size_t numObstLines, size_t beginLine,
254  float radius, float turnBias, Vector2& result);
255 } // namespace PedVO
256 #endif
static const float TAU_OBST
The default time horizon for agent-obstacle interactions.
Definition: PedVOAgent.h:174
float _timeHorizonObst
The time horizon for agent-obstacle interactions.
Definition: PedVOAgent.h:158
bool _denseAware
Controls if the agent respondes to density (true) or not (false).
Definition: PedVOAgent.h:136
float _speedConst
The second of two derived constants for fundamental diagram compliance. This is a function of the str...
Definition: PedVOAgent.h:148
Contains the specification of the pedestrian model based on Pedestrian Velocity Obstacles.
Definition: PedVOAgent.cpp:46
bool linearProgram1(const std::vector< Menge::Math::Line > &lines, size_t lineNo, float radius, const Vector2 &optVelocity, bool directionOpt, float turnBias, Vector2 &result)
Solves a one-dimensional linear program on a specified line subject to linear constraints defined by ...
Definition: PedVOAgent.cpp:600
Defines the simulator operating on ORCA::Agent.
Definition: PedVOSimulator.h:60
void setStrideParameters(float factor, float buffer)
Sets the stride factor and stride buffer for estimating available space and determining viable speed...
Definition: PedVOAgent.cpp:76
Contains the definition for an line used as a linear constraint (e.g. ORCA half plane) ...
static const float STRIDE_FACTOR
The default stride factor value.
Definition: PedVOAgent.h:184
static const float TURN_BIAS
The default turn bias.
Definition: PedVOAgent.h:179
void linearProgram3(const std::vector< Menge::Math::Line > &lines, size_t numObstLines, size_t beginLine, float radius, float turnBias, Vector2 &result)
Solves a two-dimensional linear program subject to linear constraints defined by lines and a circular...
Definition: PedVOAgent.cpp:715
void adaptPreferredVelocity()
Adapts the preferred velocity to conform to the local density. NOTE: This should ONLY be called after...
Definition: PedVOAgent.cpp:83
size_t linearProgram2(const std::vector< Menge::Math::Line > &lines, float radius, const Vector2 &optVelocity, bool directionOpt, float turnBias, Vector2 &result)
Solves a two-dimensional linear program subject to linear constraints defined by lines and a circular...
Definition: PedVOAgent.cpp:685
float _timeHorizon
The time horizon for inter-agent interactions.
Definition: PedVOAgent.h:153
void obstacleLine(size_t obstNbrID, const float invTau, bool flip)
Constructs an ORCA line for the given obstacle under the assumption that the agent is on its right si...
Definition: PedVOAgent.cpp:148
float _turningBias
Turning bias.
Definition: PedVOAgent.h:163
Defines an agent in the simulation.
Definition: PedVOAgent.h:54
std::vector< Menge::Math::Line > _orcaLines
The set of ORCA constraints.
Definition: PedVOAgent.h:98
~Agent()
Destroys this agent instance.
Definition: PedVOAgent.cpp:71
Contains the BaseAgent class - the underlying class which defines the basic functionality for all sha...
Agent()
A variant of the copy constructor.
Definition: PedVOAgent.cpp:61
float _strideConst
One of two derived constants for fundamental diagram compliance. This is a function of the stride fac...
Definition: PedVOAgent.h:142
Defines the basic agent properties and functionality that all simulation agents share.
Definition: BaseAgent.h:123
static const float STRIDE_BUFFER
The default stride buffer value.
Definition: PedVOAgent.h:189
static const float TAU
The default time horizon for inter-agent interactions.
Definition: PedVOAgent.h:169
void computeNewVelocity()
Computes the new velocity of this agent.
Definition: PedVOAgent.cpp:562
size_t computeORCALines()
Based on the neighbors, computes the ORCA lines.
Definition: PedVOAgent.cpp:140
float getStrideConst() const
Report the agent's stride constant. see BaseAgent::_strideConst.
Definition: PedVOAgent.h:123
float getSpeedConst() const
Report the agent's speed constant. see BaseAgent::_speedConst.
Definition: PedVOAgent.h:131