esp::agent::Agent class

Class that represents an agent that can act within an environment.

Public static variables

static const std::set<std::string> BodyActions
Set of actions that are applied to the body of the agent. These actions update both the absolute position/rotation of the agent and the sensor. Non-body actions only effect the absolute position and rotation of the sensors (only effects their position/rotation relative to the agent's body)

Constructors, destructors, conversion operators

Agent(scene::SceneNode& agentNode, const AgentConfiguration& cfg) explicit
constructor: the status of the agent, sensors is "valid" after construction; user can use them immediately
~Agent() override

Public functions

auto node() -> scene::SceneNode&
Get the scene node being attached to.
auto node() const -> const scene::SceneNode&
Get the scene node being attached to.
auto object() -> scene::SceneNode&
Overloads to avoid confusion.
auto object() const -> const scene::SceneNode&
Overloads to avoid confusion.
auto act(const std::string& actionName) -> bool
Perform an action.
auto hasAction(const std::string& actionName) const -> bool
Verify whether the named action is available to the agent.
void reset()
Return the agent to the saved initialState_.
void getState(const AgentState::ptr& state) const
Populate the passed state with the agent's current positon and rotation.
void setState(const AgentState& state, bool resetSensors = true)
Set the agent to the passsed state.
void setInitialState(const AgentState& state, const bool resetSensors = true)
Set the agent to the passsed state and set that state to be the initialState_.
auto getControls() -> std::shared_ptr<scene::ObjectControls>
Retrieve the esp::scene::ObjectControls specified for this agent.
auto getSubtreeSensorSuite() -> sensor::SensorSuite&
Return SensorSuite containing references to superset of all Sensors held by this Agent's SceneNode and its children.
auto getSubtreeSensors() -> std::map<std::string, std::reference_wrapper<sensor::Sensor>>&
Return map containing references to superset of all Sensors held by this Agent's SceneNode and its children values. Keys of map are uuid strings, values are references to Sensors with that uuid.
auto getConfig() const -> const AgentConfiguration&
Retrieve a const reference to this agent's configuration.
auto getConfig() -> AgentConfiguration&
Retrieve a reference to this agent's configuration.

Function documentation

bool esp::agent::Agent::act(const std::string& actionName)

Perform an action.

Parameters
actionName the name of the action to perform
Returns Whether the named action is available to the agent

bool esp::agent::Agent::hasAction(const std::string& actionName) const

Verify whether the named action is available to the agent.

Parameters
actionName the name of the action to perform
Returns Whether the named action is available to the agent

void esp::agent::Agent::getState(const AgentState::ptr& state) const

Populate the passed state with the agent's current positon and rotation.

Parameters
state The AgentState variable to populate with the current state of this agent.

void esp::agent::Agent::setState(const AgentState& state, bool resetSensors = true)

Set the agent to the passsed state.

Parameters
state The state to set the agent to
resetSensors Whether to reset the agent's sensors or not.

void esp::agent::Agent::setInitialState(const AgentState& state, const bool resetSensors = true)

Set the agent to the passsed state and set that state to be the initialState_.

Parameters
state The state to set to, and save as initial state
resetSensors Whether to reset the agent's sensors or not.