Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Friends | List of all members
PedVO::Agent Class Reference

Defines an agent in the simulation. More...

#include <PedVOAgent.h>

Inheritance diagram for PedVO::Agent:
Menge::Agents::BaseAgent Menge::Agents::ProximityQuery

Public Member Functions

 Agent ()
 A variant of the copy constructor.
 
 ~Agent ()
 Destroys this agent instance.
 
void computeNewVelocity ()
 Computes the new velocity of this agent.
 
size_t computeORCALines ()
 Based on the neighbors, computes the ORCA lines. More...
 
size_t computeORCALines (Vector2 &optVel, Vector2 &prefDir, float &prefSpeed)
 Based on the neighbors, computes the ORCA lines. More...
 
void setStrideParameters (float factor, float buffer)
 Sets the stride factor and stride buffer for estimating available space and determining viable speed. More...
 
void adaptPreferredVelocity ()
 Adapts the preferred velocity to conform to the local density. NOTE: This should ONLY be called after computing the baseline preferred velocity.
 
float getStrideConst () const
 Report the agent's stride constant. see BaseAgent::_strideConst. More...
 
float getSpeedConst () const
 Report the agent's speed constant. see BaseAgent::_speedConst. More...
 
- Public Member Functions inherited from Menge::Agents::BaseAgent
 BaseAgent ()
 Default constructor.
 
void initialize ()
 Initializes the agent.
 
void update (float timeStep)
 Updates the two-dimensional position and two-dimensional velocity of this agent. More...
 
void computeNewVelocity ()
 Given preferred velocity and neighboring agents and obstacles compute a new velocity. More...
 
const BaseAgentgetNeighbor (int idx) const
 Returns a pointer to the neighbor with given index. More...
 
const ObstaclegetObstacle (int idx) const
 Returns a pointer to the obstacle with given index. More...
 
void setPreferredVelocity (PrefVelocity &velocity)
 set the agents preferred velocity to the input velocity. More...
 
void addVelModifier (BFSM::VelModifier *v)
 Add an velocity modifier to the agent. More...
 
void insertAgentNeighbor (const BaseAgent *agent, float distSq)
 Inserts an agent neighbor into the set of neighbors of this agent. More...
 
void insertObstacleNeighbor (const Obstacle *obstacle, float distSq)
 Inserts a static obstacle neighbor into the set of neighbors of this agent. More...
 
virtual void startQuery ()
 clears the result vectors. Resets the filter
 
virtual void filterAgent (const BaseAgent *agent, float distance)
 filters an agent and determines if it needs to be in the near set More...
 
virtual void filterObstacle (const Obstacle *, float distance)
 filters an obstacle and determines if it needs to be in the near set More...
 
virtual Vector2 getQueryPoint ()
 gets the start point for the query More...
 
virtual float getMaxAgentRange ()
 updates the max agent query range if conditions inside the filter are met typically, we don't shrink the query range until the result set is full More...
 
virtual float getMaxObstacleRange ()
 updates the max query obstacle range if conditions inside the filter are met typically, we don't shrink the query range until the result set is full More...
 
- Public Member Functions inherited from Menge::Agents::ProximityQuery
 ProximityQuery ()
 default Constructor.
 

Public Attributes

std::vector< Menge::Math::Line_orcaLines
 The set of ORCA constraints.
 
bool _denseAware
 Controls if the agent respondes to density (true) or not (false).
 
float _strideConst
 One of two derived constants for fundamental diagram compliance. This is a function of the stride factor and stride buffer.
 
float _speedConst
 The second of two derived constants for fundamental diagram compliance. This is a function of the stride factor and stride buffer.
 
float _timeHorizon
 The time horizon for inter-agent interactions.
 
float _timeHorizonObst
 The time horizon for agent-obstacle interactions.
 
float _turningBias
 Turning bias.
 
- Public Attributes inherited from Menge::Agents::BaseAgent
float _maxSpeed
 The maximum speed the agent can take.
 
float _maxAccel
 The maximum acceleration the agent can experience (interpreted isotropically).
 
float _prefSpeed
 The preferred speed of the agent.
 
Vector2 _pos
 The current 2D position of the agent.
 
Vector2 _vel
 The current 2D velocity of the agent.
 
