AIagent Class Reference

our AIagents and its methods and variables put in this file More...

#include <AIagent.h>

Collaboration diagram for AIagent:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 AIagent (std::string _file, PyObject *_main, PyObject *_dict, int _index, std::string _meshName, float _radius, Models *_model, Graph *_graph, Agent *_parent, std::string _type, int _ID, int _armyID, std::string _state)
 ctor
 AIagent (Agent *_parent, std::string _file, PyObject *_main, PyObject *_dict, ngl::Vec3 _pos, std::string _type, float _radius, Models *_model, Graph *_graph, std::string _meshName, int _ID)
 ctor
 ~AIagent ()
 dtor will clear the strings and close down the python interpretor
void update ()
 this method updates the agent
void draw (ngl::TransformStack *_tx, ngl::Camera *_cam)
 draw the scene
void reloadScript ()
 delete the old script and re-load
void setNewScriptPath (const std::string &_p)
 pass in a new script and load this replacing the old one
void setWallNormal (const ngl::Vec3 _normal, const float _dist)
 set the wall normal and the distance of the wall when the agent collides with the wall
void setApproachingAgentParams (const float _dist, const ngl::Vec3 _pos, const ngl::Vec3 _vel)
 set the approaching agent distance, velocity and position
ngl::Vec3 getPos ()
 get the agent position
ngl::Vec3 getVelocity ()
 get the agent velocity
ngl::Vec3 getForce ()
 get the agent force
void setPosition (const ngl::Vec3 pos)
 set the agent position
void setVelocity (const ngl::Vec3 vel)
 set the agent velocity
float getRadius ()
 get the agent mesh radius
void reset ()
 reset the agent
float getScore ()
 get the agent score
void setScore (const int _score)
 set the agent score
void resetScore ()
 to reset the agent score
int getReset ()
 get the reset value
std::string getName ()
 get the agent name
int getNextIndex ()
 get the next index of the graph that the agent traverses
int getIndex ()
 get the index of the graph that the agent traverses
void setIndex (const int _index)
 set the index of the graph that the agent traverses
void setNextIndex (const int _nextIndex)
 set the index of the graph that the agent traverses
void setRoute (std::vector< int > _route)
 set the route to the shortest path in the graph
int getPrecision ()
 get precision
Direction getDirection ()
 get the direction the agent is moving
void setDirection (int _direction)
 set the direction
void setIntialWallBool (bool _wall)
 set the initial bool value of the variable which indicates that the agent has not found the wall
std::string getMessage ()
 get the message the agent has
std::string getState ()
 get the state the agent is in
void setMessage (const std::string _message)
 set the message of the agent
ngl::Vec3 getTargetPos ()
 get the target position that the agent is in pursuit
void setTargetPos (const ngl::Vec3 _pos)
 set the target position
void setHitStatus ()
 set the hit status of the agent
bool getHitStatus ()
 get the hit status of the agent
std::string getType ()
 get the type of the agent
ngl::Vec3 getHomePos ()
 get the home position of the agents
void setState (const std::string _state)
 set the state of the agents
void queryEnvironment ()
 a method to query the environment to ask about the collisions

Public Attributes

bool m_wallCollision
 the bool to indicate the collision with wall
bool m_ObstacleCollision
 the bool to indicate the collision with other object
bool m_approachingAgent
 the bool to indicate the approaching agent
ngl::Vec3 m_wallNormal
 the normal of the wall that the agent collided with
float m_wallDistance
 the distance between the agent and the wall
float m_obstacleDistance
 the distance between the agent and the object
float m_radius
 the radius of the agent
ngl::Vec3 m_obsPos
 the position of the approaching agent
ngl::Vec3 m_obsVel
 the velocity of the approaching agent
int m_reset
 a variable that indicates which agent is reset to calculate the score
bool m_shootSphere
 the bool to indicate the shooting of spheres
bool m_shootBlock
 the bool to indicate the shooting of block
int m_iterator
 the iterator to retrive the route found by the shortest path
bool m_wall
 the bool to indicate the initial wall found while maze solving

Private Member Functions

