irsim.lib.behavior.group_behavior#

Attributes#

Classes#

GroupBehavior

Group behavior facade.

Module Contents#

irsim.lib.behavior.group_behavior.logger#
class irsim.lib.behavior.group_behavior.GroupBehavior(members: list[irsim.world.object_base.ObjectBase], **behavior_dict: Any)[source]#

Group behavior facade.

  • If a class-based handler is registered, it is instantiated once and reused.

  • Otherwise, a function-based behavior is invoked each step.

Create a group behavior wrapper.

Parameters:
  • members – Current group members to control.

  • **behavior_dict – Behavior configuration. Must include: - name: behavior action (e.g., “orca”). - optional behavior-specific parameters.

Notes

  • If a class-based group behavior is registered for (kinematics, name), it will be instantiated once and reused.

  • Otherwise, a function-based behavior is used each step.

members#
behavior_dict#
kinematics: str | None#
name: str | None#
update_members(members: list[irsim.world.object_base.ObjectBase]) None[source]#

Update the current group members.

Call this if the composition of the group changes at runtime. The class-based handler (if any) is expected to adapt on next call; no forced re-instantiation is performed here.

gen_group_vel() list[Any][source]#

Generate per-member actions for one step.

Returns:

A list of actions aligned with members. Each element is

behavior-specific (e.g., 2x1 numpy arrays for velocity).

Return type:

list

Behavior:
  • Uses a class-based handler if one was registered and initialized.

  • Otherwise looks up a function behavior in the registry.

  • If no behavior is configured, returns [None] (one sentinel element) and logs a warning periodically in auto mode.

load_group_behaviors(group_behaviors: str = '.group_behavior_methods')[source]#

Dynamically import user/group behavior methods.

Parameters:

group_behaviors – Dotted module path (relative to irsim.lib.behavior) that contains group behavior registrations.

Note

Importing this module should register additional behaviors or behavior classes via the behavior registry decorators.