O --- O
libpedsim Documentation [HOME] [EXAMPLES] [DEMO APP] [DOCUMENTATION] [DOWNLOAD]
|
O --- O
|

Ped::Tagent Class Reference

#include <ped_agent.h>

List of all members.

Public Member Functions

 Tagent ()
virtual ~Tagent ()
virtual void move (double h)
virtual Tvector socialForce ()
virtual Tvector obstacleForce ()
virtual Tvector desiredForce ()
virtual Tvector lookaheadForce (Tvector desired)
virtual void print () const
void setPosition (double px, double py, double pz)
void setType (int t)
void setFollow (int id)
void setVmax (double vmax)
int getFollow () const
int getid () const
int gettype () const
double getx () const
double gety () const
double getz () const
double getax () const
double getay () const
double getaz () const
double getvx () const
double getvy () const
double getvz () const
void setfactorsocialforce (double f)
void setfactorobstacleforce (double f)
void setfactordesiredforce (double f)
void setfactorlookaheadforce (double f)
void addWaypoint (Twaypoint *wp)
void assignScene (Tscene *s)

Detailed Description

This is the main class of the library. It contains the Tagent, which eventually will move through the Tscene and interact with Tobstacle and other Tagent. You can use it as it is, and access the agent's coordinates using the getx() etc methods. Or, if you want to change the way the agent behaves, you can derive a new class from it, and overwrite the methods you want to change. This is also a convenient way to get access to internal variables not available though public methods, like the individual forces that affect the agent.

Author:
chgloor
Date:
2003-12-26
Examples:

example.cpp.


Constructor & Destructor Documentation

Ped::Tagent::Tagent ( )

Default Constructor

Date:
2003-12-29
Ped::Tagent::~Tagent ( ) [virtual]

Default destructor

Date:
2012-02-04

Member Function Documentation

void Ped::Tagent::addWaypoint ( Twaypoint wp)

Adds a TWaypoint to an agent's list of waypoints. Twaypoints are stored in a cyclic queue, the one just visited is pushed to the back again. There will be a flag to change this behavior soon.

Todo:
Add a flag to change the waypoint queue behavior of the Tagents.
Author:
chgloor
Date:
2012-01-19
Examples:
example.cpp.
void Ped::Tagent::assignScene ( Ped::Tscene s)

Assigns a Tscene to the agent. Tagent uses this to iterate over all obstacles and other agents in a scene. The scene will invoke this function when Tscene::addAgent() is called.

Date:
2012-01-17
Warning:
Bad things will happen if the agent is not assigned to a scene. But usually, Tscene takes care of that.
Parameters:
*sA valid Tscene initialized earlier.

Referenced by Ped::Tscene::addAgent().

Ped::Tvector Ped::Tagent::desiredForce ( ) [virtual]

Calculates the force between this agent and the next assigned waypoint. If the waypoint has been reached, the next waypoint in the list will be selected. At the moment, a visited waypoint is pushed back to the end of the list, which means that the agents will visit all the waypoints over and over again. In a later release, this behavior can be controlled by a flag.

Date:
2012-01-17
Returns:
Tvector: the calculated force
int Ped::Tagent::getFollow ( ) const

Gets the ID of the agent this agent is following.

Date:
2012-01-18
Returns:
int, the agent id of the agent
Todo:
Add a method that returns a Tagent*
Ped::Tvector Ped::Tagent::lookaheadForce ( Ped::Tvector  e) [virtual]

Calculates the mental layer force of the strategy "look ahead". It is implemented here in the physical layer because of performance reasons. It iterates over all Tagents in the Tscene, complexity O(N^2).

Date:
2012-01-17
Returns:
Tvector: the calculated force
Parameters:
eis a vector defining the direction in which the agent should look ahead to. Usually, this is the direction he wants to walk to.
void Ped::Tagent::move ( double  h) [virtual]

Does the agent dynamics stuff. Calls the methods to calculate the individual forces, adds them to get the total force aggecting the agent. This will then be translated into a velocity difference, which is applied to the agents velocity, and then to its position.

Date:
2003-12-29
Parameters:
hThis tells the simulation how far the agent should proceed (also known as Tau in literature). 1 = 1 unit.
Examples:
example.cpp.

Referenced by Ped::Tscene::moveAgents().

Ped::Tvector Ped::Tagent::obstacleForce ( ) [virtual]

Calculates the force between this agent and the nearest obstacle in this scene. Iterates over all obstacles == O(N).

Date:
2012-01-17
Returns:
Tvector: the calculated force
void Ped::Tagent::setfactordesiredforce ( double  f)

Sets the factor by which the desired force is multiplied. Values between 0 and about 10 do make sense.

Date:
2012-01-20
Parameters:
fThe factor
void Ped::Tagent::setfactorlookaheadforce ( double  f)

Sets the factor by which the look ahead force is multiplied. Values between 0 and about 10 do make sense.

Date:
2012-01-20
Parameters:
fThe factor
void Ped::Tagent::setfactorobstacleforce ( double  f)

Sets the factor by which the obstacle force is multiplied. Values between 0 and about 10 do make sense.

Date:
2012-01-20
Parameters:
fThe factor
void Ped::Tagent::setfactorsocialforce ( double  f)

Sets the factor by which the social force is multiplied. Values between 0 and about 10 do make sense.

Date:
2012-01-20
Parameters:
fThe factor
void Ped::Tagent::setFollow ( int  id)

Sets the agent ID this agent has to follow. If set, the agent will ignore its assigned waypoints and just follow the other agent.

Date:
2012-01-08
Parameters:
idis the agent to follow (must exist, obviously)
Todo:
Add a method that takes a Tagent* as argument
void Ped::Tagent::setPosition ( double  px,
double  py,
double  pz 
)

Sets the agent's position. This, and other getters returning coordinates, will eventually changed to returning a Tvector.

Date:
2004-02-10
Parameters:
pxPosition x
pyPosition y
pzPosition z
Examples:
example.cpp.
void Ped::Tagent::setVmax ( double  pvmax)

Sets the maximum velocity of an agent (vmax). Even if pushed by other agents, it will not move faster than this.

Date:
2012-01-08
Parameters:
pvmaxThe maximum velocity. In scene units per timestep, multiplied by the simulation's precision h.
Ped::Tvector Ped::Tagent::socialForce ( ) [virtual]

Calculates the social force between this agent and all the other agents belonging to the same scene. It iterates over all agents inside the scene, has therefore the complexity O(N^2). A better agent storing structure in Tscene would fix this. But for small (less than 10000 agents) scenarios, this is just fine.

Date:
2012-01-17
Returns:
Tvector: the calculated force

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




(c) 1995-2012 by Christian Gloor [contact]