void brainFunction ()

Private Attributes

ngl::Vec3 m_pos
 the position of the agent, this will be represented as pos in the python sctipt
ngl::Vec3 m_dir
 the direction of the agent, this will be represented as dir in the python sctipt
ngl::Vec3 m_velocity
 the speed of the agent, this will be represented as speed in the python sctipt
std::string * m_script
 the source string of the python script to be run
std::string m_filename
 the name of the source string loaded (for the re-load)
PyObject * m_main
 these are the python object we are going to hook into the above objects
PyObject * m_dict
 a pointer to the python dictionary for all variables in __main__
Brainm_brain
 a pointer to the brain of the agent
ngl::Vec3 m_tempVel
 a vector to hold the initial velocity used to reset
ngl::Vec3 m_tempPos
 a vector to hold the initial position used to reset
ngl::Vec3 m_force
 a vector to hold the initial force used to reset
Modelsm_model
 a pointer to hold the models variable
std::string m_meshName
 a string to hold the mesh name
std::list< Ammo * > m_ammo
 a list to hold the bullets
Graphm_graph
 a pointer to hold the graph variable
int m_index
 a variable to hold the index valuable that the agent is traversing
int m_nextIndex
 a variable to hold the nextIndex valuable that the agent is traversing
std::vector< int > m_route
 _route the std::vector of ints that contains the indices the agent has to traverse
int m_precision
 a variable to the precision
Direction m_direction
 an enumerated variable to indicate the direction of the agent
std::string m_message
 a variable to hold the message of the agent
Agentm_parent
 a pointer to the parent agent
bool m_hit
 a bool to indicate if the agent is hit or not
std::string m_type
 a variable to hold the type of the agent
int m_ID
 a variable to hold the ID of the agent
int m_armyID
 a variable to hold the army ID that the agent belongs to
std::string m_state
 a variable to hold the state of the agent
ngl::Vec3 m_targetPos
 a variable to hold the target position that the agent has to trvaers
float m_score
 a variable to hold the score of the agent

Detailed Description

our AIagents and its methods and variables put in this file

Definition at line 60 of file AIagent.h.


Constructor & Destructor Documentation

AIagent::AIagent ( std::string  _file,
PyObject *  _main,
PyObject *  _dict,
int  _index,
std::string  _meshName,
float  _radius,
Models _model,
Graph _graph,
Agent _parent,
std::string  _type,
int  _ID,
int  _armyID,
std::string  _state 
)

ctor

Parameters:
[in] the name of the python file to load, this will be stored so the file can be re-loaded.
[in] Python variable main
[in] Python variable dictionary
[in] the initial index on the graph node where the agent is placed
[in] the mesh name that is associated with the agent
[in] the radius for boundary and collision checking
[in] the model variable for meshes
[in] the graph variable for traversing
[in] the type of the agent
[in] the unique ID of the agent
[in] the unique army to which the agent belongs to
[in] the state in which the agent is created
AIagent::AIagent ( Agent _parent,
std::string  _file,
PyObject *  _main,
PyObject *  _dict,
ngl::Vec3  _pos,
std::string  _type,
float  _radius,
Models _model,
Graph _graph,
std::string  _meshName,
int  _ID 
)

ctor

Parameters:
[in] the name of the python file to load, this will be stored so the file can be re-loaded.
[in] Python variable main
[in] Python variable dictionary
[in] the initial position where the agent is placed
[in] the type of the agent
[in] the radius for boundary and collision checking
[in] the model variable for meshes
[in] the graph variable for traversing
[in] the mesh name that is associated with the agent
[in] the unique ID of the agent
AIagent::~AIagent (  ) 

dtor will clear the strings and close down the python interpretor


Member Function Documentation

void AIagent::brainFunction (  )  [private]
void AIagent::draw ( ngl::TransformStack *  _tx,
ngl::Camera *  _cam 
)

draw the scene

Parameters:
[in] _tx the transform stack of the current scene
[in] _cam the current camera
Direction AIagent::getDirection (  )  [inline]

get the direction the agent is moving

Definition at line 215 of file AIagent.h.