PrefVelocity _velPref
 The 2D preferred velocity of the agent.
 
Vector2 _velNew
 The new velocity computed in computeNewVelocity. More...
 
Vector2 _orient
 The orientation vector (the direction the agent is facing which is not necessarily the same direction as the instantaneous velocity. More...
 
float _maxAngVel
 The agent's maximum angular velocity (in radians/sec) – used for controlling the changes in agent orientation.
 
size_t _maxNeighbors
 The number of nearby agents used to plan dynamic respones.
 
float _neighborDist
 The maximum distance at which another agent will be considered for a response.
 
size_t _class
 The population class for this agent. More...
 
size_t _obstacleSet
 A mask indicating the obstacles with compatible ids which this agent can see. More...
 
float _priority
 The priority of each agent. More...
 
size_t _id
 A globally unique identifier for each agent.
 
float _radius
 The agent's radius. More...
 
std::vector< BFSM::VelModifier * > _velModifiers
 a set of velocity modifiers to be set with the agent. Allows for intermediate velocity changes
 
std::vector< NearAgent_nearAgents
 The nearby agents to which the agent should respond. More...
 
std::vector< NearObstacle_nearObstacles
 The nearby obstacles to which the agent should respond. More...
 

Static Public Attributes

static const float TAU = 2.5f
 The default time horizon for inter-agent interactions.
 
static const float TAU_OBST = 0.15f
 The default time horizon for agent-obstacle interactions.
 
static const float TURN_BIAS = 1.f
 The default turn bias.
 
static const float STRIDE_FACTOR = 1.57f
 The default stride factor value.
 
static const float STRIDE_BUFFER = 0.5f
 The default stride buffer value.
 

Protected Member Functions

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 side. If appropriate, it adds the obstacle to the set of orca lines. More...
 
- Protected Member Functions inherited from Menge::Agents::ProximityQuery
virtual ~ProximityQuery ()
 Virtual destructor.
 

Friends

class Simulator
 

Detailed Description

Defines an agent in the simulation.

Member Function Documentation

size_t PedVO::Agent::computeORCALines ( )

Based on the neighbors, computes the ORCA lines.

Returns
The total number of obstacle lines
size_t PedVO::Agent::computeORCALines ( Vector2 optVel,
Vector2 prefDir,
float &  prefSpeed 
)

Based on the neighbors, computes the ORCA lines.

Based on turning, defines the optimization velocity (in the case of turning, it would be aligned with the x-axis with the same magnitude. It also returns the unit vector and magnitude of the preferred velocity

Parameters
optVelThe vector2 containing, what will be used, for geometric optimization.
prefDirThe direction of the original preferred velocity This value is only set if the agent is turning.
prefSpeedThe magnitude of the original preferred velocity. This value is only set if the agent is turning.
Returns
The total number of obstacle lines
float PedVO::Agent::getSpeedConst ( ) const
inline

Report the agent's speed constant. see BaseAgent::_speedConst.

Returns
The agent's speed constant.
float PedVO::Agent::getStrideConst ( ) const
inline

Report the agent's stride constant. see BaseAgent::_strideConst.

Returns
The agent's stride constant.
void PedVO::Agent::obstacleLine ( size_t  obstNbrID,
const float  invTau,
bool  flip 
)
protected

Constructs an ORCA line for the given obstacle under the assumption that the agent is on its right side. If appropriate, it adds the obstacle to the set of orca lines.

Parameters
obstNbrIDThe index of the near-by obstacle to test.
invTau1 / _timeHorizonObst - the inverse of the time horizon for obstacles.
flipThe agent is on the left side of this obstacle.

These booleans short-cut the later code in which we make sure a leg direction does not cut into a "neighboring" obstacle.

In the case where the agent is "obliquely viewing" the obstacle near the left or right edge, we end up testing one of the legs against obstacle 1 itself. However, by definition, we know that both legs lie outside of the obstacle.

void PedVO::Agent::setStrideParameters ( float  factor,
float  buffer 
)
virtual

Sets the stride factor and stride buffer for estimating available space and determining viable speed.

Parameters
factorThe stride factor.
bufferThe stride buffer.

Reimplemented from Menge::Agents::BaseAgent.


The documentation for this class was generated from the following files: