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 | List of all members
Menge::Agents::BaseAgent Class Reference

Defines the basic agent properties and functionality that all simulation agents share. More...

#include <BaseAgent.h>

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

Public Member Functions

 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 setStrideParameters (float stride, float buffer)
 Sets the density sensitivity parameters. 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

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...
 

Additional Inherited Members

- Protected Member Functions inherited from Menge::Agents::ProximityQuery
virtual ~ProximityQuery ()
 Virtual destructor.
 

Detailed Description

Defines the basic agent properties and functionality that all simulation agents share.

Member Function Documentation

void Menge::Agents::BaseAgent::addVelModifier ( BFSM::VelModifier v)

Add an velocity modifier to the agent.

Parameters
vThe modifier to add
void Menge::Agents::BaseAgent::computeNewVelocity ( )

Given preferred velocity and neighboring agents and obstacles compute a new velocity.

This should be overriden by child classes to give unique behaviors. Each pedestrian model is uniquely defined by how it computes its new velocity and this is the critical class.

Trying to instantiate a BaseAgent will cause an exception to be thrown when calling this function.

void Menge::Agents::BaseAgent::filterAgent ( const BaseAgent agent,
float  distance 
)
virtual

filters an agent and determines if it needs to be in the near set

Parameters
agentthe agent to consider
distancethe distance to the agent

Implements Menge::Agents::ProximityQuery.

void Menge::Agents::BaseAgent::filterObstacle ( const Obstacle obstacle,
float  distance 
)
virtual

filters an obstacle and determines if it needs to be in the near set

Parameters
obstaclethe obstacle to consider
distancethe distance to the obstacle

Implements Menge::Agents::ProximityQuery.

float Menge::Agents::BaseAgent::getMaxAgentRange ( )
virtual

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

Returns
The Max query range. Typically this is the initial range unless some special conditions are met

Implements Menge::Agents::ProximityQuery.

virtual float Menge::Agents::BaseAgent::getMaxObstacleRange ( )
inlinevirtual

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

Returns
The Max query range. Typically this is the initial range unless some special conditions are met

Implements Menge::Agents::ProximityQuery.

const BaseAgent* Menge::Agents::BaseAgent::getNeighbor ( int  idx) const
inline

Returns a pointer to the neighbor with given index.

Parameters
idxThe index of the desired agent. This index is not validated.
Returns
Pointer to the neighboring agent.
const Obstacle* Menge::Agents::BaseAgent::getObstacle ( int  idx) const
inline

Returns a pointer to the obstacle with given index.

Parameters
idxThe index of the desired obstacle. This index is not validated.
Returns
Pointer to the nearby obstacle.
virtual Vector2 Menge::Agents::BaseAgent::getQueryPoint ( )
inlinevirtual

gets the start point for the query

Returns
the query point for this filter

Implements Menge::Agents::ProximityQuery.

void Menge::Agents::BaseAgent::insertAgentNeighbor ( const BaseAgent agent,
float  distSq 
)

Inserts an agent neighbor into the set of neighbors of this agent.

Parameters
agentA pointer to the agent to be inserted.
distSqthe distance to the indicated agent
void Menge::Agents::BaseAgent::insertObstacleNeighbor ( const Obstacle obstacle,
float  distSq 
)

Inserts a static obstacle neighbor into the set of neighbors of this agent.

Parameters
obstaclea pointer to the obstacle to be inserted
distSqthe distance to the indicated obstacle
void Menge::Agents::BaseAgent::setPreferredVelocity ( PrefVelocity velocity)

set the agents preferred velocity to the input velocity.

Parameters
velocityto be applied to the agent.
virtual void Menge::Agents::BaseAgent::setStrideParameters ( float  stride,
float  buffer 
)
inlinevirtual

Sets the density sensitivity parameters.

Parameters
strideThe stride factor. The physical component capturing height and the physicl relationship between speed and stride length.
bufferThe stride buffer. The psychological buffer required beyond that needed for stride length.

Reimplemented in PedVO::Agent.

void Menge::Agents::BaseAgent::update ( float  timeStep)

Updates the two-dimensional position and two-dimensional velocity of this agent.

Parameters
timeStepThe time step that will be taken.

user-define max acceleration and the smallest required acceleration

Member Data Documentation

size_t Menge::Agents::BaseAgent::_class

The population class for this agent.

Used to define behavior and visualization properties.

std::vector<NearAgent> Menge::Agents::BaseAgent::_nearAgents

The nearby agents to which the agent should respond.

Each pair consists of distance between the agent positions, squared and the pointer to the neigboring agent.

std::vector<NearObstacle> Menge::Agents::BaseAgent::_nearObstacles

The nearby obstacles to which the agent should respond.

Each pair consists of distance between agent position and wall, squared and the pointer to the wall.

size_t Menge::Agents::BaseAgent::_obstacleSet

A mask indicating the obstacles with compatible ids which this agent can see.

This is a bitwise mask such that if the ith bit is 1, obstacles with id 2^i are visible.

Vector2 Menge::Agents::BaseAgent::_orient

The orientation vector (the direction the agent is facing which is not necessarily the same direction as the instantaneous velocity.

Not all pedestrian models require orientation in their calculation of a new velocity. However, by introducing the property here, we accomplish two things:

  • All agents which do require orientation can update their orientation in a common mechanism, making comparisons them less dependent on differences in orientation computation and focusing on differences in the new velocity computation.
  • Second, it provides orientation information to the output trajectories for later visualization.
float Menge::Agents::BaseAgent::_priority

The priority of each agent.

The relative priority of agents determines aspects of their interaction behavior.

float Menge::Agents::BaseAgent::_radius

The agent's radius.

If the agent is represented as a circle, then this is simply the circle's radius. If the agent is represented as an ellipse, then this is the radius perpendicular to the orientation. Other geometries should provide their own interpretation.

At a minimum, it is used to determine sideways clearance.

Vector2 Menge::Agents::BaseAgent::_velNew

The new velocity computed in computeNewVelocity.

This exists to allow the agents to be updated in parallel while preserving order-of-evaluation independence.


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