References m_direction.

00215 {return m_direction;}

ngl::Vec3 AIagent::getForce (  )  [inline]

get the agent force

Definition at line 145 of file AIagent.h.

References m_force.

00145 {return m_force;}

bool AIagent::getHitStatus (  )  [inline]

get the hit status of the agent

Definition at line 255 of file AIagent.h.

References m_hit.

00255 {return m_hit;}

ngl::Vec3 AIagent::getHomePos (  )  [inline]

get the home position of the agents

Definition at line 263 of file AIagent.h.

References m_tempPos.

00263 {return m_tempPos;}

int AIagent::getIndex (  )  [inline]

get the index of the graph that the agent traverses

Definition at line 192 of file AIagent.h.

References m_index.

00192 {return m_index;}

std::string AIagent::getMessage (  )  [inline]

get the message the agent has

Definition at line 229 of file AIagent.h.

References m_message.

00229 {return m_message;}

std::string AIagent::getName (  )  [inline]

get the agent name

Definition at line 184 of file AIagent.h.

References m_meshName.

00184 {return m_meshName;}

int AIagent::getNextIndex (  )  [inline]

get the next index of the graph that the agent traverses

Definition at line 188 of file AIagent.h.

References m_nextIndex.

00188 {return m_nextIndex;}

ngl::Vec3 AIagent::getPos (  )  [inline]

get the agent position

Definition at line 137 of file AIagent.h.

References m_pos.

00137 {return m_pos;}

int AIagent::getPrecision (  )  [inline]

get precision

Definition at line 211 of file AIagent.h.

References m_precision.

00211 {return m_precision;}

float AIagent::getRadius (  )  [inline]

get the agent mesh radius

Definition at line 159 of file AIagent.h.

References Models::getModel(), m_meshName, and m_model.

00159 {return m_model->getModel(m_meshName)->getSphereRadius();}

Here is the call graph for this function:

int AIagent::getReset (  )  [inline]

get the reset value

Definition at line 180 of file AIagent.h.

References m_reset.

00180 {return m_reset;}

float AIagent::getScore (  )  [inline]

get the agent score

Definition at line 167 of file AIagent.h.

References m_score.

00167 {return m_score;}

std::string AIagent::getState (  )  [inline]

get the state the agent is in

Definition at line 233 of file AIagent.h.

References m_state.

00233 {return m_state;}

ngl::Vec3 AIagent::getTargetPos (  )  [inline]

get the target position that the agent is in pursuit

Definition at line 242 of file AIagent.h.

References m_targetPos.

00242 {return m_targetPos;}

std::string AIagent::getType (  )  [inline]

get the type of the agent

Definition at line 259 of file AIagent.h.

References m_type.

00259 {return m_type;}

ngl::Vec3 AIagent::getVelocity (  )  [inline]

get the agent velocity

Definition at line 141 of file AIagent.h.

References m_velocity.

00141 {return m_velocity;}

void AIagent::queryEnvironment (  ) 

a method to query the environment to ask about the collisions

void AIagent::reloadScript (  ) 

delete the old script and re-load

void AIagent::reset (  ) 

reset the agent

void AIagent::resetScore (  )  [inline]

to reset the agent score

Definition at line 176 of file AIagent.h.

References m_score.

00176 {m_score = 0;}

void AIagent::setApproachingAgentParams ( const float  _dist,
const ngl::Vec3  _pos,
const ngl::Vec3  _vel 
) [inline]

set the approaching agent distance, velocity and position

Parameters:
[in] _dist the distance of the agent _pos the position of the agent and _vel the velocity of the agent

Definition at line 133 of file AIagent.h.

References m_obsPos, m_obstacleDistance, and m_obsVel.

00133 {m_obstacleDistance = _dist; m_obsPos = _pos;m_obsVel = _vel;}

void AIagent::setDirection ( int  _direction  ) 

set the direction

Parameters:
[in] _int new direction value which corresponds to the enumerated direction
void AIagent::setHitStatus (  )  [inline]

set the hit status of the agent

Definition at line 251 of file AIagent.h.

