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

Class which determines the agent properties for each new ORCA agent. More...

#include <ORCAInitializer.h>

Inheritance diagram for ORCA::AgentInitializer:
Menge::Agents::AgentInitializer

Public Member Functions

 AgentInitializer ()
 Constructor. More...
 
 AgentInitializer (const AgentInitializer &init)
 Copy Constructor. More...
 
virtual ~AgentInitializer ()
 Destructor.
 
virtual bool setProperties (Menge::Agents::BaseAgent *agent)
 Sets the properties of the given agent based on the initializer's values. More...
 
virtual void setDefaults ()
 Sets all generators to default values. More...
 
virtual
Menge::Agents::AgentInitializer
copy () const
 Creates a copy of this AgentInitializer instance. More...
 
- Public Member Functions inherited from Menge::Agents::AgentInitializer
 AgentInitializer ()
 Constructor. More...
 
 AgentInitializer (const AgentInitializer &init)
 Copy Constructor. More...
 
bool parseProperties (TiXmlElement *node, const std::string &sceneFldr)
 Parses an AgentSet property tag, setting agent values as appropriate. More...
 

Protected Member Functions

virtual bool isRelevant (const ::std::string &tagName)
 Reports if this AgentInitializer cares about the given AgentSet property XML tag. More...
 
virtual
Menge::Agents::AgentInitializer::ParseResult 
setFromXMLAttribute (const ::std::string &paramName, const ::std::string &value)
 Defines a constant value for an agent property as specified by the attribute of an agent property tag. More...
 
virtual ParseResult processProperty (::std::string propName, TiXmlElement *node)
 Process the given <Property .../> tag. More...
 
- Protected Member Functions inherited from Menge::Agents::AgentInitializer
bool parsePropertySpec (TiXmlElement *node)
 Parses the Property tag that is the child of an AgentSet Parameter tag. More...
 
ParseResult constFloatGenerator (FloatGenerator *&gen, const ::std::string &valueStr, float scale=1.f)
 Helper function for setting a property from an xml attribute. More...
 
ParseResult constFloat (float &numValue, const ::std::string &valueStr, float scale=1.f)
 Helper function for setting a property from an xml attribute. More...
 
ParseResult constIntGenerator (IntGenerator *&gen, const ::std::string &valueStr)
 Helper function for setting a property from an xml attribute. More...
 
ParseResult constSizet (size_t &numValue, const ::std::string &valueStr)
 Helper function for setting a property from an xml attribute. More...
 
ParseResult getFloatGenerator (FloatGenerator *&gen, TiXmlElement *node, float scale=1.f)
 Helper function for setting a property from an xml Property node. More...
 
ParseResult getIntGenerator (IntGenerator *&gen, TiXmlElement *node)
 Helper function for setting a property from an xml Property node. More...
 

Protected Attributes

FloatGenerator_timeHorizon
 The time horizon for predicting agent collisions.
 
FloatGenerator_timeHorizonObst
 The time horizon for predicting obstacle collisions.
 
- Protected Attributes inherited from Menge::Agents::AgentInitializer
FloatGenerator_maxSpeed
 The maximum speed the agent can take.
 
FloatGenerator_maxAccel
 The maximum acceleration the agent can experience (interpreted isotropically).
 
FloatGenerator_prefSpeed
 The preferred speed of the agent.
 
IntGenerator_maxNeighbors
 The number of nearby agents used to plan dynamic respones.
 
FloatGenerator_neighborDist
 The maximum distance at which another agent will be considered for a response.
 
FloatGenerator_radius
 The agent's radius. See Agents::BaseAgent::_radius for details.
 
FloatGenerator_maxAngVel
 The agent's maximum angular velocity (in radians/sec) – used for controlling the changes in agent orientation.
 
size_t _obstacleSet
 A mask indicating which obstacles affect the agent. See Agents::BaseAgent::_obstacleSet for details.
 
float _priority
 The priority of each agent. See Agents::BaseAgent::_priority for details.
 
size_t _class
 The population class for this agent. See Agents::BaseAgent::_class for details.
 
std::vector< BFSM::VelModifier * > _velModifiers
 Velocity Modifiers to be applied to this class.
 

Additional Inherited Members

