Menge
Modular Pedestrian Simulation Framework for Research and Development
|
Defines the basic agent properties and functionality that all simulation agents share. More...
#include <BaseAgent.h>
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 BaseAgent * | getNeighbor (int idx) const |
Returns a pointer to the neighbor with given index. More... | |
const Obstacle * | getObstacle (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. | |
Defines the basic agent properties and functionality that all simulation agents share.
void Menge::Agents::BaseAgent::addVelModifier | ( | BFSM::VelModifier * | v | ) |
Add an velocity modifier to the agent.
v | The 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.
|
virtual |
filters an agent and determines if it needs to be in the near set
agent | the agent to consider |
distance | the distance to the agent |
Implements Menge::Agents::ProximityQuery.
|
virtual |
filters an obstacle and determines if it needs to be in the near set
obstacle | the obstacle to consider |
distance | the distance to the obstacle |
Implements Menge::Agents::ProximityQuery.
|
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
Implements Menge::Agents::ProximityQuery.
|
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
Implements Menge::Agents::ProximityQuery.
|
inline |
Returns a pointer to the neighbor with given index.
idx | The index of the desired agent. This index is not validated. |
|
inline |
Returns a pointer to the obstacle with given index.
idx | The index of the desired obstacle. This index is not validated. |
|
inlinevirtual |
gets the start point for the query
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.
agent | A pointer to the agent to be inserted. |
distSq | the 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.
obstacle | a pointer to the obstacle to be inserted |
distSq | the distance to the indicated obstacle |
void Menge::Agents::BaseAgent::setPreferredVelocity | ( | PrefVelocity & | velocity | ) |
set the agents preferred velocity to the input velocity.
velocity | to be applied to the agent. |
|
inlinevirtual |
Sets the density sensitivity parameters.
stride | The stride factor. The physical component capturing height and the physicl relationship between speed and stride length. |
buffer | The 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.
timeStep | The time step that will be taken. |
user-define max acceleration and the smallest required acceleration
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:
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.