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 and SE2, when World.update() is called, the agent updates the behavior environment state S as SE1(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 as 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.

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:

str

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:

dict[str, typing.Any]

Set the value of a named attribute.

Parameters:
  • name – The name of the property

  • value – The desired value for the attribute

Type:

navground.core.Twist2

The last actuated command.

the actuated command is always kinematically feasible

Type:

float

Angular speed

Type:

dict[str, Union[bool, int, float, str, Vector2, list[bool], list[int], list[float], list[str], list[Vector2]]]

All attributes.

Type:

navground.core.Behavior

The navigation behavior.

Type:

str

The color of the agent.

A valid CSS color to fill the agent in the UI or empty to use the default color.

Type:

float

The control period

Type:

navground.core.Controller

The navigation controller.

Type:

bool

Whether the agent is enabled.

disabled agents are ignored in the simulation.

Type:

int

The agent public identifier

Type:

bool

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

Type:

navground.core.Kinematics

The kinematics.

Type:

navground.core.Twist2

The last command.

Type:

float

Returns the last collision time

Type:

float

Orientation

Type:

navground.core.Pose2

The current pose.

Type:

Vector2

Position

Type:

float

The agent radius

Type:

navground.sim.StateEstimation

The first state estimation.

Type:

list[navground.sim.StateEstimation]

The state estimations.

Type:

set[str]

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:

navground.sim.Task

The task.

Type:

float

The time since the agents has been stuck.

Type:

navground.core.Twist2

The current twist.

Type:

str

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:

Vector2

Velocity

Note

Class Agent supports dynamic attributes <attributes python>.