Agent#
#include "navground/sim/agent.h"
This class describes an agent.
The agent navigates in the environment using a task, a state estimation, a kinematic and a behavior, and a controller.
Agents have a circular shape which should match the shape of their navigation navground::core::Behavior.
The role of task and state estimation is to provide goals and environment state (perception) to the behavior.
Agents have a public identifies id that is accessible by the other agents’ state estimation and may be passed to their behavior as navground::core::Neighbor::id. This identifier may not be unique (e.g., may be used to identifies groups of agents).
Agents runs their update at the rate set by control_period even if the world is updated at a faster rate.
Public Functions
Constructs a new instance.
- Parameters:
radius – [in] The radius of the agent
behavior – [in] The behavior
kinematics – [in] The kinematics
task – [in] The task
estimation – [in] The estimation
control_period – [in] The control period
id – [in] The public identifier
Returns a neighbor representation of the agent with the same shape, position and id.
- Returns:
The neighbor representation
Returns a neighbor representation of the agent with the same shape and id but with position translated by delta.
- Parameters:
delta – [in] The delta
- Returns:
The neighbor representation
Sets the state estimation.
- Parameters:
value – [in] The desired value
Gets the state estimation.
- Returns:
The state estimation.
Sets the navigation behavior.
Automatically set the behavior radius and kinematics to match the agent.
- Parameters:
value – [in] The desired value
Gets the navigation behavior.
- Returns:
The navigation behavior.
Sets the kinematics.
- Parameters:
value – [in] The desired value
Gets the kinematics.
- Returns:
The kinematics.
Sets the task.
- Parameters:
value – [in] The desired value
Gets the task.
- Returns:
The task.
Gets the navigation controller.
- Returns:
The controller.
Gets the navigation controller.
- Returns:
The controller.
Returns whether the task is done and the control is idle.
- Returns:
False if it has an active task or if the control is running
Gets the last command.
- Returns:
The controller.
Gets the last command.
- Returns:
The command.
Sets the last command.
- Parameters:
value – [in] The value
Gets the last actuated command.
The actuated command is always kinematically feasible
- Returns:
The command.
Gets the current pose.
- Returns:
The current pose.
Sets the current pose.
- Parameters:
value – [in] The pose
Gets the current twist.
- Returns:
The current twist.
Sets the current twist.
- Parameters:
value – [in] The value
Adds a tag.
- Parameters:
tag – [in] The tag
Removes a tag.
- Parameters:
tag – [in] The tag
Actuate the current agent control command.
- Parameters:
dt – [in] The time step
cmd – [in] The desired command
Determines if the agent has been stuck since a given time.
- Parameters:
time – [in] The time
- Returns:
True if been stuck since, False otherwise.
Gets the time since the agents has been stuck.
- Returns:
The time since stuck.
Gets whether the agent is enabled.
Disabled agents are ignored in the simulation.
- Returns:
True if enabled.
Sets whether the agent is enabled.
Disabled agents are ignored in the simulation.
- Parameters:
value – [in] The desired value
Public Members
The agent public identifier
The agent radius
The control period
The current pose
The current twist
The last control command
The type of the agent.
The agent type should not used by the neighbors state estimation. It is mainly used internally to draw the agents in the UI.
The color of the agent.
A valid CSS color to fill the agent in the UI or empty to use the default color.
A set of tags used to label the agent.
Tags are used to add meta-information about an agent, for instance when it gets generated by a scenario.
Whether the agent is controlled externally.
External agents are not controlled by this simulation but are part of the state estimation used by the agents controlled in this simulation.
Public Static Functions
Factory method to build an agent.
- Parameters:
radius – [in] The radius of the agent
behavior – [in] The behavior
kinematics – [in] The kinematics
task – [in] The task
estimation – [in] The estimation
control_period – [in] The control period
id – [in] The public identifier
- Returns:
A new agent