- Public Types inherited from Menge::Agents::AgentInitializer
enum  ParseResult { FAILURE = 0, IGNORED, ACCEPTED }
 Return type for parsing efforts. Helps the various derived classes coordinate their work. More...
 
- Static Public Attributes inherited from Menge::Agents::AgentInitializer
static bool VERBOSE = false
 Determines if the agent properties parsing process will be verbose.
 

Detailed Description

Class which determines the agent properties for each new ORCA agent.

Constructor & Destructor Documentation

ORCA::AgentInitializer::AgentInitializer ( )

Constructor.

The values for each agent take a hard-coded default values.

ORCA::AgentInitializer::AgentInitializer ( const AgentInitializer init)

Copy Constructor.

Parameters
initThe AgentInitializer to copy all values from.

Member Function Documentation

virtual Menge::Agents::AgentInitializer* ORCA::AgentInitializer::copy ( ) const
inlinevirtual

Creates a copy of this AgentInitializer instance.

Returns
A pointer to a new AgentInitializer with all of the same values as this. The caller is responsible for freeing up the new instance.

Reimplemented from Menge::Agents::AgentInitializer.

bool ORCA::AgentInitializer::isRelevant ( const ::std::string &  tagName)
protectedvirtual

Reports if this AgentInitializer cares about the given AgentSet property XML tag.

This is the mechanism by which new sub-classes can extend the parameter space. Each pedestrian model which introduces new per-agent properties that must override this function. However, the overriden function must, in turn, call the parent class if it doesn't consider the tag relevant, giving the parent class a chance to determine if the tag is relevant. This is the mechanism by which derived classes will also benefit from the <ORCA> parameter set defined in the base class (or any other derived dependency).

Parameters
tagNameThe name of the tag to test.
Returns
True if the tag is relevant, false otherwise.

Reimplemented from Menge::Agents::AgentInitializer.

Menge::Agents::AgentInitializer::ParseResult ORCA::AgentInitializer::processProperty ( ::std::string  propName,
TiXmlElement *  node 
)
protectedvirtual

Process the given <Property .../> tag.

As a pre-condition to this function, the XML node contains a <Property.../> tag and has been confirmed to have, at least, a name attribute. Nothing else about the tag has been validated.

If the property name is unexpected, it will be ignored. If it is expected, this function will attempt to interpret the XML tag as a number distribution for a valid agent attribute. If it can do so, it is successful, if it can't, it fails.

Parameters
propNameThe extractd "name" property from the Property tag.
nodeThe XML node for the Property tag.
Returns
True if parsing was "successful", false otherwise.

Reimplemented from Menge::Agents::AgentInitializer.

void ORCA::AgentInitializer::setDefaults ( )
virtual

Sets all generators to default values.

Resets all number generators to default const values. This assumes that all required number generators already exist and will delete them appropriately. Do not call this in the constructor.

Reimplemented from Menge::Agents::AgentInitializer.

Menge::Agents::AgentInitializer::ParseResult ORCA::AgentInitializer::setFromXMLAttribute ( const ::std::string &  paramName,
const ::std::string &  value 
)
protectedvirtual

Defines a constant value for an agent property as specified by the attribute of an agent property tag.

Derived classes should override this function, but possibly call the parent class's implementation. First, it should test to see if the paramName is expected by the derived class. If so, the derived class can determine fail or accept. If it is not expected, it should call the parent class's implementation and returns its value.

Parameters
paramNameA string containing the parameter name.
valueA string containing the value for the parameter.
Returns
The result of the parse: failure, ignored, or accepted.

Reimplemented from Menge::Agents::AgentInitializer.

bool ORCA::AgentInitializer::setProperties ( Menge::Agents::BaseAgent agent)
virtual

Sets the properties of the given agent based on the initializer's values.

This needs to be overridden by sub-classes. The first thing the sub-class should do is dynamic_cast the argument to its expected type to make sure it is the proper agent type. If not, this should be considered failure. Then it should set its unique properties an+d then call the super class's setProperties function.

Parameters
agentThe agent whose properties are to be set.
Returns
True if the properties were set successfully, false otherwise.

Reimplemented from Menge::Agents::AgentInitializer.


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