Agent#
This class describes an agent.
The agent navigates in the environment using a task, a vector (or list in Python) of state estimations, a kinematic and a behavior, and a controller.
Agents have a circular shape which should match the shape of their navigation
Behavior
.The role of the task is to provide goals to the behavior, while the role of state estimations is to update the environment state (perception) of the behavior.
State estimations are evaluated in constant order, each operating on the behavior environment state. For example, if an agent has two state estimations
SE1
andSE2
, whenWorld.update()
is called, the agent updates the behavior environment stateS
asSE1(S); SE2(S);
Agents have a public identifies
id
that is accessible by the other agents’ state estimation and may be passed to their behavior asNeighbor.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.Constructs a new instance.
- Parameters:
radius – The radius of the agent
behavior – The behavior
kinematics – The kinematics
task – The task
estimations – The state estimations
control_period – The control period
id – The public identifier
Actuate the current agent control command.
- Parameters:
dt – The time step
Adds a tag.
- Parameters:
tag – The tag
Remove all attributes
Dumps the object to a YAML-string.
- Returns:
The YAML representation
- Return type:
Gets the value of the specified attribute.
- Parameters:
name – The name of the attribute
- Returns:
The value of the attribute
Gets the last command.
- Returns:
The controller.
Checks if the specified attribute is set.
- Parameters:
name – The name of the attribute
- Returns:
True if the attribute is present.
Determines if the entity has been in collision at least once since the given time.
- Parameters:
time – The time
- Returns:
True if been in collision since, False otherwise.
Determines if the agent has been stuck since a given time.
- Parameters:
time – The time
- Returns:
True if been stuck since, False otherwise.
Load a agent from a YAML string.
- Parameters:
value – the YAML string.
- Returns:
The loaded agent or
None
if loading fails.- Return type:
Agent| None
Removes a tag.
- Parameters:
tag – The tag
Returns the json-schema
- Returns:
json-schema
- Return type:
Set the value of a named attribute.
- Parameters:
name – The name of the property
value – The desired value for the attribute
- Type:
The last actuated command.
the actuated command is always kinematically feasible
- Type:
Angular speed
- Type:
dict[str, Union[bool, int, float, str, Vector2, list[bool], list[int], list[float], list[str], list[Vector2]]]
All attributes.
- Type:
The navigation behavior.
- Type:
The color of the agent.
A valid CSS color to fill the agent in the UI or empty to use the default color.
- Type:
The control period
-
The navigation controller.
- Type:
Whether the agent is enabled.
disabled agents are ignored in the simulation.
- Type:
The agent public identifier
- Type:
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
-
The kinematics.
- Type:
The last command.
- Type:
Returns the last collision time
- Type:
Orientation
- Type:
The current pose.
- Type:
Position
- Type:
The agent radius
-
The first state estimation.
-
The state estimations.
-
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.
- Type:
The task.
- Type:
The time since the agents has been stuck.
- Type:
The current twist.
- Type:
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.
- Type:
Velocity
Note
Class Agent
supports dynamic attributes <attributes python>.