Agent class implements base agent interface and behavior. More...
#include <Agent.h>
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 Agent * | Clone () 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... | |
Agent & | operator= (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... | |
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::Agent | ( | const int & | id, |
const Point & | start, | ||
const Point & | goal, | ||
const Map & | map, | ||
const EnvironmentOptions & | options, | ||
AgentParam | param | ||
) |
Agent constructor with parameters.
id | Agent identifier number for debug and comparison. |
start | Start position of agent. |
goal | Goal position of agent. |
map | Static environment map. It contains information about grid and static obstacles boundaries. More about it see in Main page and Map class. |
options | Environment and algorithm options. See EnvironmentOptions class. |
param | agent and algorithm options. See AgentParam class. |
Agent::Agent | ( | const Agent & | obj | ) |
|
virtual |
|
pure virtual |
Abstract method for state updating and appling computed velocity.
Implemented in ORCAAgent.
|
pure virtual |
Abstract method for cloning inheritors objects. Implementations of this method should create copy of object in memmory and return pointer to copy.
Implemented in ORCAAgent.
|
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 |
Point Agent::GetGoal | ( | ) | const |
int Agent::GetID | ( | ) | const |
Point Agent::GetNext | ( | ) | const |
AgentParam Agent::GetParam | ( | ) | const |
Point Agent::GetPosition | ( | ) | const |
float Agent::GetRadius | ( | ) | const |
Point Agent::GetStart | ( | ) | const |
Point Agent::GetVelocity | ( | ) | const |
bool Agent::InitPath | ( | ) |
|
virtual |
bool Agent::operator!= | ( | const Agent & | another | ) | const |
bool Agent::operator== | ( | const Agent & | another | ) | const |
|
inline |
Set global planner object.
pl | Global planner object. Will be copied. Object should be inheritor of PathPlanner. |
|
virtual |
|
virtual |
void Agent::UpdateNeighbourObst | ( | ) |
|
pure virtual |
Abstract method for computing preffered velocity and chosing current goal. Can be ovveriden.
Implemented in ORCAAgent.