tbp.monty.frameworks.actions#

tbp.monty.frameworks.actions.action_samplers#

class ActionSampler(rng: Generator | None = None, actions: list[type[Action]] | None = None)[source]#

Bases: object

An Action factory that samples from a set of available action types.

sample(agent_id: str) Action[source]#

Sample a random action from the available action types.

Returns:

A random action from the available action types.

Return type:

Action

class ConstantSampler(absolute_degrees: float = 0.0, actions: list[type[Action]] | None = None, direction: VectorXYZ | None = None, location: VectorXYZ | None = None, rng: Generator | None = None, rotation_degrees: float = 5.0, rotation_quat: QuaternionWXYZ | None = None, translation_distance: float = 0.004, **kwargs: Any) None[source]#

Bases: ActionSampler

An Action factory using constant, prespecified action parameters.

This Action factory samples actions with constant parameters. The values of action parameters used are set at initialization time and remain the same for all actions created by this factory. For example, if you specify rotation_degrees=5.0, all actions created by this factory that take a rotation_degrees parameter will have it set to 5.0.

When sampling an Action, only applicable parameters are used. For example, when sampling a MoveForward action, only the ConstantCreator’s translation_distance parameter is used to determine the action’s distance parameter.

sample_look_down(agent_id: str) LookDown[source]#
Return type:

LookDown

sample_look_up(agent_id: str) LookUp[source]#
Return type:

LookUp

sample_move_forward(agent_id: str) MoveForward[source]#
Return type:

MoveForward

sample_move_tangentially(agent_id: str) MoveTangentially[source]#
Return type:

MoveTangentially

sample_orient_horizontal(agent_id: str) OrientHorizontal[source]#
Return type:

OrientHorizontal

sample_orient_vertical(agent_id: str) OrientVertical[source]#
Return type:

OrientVertical

sample_set_agent_pitch(agent_id: str) SetAgentPitch[source]#
Return type:

SetAgentPitch

sample_set_agent_pose(agent_id: str) SetAgentPose[source]#
Return type:

SetAgentPose

sample_set_sensor_pitch(agent_id: str) SetSensorPitch[source]#
Return type:

SetSensorPitch

sample_set_sensor_pose(agent_id: str) SetSensorPose[source]#
Return type:

SetSensorPose

sample_set_sensor_rotation(agent_id: str) SetSensorRotation[source]#
Return type:

SetSensorRotation

sample_set_yaw(agent_id: str) SetYaw[source]#
Return type:

SetYaw

sample_turn_left(agent_id: str) TurnLeft[source]#
Return type:

TurnLeft

sample_turn_right(agent_id: str) TurnRight[source]#
Return type:

TurnRight

class UniformlyDistributedSampler(actions: list[type[Action]] | None = None, max_absolute_degrees: float = 360.0, min_absolute_degrees: float = 0.0, max_rotation_degrees: float = 20.0, min_rotation_degrees: float = 0.0, max_translation: float = 0.05, min_translation: float = 0.05, rng: Generator | None = None, **kwargs: Any)[source]#

Bases: ActionSampler

An Action factory using uniformly distributed action creation parameters.

This Action factory samples actions with parameters that are uniformly distributed within a given range. The range of values for each parameter is set at initialization time and remains the same for all actions created by this factory.

When sampling an Action, only applicable parameters are used. For example, when sampling a MoveForward action, only the UniformlyDistributedCreator’s translation_high and translation_low parameters are used to determine the action’s distance parameter.

sample_look_down(agent_id: str) LookDown[source]#
Return type:

LookDown

sample_look_up(agent_id: str) LookUp[source]#
Return type:

LookUp

sample_move_forward(agent_id: str) MoveForward[source]#
Return type:

MoveForward

sample_move_tangentially(agent_id: str) MoveTangentially[source]#
Return type:

MoveTangentially

sample_orient_horizontal(agent_id: str) OrientHorizontal[source]#
Return type:

OrientHorizontal

sample_orient_vertical(agent_id: str) OrientVertical[source]#
Return type:

OrientVertical

sample_set_agent_pitch(agent_id: str) SetAgentPitch[source]#
Return type:

SetAgentPitch

sample_set_agent_pose(agent_id: str) SetAgentPose[source]#
Return type:

SetAgentPose

sample_set_sensor_pitch(agent_id: str) SetSensorPitch[source]#
Return type:

SetSensorPitch

sample_set_sensor_pose(agent_id: str) SetSensorPose[source]#
Return type:

SetSensorPose

sample_set_sensor_rotation(agent_id: str) SetSensorRotation[source]#
Return type:

SetSensorRotation

sample_set_yaw(agent_id: str) SetYaw[source]#
Return type:

SetYaw

sample_turn_left(agent_id: str) TurnLeft[source]#
Return type:

