Public Member Functions | List of all members
Agent Class Referenceabstract

Agent class implements base agent interface and behavior. More...

#include <Agent.h>

Inheritance diagram for Agent:
Inheritance graph
[legend]

Public Member Functions

virtual void AddNeighbour (Agent &neighbour, float distSq)
 Adds new neighbour. Only agents inside sight radius will be adeed. Can be ovveriden. More...
 
 Agent ()
 Agent default constructor. More...
 
 Agent (const int &id, const Point &start, const Point &goal, const Map &map, const EnvironmentOptions &options, AgentParam param)
 Agent constructor with parameters. More...
 
 Agent (const Agent &obj)
 Agent copy constructor. More...
 
virtual void ApplyNewVelocity ()=0
 Abstract method for state updating and appling computed velocity. More...
 
virtual AgentClone () const =0
 Abstract method for cloning inheritors objects. Implementations of this method should create copy of object in memmory and return pointer to copy. More...
 
virtual void ComputeNewVelocity ()=0
 Abstract method for new agent velocity computation. Implementations of this method should change newV field. More...
 
std::pair< unsigned int, unsigned int > GetCollision () const
 Returns collisions count. For debug purposes. More...
 
Point GetGoal () const
 Returns goal of agent. For ROS Simulation purposes. More...
 
int GetID () const
 Returns identifier of agent. More...
 
Point GetNext () const
 Returns current goal of agent. For debug purposes. More...
 
AgentParam GetParam () const
 Returns parameters of agent. For ROS Simulation purposes. More...
 
Point GetPosition () const
 Returns current position of Agent. More...
 
float GetRadius () const
 Returns radius of agent. More...
 
Point GetStart () const
 Returns start of agent. For ROS Simulation purposes. More...
 
Point GetVelocity () const
 Returns current velocity of agent. More...
 
bool InitPath ()
 Starts pathfinding from start to goal position. More...
 
virtual bool isFinished ()
 Checks, what the agent is on finish. To achieve finish agent should be at least in delta distance from goal position. More...
 
bool operator!= (const Agent &another) const
 Comparisons operator. Compares id of agents. More...
 
Agentoperator= (const Agent &obj)
 Assignment operator. More...
 
bool operator== (const Agent &another) const
 Comparisons operator. Compares id of agents. More...
 
template<class Planner >
void SetPlanner (const Planner &pl)
 Set global planner object. More...
 
virtual void SetPosition (const Point &pos)
 SetsS current position of agent. Can be ovveriden. More...
 
virtual void SetVelocity (const Point &vel)
 Sets current velocity. Should be used if the new velocity may not coincide with the computed. More...
 
void UpdateNeighbourObst ()
 Computes neighbouring obstacles. More...
 
virtual bool UpdatePrefVelocity ()=0
 Abstract method for computing preffered velocity and chosing current goal. Can be ovveriden. More...
 
virtual ~Agent ()
 Virtual destructor. More...
 

Detailed Description

Agent class implements base agent interface and behavior.

This class describes the interaction interface with the navigation algorithm. It is in the successor classes of Agent that it is supposed to implement a collision avoidance algorithm and the interaction between collision avoidance algorithm and path planner.

An illustration of the agent is presented in the figure below.

Agent sheme

Definition at line 95 of file Agent.h.

Constructor & Destructor Documentation

Agent::Agent ( )

Agent default constructor.

Definition at line 9 of file Agent.cpp.

Agent::Agent ( const int &  id,
const Point start,
const Point goal,
const Map map,
const EnvironmentOptions options,
AgentParam  param 
)

Agent constructor with parameters.

Parameters
idAgent identifier number for debug and comparison.
startStart position of agent.
goalGoal position of agent.
mapStatic environment map. It contains information about grid and static obstacles boundaries. More about it see in Main page and Map class.
optionsEnvironment and algorithm options. See EnvironmentOptions class.
paramagent and algorithm options. See AgentParam class.

Definition at line 33 of file Agent.cpp.

Agent::Agent ( const Agent obj)

Agent copy constructor.

Parameters
objAgent object to copy.

Definition at line 60 of file Agent.cpp.

Agent::~Agent ( )
virtual

Virtual destructor.

Definition at line 89 of file Agent.cpp.

Member Function Documentation

void Agent::AddNeighbour ( Agent neighbour,
float  distSq 
)
virtual

Adds new neighbour. Only agents inside sight radius will be adeed. Can be ovveriden.

