habitat_sim.agent.Agent class

Implements an agent with multiple sensors

Methods

def act(self, action_id: typing.Any) -> bool
Take the action specified by action_id
def close(self) -> None
def get_state(self) -> AgentState
def reconfigure(self, agent_config: AgentConfiguration, reconfigure_sensors: bool = True) -> None
Re-create the agent with a new configuration
def set_state(self, state: AgentState, reset_sensors: bool = True, infer_sensor_states: bool = True, is_initial: bool = False) -> None
Sets the agents state

Special methods

def __attrs_init__(self, agent_config: AgentConfiguration, sensors: sensors.SensorSuite, controls: ObjectControls, body: magnum.scenegraph.AbstractFeature3D) -> None
Method generated by attrs for class Agent.
def __init__(self, scene_node: scene.SceneNode, agent_config: typing.Optional[AgentConfiguration] = None, _sensors: typing.Optional[sensors.SensorSuite] = None, controls: typing.Optional[ObjectControls] = None) -> None

Properties

scene_node: scene.SceneNode get
state get set
Get/set the agent’s state.
agent_config: AgentConfiguration get set del
The configuration of the agent
controls: ObjectControls get set del
body: magnum.scenegraph.AbstractFeature3D get set del

Method documentation

def habitat_sim.agent.Agent.act(self, action_id: typing.Any) -> bool

Take the action specified by action_id

Parameters
action_id ID of the action. Retreives the action from agent_config.action_space <AgentConfiguration.action_space>
Returns Whether or not the action taken resulted in a collision

def habitat_sim.agent.Agent.reconfigure(self, agent_config: AgentConfiguration, reconfigure_sensors: bool = True) -> None

Re-create the agent with a new configuration

Parameters
agent_config New config
reconfigure_sensors Whether or not to also reconfigure the sensors. There are specific cases where False makes sense, but most cases are covered by True.

def habitat_sim.agent.Agent.set_state(self, state: AgentState, reset_sensors: bool = True, infer_sensor_states: bool = True, is_initial: bool = False) -> None

Sets the agents state

Parameters
state The state to set the agent to
reset_sensors Whether or not to reset the sensors to their default intrinsic/extrinsic parameters before setting their extrinsic state.
infer_sensor_states Whether or not to infer the location of sensors based on the new location of the agent base state.
is_initial Whether this state is the initial state of the agent in the scene. Used for resetting the agent at a later time

Setting reset_sensors to False allows the agent base state to be moved and the new sensor locations inferred without changing the configuration of the sensors with respect to the base state of the agent.

Setting infer_sensor_states to False is useful if you’d like to directly control the state of a sensor instead of moving the agent.

Property documentation

habitat_sim.agent.Agent.state get set

Get/set the agent’s state.

Getting the state is equivalent to get_state()

Setting the state is equivalent calling set_state() and only providing the state.