References m_hit.

00251 {m_hit = true;}

void AIagent::setIndex ( const int  _index  )  [inline]

set the index of the graph that the agent traverses

Parameters:
[in] _index the new index

Definition at line 197 of file AIagent.h.

References m_index.

00197 {m_index = _index;}

void AIagent::setIntialWallBool ( bool  _wall  )  [inline]

set the initial bool value of the variable which indicates that the agent has not found the wall

Parameters:
[in] _wall the bool value

Definition at line 225 of file AIagent.h.

References m_wall.

00225 {m_wall = _wall;}

void AIagent::setMessage ( const std::string  _message  )  [inline]

set the message of the agent

Parameters:
[in] the new message _message

Definition at line 238 of file AIagent.h.

References m_message.

00238 {m_message = _message;}

void AIagent::setNewScriptPath ( const std::string &  _p  ) 

pass in a new script and load this replacing the old one

Parameters:
[in] _p the path / name of the script to load.
void AIagent::setNextIndex ( const int  _nextIndex  )  [inline]

set the index of the graph that the agent traverses

Parameters:
[in] _nextIndex the new index

Definition at line 202 of file AIagent.h.

References m_nextIndex.

00202 {m_nextIndex = _nextIndex;}

void AIagent::setPosition ( const ngl::Vec3  pos  )  [inline]

set the agent position

Parameters:
[in] _pos to set new position

Definition at line 150 of file AIagent.h.

References m_pos.

00150 {m_pos = pos;}

void AIagent::setRoute ( std::vector< int >  _route  ) 

set the route to the shortest path in the graph

Parameters:
[in] _route the std::vector of ints that contains the indices the agent has to traverse
void AIagent::setScore ( const int  _score  )  [inline]

set the agent score

Parameters:
[in] _score the new score

Definition at line 172 of file AIagent.h.

References m_score.

00172 {m_score += _score;}

void AIagent::setState ( const std::string  _state  )  [inline]

set the state of the agents

Parameters:
[in] _state the new state

Definition at line 268 of file AIagent.h.

References m_state.

00268 {m_state = _state;}

void AIagent::setTargetPos ( const ngl::Vec3  _pos  )  [inline]

set the target position

Parameters:
[in] the new target position _pos

Definition at line 247 of file AIagent.h.

References m_targetPos.

00247 {m_targetPos = _pos;}

void AIagent::setVelocity ( const ngl::Vec3  vel  )  [inline]

set the agent velocity

Parameters:
[in] _vel to set new velocity

Definition at line 155 of file AIagent.h.

References m_velocity.

00155 {m_velocity = vel;}

void AIagent::setWallNormal ( const ngl::Vec3  _normal,
const float  _dist 
) [inline]

set the wall normal and the distance of the wall when the agent collides with the wall

Parameters:
[in] _normal the normal of the wall and the _dist distance between the wall

Definition at line 128 of file AIagent.h.

References m_wallDistance, and m_wallNormal.

00128 {m_wallNormal = _normal;m_wallDistance = _dist;}

void AIagent::update (  ) 

this method updates the agent


Member Data Documentation

std::list<Ammo *> AIagent::m_ammo [private]

a list to hold the bullets

Definition at line 393 of file AIagent.h.

the bool to indicate the approaching agent

Definition at line 284 of file AIagent.h.

int AIagent::m_armyID [private]

a variable to hold the army ID that the agent belongs to

Definition at line 441 of file AIagent.h.

Brain* AIagent::m_brain [private]

a pointer to the brain of the agent

Definition at line 369 of file AIagent.h.

PyObject* AIagent::m_dict [private]

a pointer to the python dictionary for all variables in __main__

Definition at line 365 of file AIagent.h.

ngl::Vec3 AIagent::m_dir [private]

the direction of the agent, this will be represented as dir in the python sctipt

Definition at line 344 of file AIagent.h.

an enumerated variable to indicate the direction of the agent

Definition at line 417 of file AIagent.h.

std::string AIagent::m_filename [private]

the name of the source string loaded (for the re-load)

Definition at line 355 of file AIagent.h.