TurnLeft

sample_turn_right(agent_id: str) TurnRight[source]#
Return type:

TurnRight

tbp.monty.frameworks.actions.actions#

class Action(agent_id: str) None[source]#

Bases: Protocol

An action that can be taken by an agent.

Actions are generated by the MotorSystem and are executed by an Actuator.

classmethod action_name() str[source]#

Generate action name based on class.

Used in static configuration, e.g., FakeAction.action_name().

Return type:

str

Returns:

The action name in snake_case.

agent_id: str#

The ID of the agent that will take this action.

property name: str#

Used for checking action name on an Action instance.

class LookDown(agent_id: str, rotation_degrees: float, constraint_degrees: float = 90.0) None[source]#

Bases: Action

Rotate the agent downwards by a specified number of degrees.

act(actuator: LookDownActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: LookDownActionSampler) LookDown[source]#
Return type:

LookDown

agent_id: str#

The ID of the agent that will take this action.

class LookDownActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_look_down(agent_id: str) LookDown[source]#
Return type:

LookDown

class LookDownActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_look_down(action: LookDown) None[source]#
Return type:

None

class LookUp(agent_id: str, rotation_degrees: float, constraint_degrees: float = 90.0) None[source]#

Bases: Action

Rotate the agent upwards by a specified number of degrees.

act(actuator: LookUpActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: LookUpActionSampler) LookUp[source]#
Return type:

LookUp

agent_id: str#

The ID of the agent that will take this action.

class LookUpActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_look_up(agent_id: str) LookUp[source]#
Return type:

LookUp

class LookUpActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_look_up(action: LookUp) None[source]#
Return type:

None

class MoveForward(agent_id: str, distance: float) None[source]#

Bases: Action

Move the agent forward by a specified distance.

act(actuator: MoveForwardActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: MoveForwardActionSampler) MoveForward[source]#
Return type:

MoveForward

agent_id: str#

The ID of the agent that will take this action.

class MoveForwardActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_move_forward(agent_id: str) MoveForward[source]#
Return type:

MoveForward

class MoveForwardActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_move_forward(action: MoveForward) None[source]#
Return type:

None

class MoveTangentially(agent_id: str, distance: float, direction: Tuple[float, float, float]) None[source]#

Bases: Action

Move the agent tangentially.

Moves the agent tangentially to the current orientation by a specified distance along a specified direction.

act(actuator: MoveTangentiallyActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: MoveTangentiallyActionSampler) MoveTangentially[source]#
Return type:

MoveTangentially

agent_id: str#

The ID of the agent that will take this action.

class MoveTangentiallyActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_move_tangentially(agent_id: str) MoveTangentially[source]#
Return type:

MoveTangentially

class MoveTangentiallyActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_move_tangentially(action: MoveTangentially) None[source]#
Return type:

None

class OrientHorizontal(agent_id: str, rotation_degrees: float, left_distance: float, forward_distance: float) None[source]#

Bases: Action

Move the agent in the horizontal plane.

Moves the agent in the horizontal plane compensating for the horizontal motion with a rotation in the horizontal plane.

act(actuator: OrientHorizontalActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: OrientHorizontalActionSampler) OrientHorizontal[source]#
Return type:

OrientHorizontal

agent_id: str#

The ID of the agent that will take this action.

class OrientHorizontalActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_orient_horizontal(agent_id: str) OrientHorizontal[source]#
Return type:

OrientHorizontal

class OrientHorizontalActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_orient_horizontal(action: OrientHorizontal) None[source]#
Return type:

None

class OrientVertical(agent_id: str, rotation_degrees: float, down_distance: float, forward_distance: float) None[source]#

Bases: Action

Move the agent in the vertical plane.

Moves the agent in the vertical plane compensating for the vertical motion with a rotation in the vertical plane.

act(actuator: OrientVerticalActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: OrientVerticalActionSampler) OrientVertical[source]#
Return type:

OrientVertical

agent_id: str#

The ID of the agent that will take this action.

class OrientVerticalActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_orient_vertical(agent_id: str) OrientVertical[source]#
Return type:

OrientVertical

class OrientVerticalActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_orient_vertical(action: OrientVertical) None[source]#
Return type:

None

class SetAgentPitch(agent_id: str, pitch_degrees: float) None[source]#

Bases: Action

Set the agent pitch rotation in degrees.

Note that unless otherwise changed, the sensors maintain identity orientation with regard to the agent. So, this will also adjust the pitch of agent’s sensors with regard to the environment.

act(actuator: SetAgentPitchActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: SetAgentPitchActionSampler) SetAgentPitch[source]#
Return type:

SetAgentPitch

agent_id: str#