Parameters
neighbourNeighboring agent
distSqSqured euclidian distance betwen agents

Definition at line 120 of file Agent.cpp.

virtual void Agent::ApplyNewVelocity ( )
pure virtual

Abstract method for state updating and appling computed velocity.

Implemented in ORCAAgent.

virtual Agent* Agent::Clone ( ) const
pure virtual

Abstract method for cloning inheritors objects. Implementations of this method should create copy of object in memmory and return pointer to copy.

Returns
Pointer to copy of object

Implemented in ORCAAgent.

virtual void Agent::ComputeNewVelocity ( )
pure virtual

Abstract method for new agent velocity computation. Implementations of this method should change newV field.

Implemented in ORCAAgent.

std::pair< unsigned int, unsigned int > Agent::GetCollision ( ) const

Returns collisions count. For debug purposes.

Returns
Pair of collisions counters: collisions with agents and collisions with static obstacles.

Definition at line 184 of file Agent.cpp.

Point Agent::GetGoal ( ) const

Returns goal of agent. For ROS Simulation purposes.

Returns
Global goal of agent.

Definition at line 253 of file Agent.cpp.

int Agent::GetID ( ) const

Returns identifier of agent.

Returns
Identifier of agent.

Definition at line 196 of file Agent.cpp.

Point Agent::GetNext ( ) const

Returns current goal of agent. For debug purposes.

Returns
Current goal of agent.

Definition at line 242 of file Agent.cpp.

AgentParam Agent::GetParam ( ) const

Returns parameters of agent. For ROS Simulation purposes.

Returns
Parameters of agent.

Definition at line 265 of file Agent.cpp.

Point Agent::GetPosition ( ) const

Returns current position of Agent.

Returns
Current position of Agent.

Definition at line 149 of file Agent.cpp.

float Agent::GetRadius ( ) const

Returns radius of agent.

Returns
Radius of agent.

Definition at line 202 of file Agent.cpp.

Point Agent::GetStart ( ) const

Returns start of agent. For ROS Simulation purposes.

Returns
Global start of agent.

Definition at line 259 of file Agent.cpp.

Point Agent::GetVelocity ( ) const

Returns current velocity of agent.

Returns
Current velocity of agent.

Definition at line 178 of file Agent.cpp.

bool Agent::InitPath ( )

Starts pathfinding from start to goal position.

Returns
Success of pathfinding.

Definition at line 190 of file Agent.cpp.

bool Agent::isFinished ( )
virtual

Checks, what the agent is on finish. To achieve finish agent should be at least in delta distance from goal position.

Returns
The agent achieve his goal position.

Definition at line 102 of file Agent.cpp.

bool Agent::operator!= ( const Agent another) const

Comparisons operator. Compares id of agents.

Parameters
anotherAgent to compare.
Returns
Inequality of this and another identifiers.

Definition at line 114 of file Agent.cpp.

Agent & Agent::operator= ( const Agent obj)

Assignment operator.

Parameters
objAgent to assignment.
Returns
Reference to agent.

Definition at line 208 of file Agent.cpp.

bool Agent::operator== ( const Agent another) const

Comparisons operator. Compares id of agents.

Parameters
anotherAgnet to compare.
Returns
equality of this and another identifiers.

Definition at line 108 of file Agent.cpp.

template<class Planner >
void Agent::SetPlanner ( const Planner &  pl)
inline

Set global planner object.

Parameters
plGlobal planner object. Will be copied. Object should be inheritor of PathPlanner.

Definition at line 267 of file Agent.h.

void Agent::SetPosition ( const Point pos)
virtual

SetsS current position of agent. Can be ovveriden.

Parameters
posNew position.

Definition at line 143 of file Agent.cpp.

void Agent::SetVelocity ( const Point vel)
virtual

Sets current velocity. Should be used if the new velocity may not coincide with the computed.

Parameters
velNew curren velocity.

Definition at line 247 of file Agent.cpp.

void Agent::UpdateNeighbourObst ( )

Computes neighbouring obstacles.

Definition at line 155 of file Agent.cpp.

virtual bool Agent::UpdatePrefVelocity ( )
pure virtual

Abstract method for computing preffered velocity and chosing current goal. Can be ovveriden.

Returns
Success of finding new current goal.

Implemented in ORCAAgent.


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


ORCAStar
Author(s): Stepan Drgachev
autogenerated on Wed Jul 15 2020 16:13:14