ngl::Vec3 AIagent::m_force [private]

a vector to hold the initial force used to reset

Definition at line 381 of file AIagent.h.

Graph* AIagent::m_graph [private]

a pointer to hold the graph variable

Definition at line 397 of file AIagent.h.

bool AIagent::m_hit [private]

a bool to indicate if the agent is hit or not

Definition at line 429 of file AIagent.h.

int AIagent::m_ID [private]

a variable to hold the ID of the agent

Definition at line 437 of file AIagent.h.

int AIagent::m_index [private]

a variable to hold the index valuable that the agent is traversing

Definition at line 401 of file AIagent.h.

the iterator to retrive the route found by the shortest path

Definition at line 324 of file AIagent.h.

PyObject* AIagent::m_main [private]

these are the python object we are going to hook into the above objects

a hook into the python __main__ function where I program is to be run from

Definition at line 361 of file AIagent.h.

std::string AIagent::m_meshName [private]

a string to hold the mesh name

Definition at line 389 of file AIagent.h.

std::string AIagent::m_message [private]

a variable to hold the message of the agent

Definition at line 421 of file AIagent.h.

a pointer to hold the models variable

Definition at line 385 of file AIagent.h.

int AIagent::m_nextIndex [private]

a variable to hold the nextIndex valuable that the agent is traversing

Definition at line 405 of file AIagent.h.

ngl::Vec3 AIagent::m_obsPos

the position of the approaching agent

Definition at line 304 of file AIagent.h.

the bool to indicate the collision with other object

Definition at line 280 of file AIagent.h.

the distance between the agent and the object

Definition at line 296 of file AIagent.h.

ngl::Vec3 AIagent::m_obsVel

the velocity of the approaching agent

Definition at line 308 of file AIagent.h.

a pointer to the parent agent

Definition at line 425 of file AIagent.h.

ngl::Vec3 AIagent::m_pos [private]

the position of the agent, this will be represented as pos in the python sctipt

Definition at line 340 of file AIagent.h.

int AIagent::m_precision [private]

a variable to the precision

Definition at line 413 of file AIagent.h.

the radius of the agent

Definition at line 300 of file AIagent.h.

a variable that indicates which agent is reset to calculate the score

Definition at line 312 of file AIagent.h.

std::vector<int> AIagent::m_route [private]

_route the std::vector of ints that contains the indices the agent has to traverse

Definition at line 409 of file AIagent.h.

float AIagent::m_score [private]

a variable to hold the score of the agent

Definition at line 453 of file AIagent.h.

std::string* AIagent::m_script [private]

the source string of the python script to be run

Definition at line 351 of file AIagent.h.

the bool to indicate the shooting of block

Definition at line 320 of file AIagent.h.

the bool to indicate the shooting of spheres

Definition at line 316 of file AIagent.h.

std::string AIagent::m_state [private]

a variable to hold the state of the agent

Definition at line 445 of file AIagent.h.

ngl::Vec3 AIagent::m_targetPos [private]

a variable to hold the target position that the agent has to trvaers

Definition at line 449 of file AIagent.h.

ngl::Vec3 AIagent::m_tempPos [private]

a vector to hold the initial position used to reset

Definition at line 377 of file AIagent.h.

ngl::Vec3 AIagent::m_tempVel [private]

a vector to hold the initial velocity used to reset

Definition at line 373 of file AIagent.h.

std::string AIagent::m_type [private]

a variable to hold the type of the agent

Definition at line 433 of file AIagent.h.

ngl::Vec3 AIagent::m_velocity [private]

the speed of the agent, this will be represented as speed in the python sctipt

Definition at line 348 of file AIagent.h.

the bool to indicate the initial wall found while maze solving

Definition at line 328 of file AIagent.h.

the bool to indicate the collision with wall

Definition at line 276 of file AIagent.h.

the distance between the agent and the wall

Definition at line 292 of file AIagent.h.

the normal of the wall that the agent collided with

Definition at line 288 of file AIagent.h.


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

Generated on 16 Aug 2013 for Multi-AgentSystem by  doxygen 1.6.1