The ID of the agent that will take this action.

class SetAgentPitchActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_set_agent_pitch(agent_id: str) SetAgentPitch[source]#
Return type:

SetAgentPitch

class SetAgentPitchActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_set_agent_pitch(action: SetAgentPitch) None[source]#
Return type:

None

class SetAgentPose(agent_id: str, location: Tuple[float, float, float], rotation_quat: Tuple[float, float, float, float]) None[source]#

Bases: Action

Set the agent pose.

Set the agent pose to absolute location coordinates and orientation in the environment.

act(actuator: SetAgentPoseActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: SetAgentPoseActionSampler) SetAgentPose[source]#
Return type:

SetAgentPose

agent_id: str#

The ID of the agent that will take this action.

class SetAgentPoseActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_set_agent_pose(agent_id: str) SetAgentPose[source]#
Return type:

SetAgentPose

class SetAgentPoseActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_set_agent_pose(action: SetAgentPose) None[source]#
Return type:

None

class SetSensorPitch(agent_id: str, pitch_degrees: float) None[source]#

Bases: Action

Set the sensor pitch rotation.

Note that this does not update the pitch of the agent. Imagine the body associated with the eye remaining in place, while the eye moves.

act(actuator: SetSensorPitchActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: SetSensorPitchActionSampler) SetSensorPitch[source]#
Return type:

SetSensorPitch

agent_id: str#

The ID of the agent that will take this action.

class SetSensorPitchActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_set_sensor_pitch(agent_id: str) SetSensorPitch[source]#
Return type:

SetSensorPitch

class SetSensorPitchActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_set_sensor_pitch(action: SetSensorPitch) None[source]#
Return type:

None

class SetSensorPose(agent_id: str, location: Tuple[float, float, float], rotation_quat: Tuple[float, float, float, float]) None[source]#

Bases: Action

Set the sensor pose.

Set the sensor pose to absolute location coordinates and orientation in the environment.

act(actuator: SetSensorPoseActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: SetSensorPoseActionSampler) SetSensorPose[source]#
Return type:

SetSensorPose

agent_id: str#

The ID of the agent that will take this action.

class SetSensorPoseActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_set_sensor_pose(agent_id: str) SetSensorPose[source]#
Return type:

SetSensorPose

class SetSensorPoseActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_set_sensor_pose(action: SetSensorPose) None[source]#
Return type:

None

class SetSensorRotation(agent_id: str, rotation_quat: Tuple[float, float, float, float]) None[source]#

Bases: Action

Set the sensor rotation relative to the agent.

act(actuator: SetSensorRotationActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: SetSensorRotationActionSampler) SetSensorRotation[source]#
Return type:

SetSensorRotation

agent_id: str#

The ID of the agent that will take this action.

class SetSensorRotationActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_set_sensor_rotation(agent_id: str) SetSensorRotation[source]#
Return type:

SetSensorRotation

class SetSensorRotationActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_set_sensor_rotation(action: SetSensorRotation) None[source]#
Return type:

None

class SetYaw(agent_id: str, rotation_degrees: float) None[source]#

Bases: Action

Set the agent body yaw rotation.

act(actuator: SetYawActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: SetYawActionSampler) SetYaw[source]#
Return type:

SetYaw

agent_id: str#

The ID of the agent that will take this action.

class SetYawActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_set_yaw(agent_id: str) SetYaw[source]#
Return type:

SetYaw

class SetYawActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_set_yaw(action: SetYaw) None[source]#
Return type:

None

class TurnLeft(agent_id: str, rotation_degrees: float) None[source]#

Bases: Action

Rotate the agent to the left.

act(actuator: TurnLeftActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: TurnLeftActionSampler) TurnLeft[source]#
Return type:

TurnLeft

agent_id: str#

The ID of the agent that will take this action.

class TurnLeftActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_turn_left(agent_id: str) TurnLeft[source]#
Return type:

TurnLeft

class TurnLeftActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_turn_left(action: TurnLeft) None[source]#
Return type:

None

class TurnRight(agent_id: str, rotation_degrees: float) None[source]#

Bases: Action

Rotate the agent to the right.

act(actuator: TurnRightActuator) None[source]#
Return type:

None

static sample(agent_id: str, sampler: TurnRightActionSampler) TurnRight[source]#
Return type:

TurnRight

agent_id: str#

The ID of the agent that will take this action.

class TurnRightActionSampler(*args, **kwargs)[source]#

Bases: Protocol

sample_turn_right(agent_id: str) TurnRight[source]#
Return type:

TurnRight

class TurnRightActuator(*args, **kwargs)[source]#

Bases: Protocol

actuate_turn_right(action: TurnRight) None[source]#
Return type:

None