PPL API Reference |
|
---|
Public Member Functions | |
Agent Properties | |
Robot * | GetRobot () const noexcept |
Get the robot object to which this agent belongs. | |
virtual bool | IsChild () const noexcept |
Is this agent a child of some group/aggregate? | |
Task Management | |
virtual void | SetTask (const std::shared_ptr< MPTask > _task) |
std::shared_ptr< MPTask > | GetTask () const noexcept |
Get the task that the agent is currently working on. | |
virtual void | ResetStartConstraint () |
Simulation Interface | |
virtual void | Initialize ()=0 |
virtual void | Step (const double _dt)=0 |
virtual void | Uninitialize ()=0 |
size_t | MinimumSteps () const |
std::vector< Agent * > | ProximityCheck (const double _distance) const |
Agent Control | |
void | Halt () |
void | PauseAgent (const size_t _steps) |
Accessors | |
const std::string & | GetCapability () const noexcept |
Get the type of agent. | |
Protected Member Functions | |
void | Localize () |
Instruct the agent to enqueue a command for gathering sensor readings. | |
bool | IsLocalizing () const noexcept |
Is the agent waiting on sensor data? | |
Cfg | EstimateState () |
Estimate the state of the robot from the last localization data. | |
bool | ContinueLastControls () |
virtual void | ExecuteControls (const ControlSet &_c, const size_t _steps) |
virtual void | ExecuteControlsSimulation (const ControlSet &_c, const size_t _steps) |
virtual void | ExecuteControlsHardware (const ControlSet &_c, const size_t _steps) |
Protected Attributes | |
Internal State | |
Robot *const | m_robot |
The robot that this agent controls. | |
bool | m_initialized {false} |
Is the agent initialized? | |
std::shared_ptr< MPTask > | m_task |
The task this agent is working on. | |
ControlSet | m_currentControls |
The current control set. | |
size_t | m_stepsRemaining {0} |
Steps remaining on current controls. | |
bool | m_debug {true} |
Toggle debug messages. | |
std::string | m_capability |
Specifies the type of agent for heterogenous multiagent teams. More... | |
std::unique_ptr< StepFunction > | m_stepFunction |
Construction | |
Agent (Robot *const _r) | |
Agent (Robot *const _r, XMLNode &_node) | |
Agent (Robot *const _r, const Agent &_a) | |
virtual std::unique_ptr< Agent > | Clone (Robot *const _r) const =0 |
virtual | ~Agent () |
static std::unique_ptr< Agent > | Factory (Robot *const _r, XMLNode &_node) |
The decision-making faculties of a robot.
Agents are used with simulated robots. On each time step of the simulation, the agent decides what the robot will do and sends an appropriate command to the controller.
Agent::Agent | ( | Robot *const | _r | ) |
Create an agent for a robot.
_r | The robot which this agent will reason for. |
Create an agent for a robot.
_r | The robot which this agent will reason for. |
_node | The XML node to parse. |
Copy an agent for another robot.
_r | The destination robot. |
_a | The agent to copy. |
Create a dynamically-allocated agent from an XML node.
_r | The robot which this agent will reason for. |
_node | The XML node to parse. |
Create a copy of this agent for another robot. This is provided so that we can copy an agent without knowing its type.
_r | The robot which this cloned agent will reason for. |
Implemented in Coordinator, PathFollowingAgent, and PlanningAgent.
|
virtual |
Set the task for this agent.
_task | The new task for this agent. Should be owned by the MPProblem. |
Reimplemented in PlanningAgent.
|
virtual |
Resets the start constraint of the current task to the robot's current position.
|
pure virtual |
Set up the agent before running. Anything that needs to be done only once on first starting should go here.
Implemented in Coordinator, and PlanningAgent.
|
pure virtual |
Decide what to do on each time step in the simulation. The agent should implement its decision by sending commands to the robot's controller.
_dt | The timestep length. |
Implemented in Coordinator, and PlanningAgent.
|
pure virtual |
Tear down the agent. Release any resources and reset the object to its pre-initialize state.
Implemented in Coordinator, PathFollowingAgent, and PlanningAgent.
size_t Agent::MinimumSteps | ( | ) | const |
Find the smallest time interval which is an integer multiple of the problem time resolution and larger than the hardware time (if any).
std::vector< Agent * > Agent::ProximityCheck | ( | const double | _distance | ) | const |
Check for proximity to other robots and return those that lie within some threshold. @WARNING This checks the distance between the robots' reference points; it does not indicate the minimum distance between their hulls.
_distance | The distance threshold. |
void Agent::Halt | ( | ) |
Stop the robot in simulation (places 0s in all 6 velocity dofs). @WARNING Arbitrarily setting the velocity does not respect the robot's dynamics. It is suitable for debugging and freezing a scenario upon completion, but it is not physically realistic.
void Agent::PauseAgent | ( | const size_t | _steps | ) |
Orders the agent to stop itself at its current position. It will ask the controller to choose actions which stay as close as possible to the current position.
_steps | The number of steps to stop for. |
|
protected |
Continue executing the last controls if time remains.
|
protectedvirtual |
Execute a set of controls on the simulated robot, and additionally on the hardware if present.
_c | The controls to execute. |
_steps | The number of time steps to execute the control. |
|
protectedvirtual |
Execute a set of controls on the simulated robot.
_c | The controls to execute. |
|
protectedvirtual |
Execute a set of controls on the hardware if present.
_c | The controls to execute. |
_steps | The number of time steps to execute the control. |
|
protected |
Specifies the type of agent for heterogenous multiagent teams.
Step function to define agent behaviors.