Agent#

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 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 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

  • estimation – The estimation

  • 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

Dumps the object to a YAML-string.

Returns:

The YAML representation

Return type:

str

Gets the last command.

Returns:

The controller.

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 modulation from a 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]

Type:

navground.core.Twist2

The last actuated command.

the actuated command is always kinematically feasible

Type:

float

Angular speed

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 state estimation.

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