embodichain.lab.sim.atomic_actions#
Atomic action abstraction layer for embodied AI motion generation.
This module provides a unified interface for atomic actions like reach, grasp, move, etc., with support for semantic object understanding and extensible custom action registration.
Classes
Base class for affordance data. |
|
Interaction points affordance containing a batch of 3D positions. |
|
Semantic information about interaction target. |
|
Configuration for atomic actions. |
|
Abstract base class for atomic actions. |
|
MoveActionCfg(name: 'str' = <factory>, control_part: 'str' = <factory>, interpolation_type: 'str' = <factory>, velocity_limit: 'Optional[float]' = <factory>, acceleration_limit: 'Optional[float]' = <factory>, sample_interval: 'int' = <factory>) |
|
PickUpActionCfg(name: 'str' = <factory>, control_part: 'str' = <factory>, interpolation_type: 'str' = <factory>, velocity_limit: 'Optional[float]' = <factory>, acceleration_limit: 'Optional[float]' = <factory>, sample_interval: 'int' = <factory>, hand_open_qpos: 'torch.Tensor | None' = <factory>, hand_close_qpos: 'torch.Tensor | None' = <factory>, hand_control_part: 'str' = <factory>, lift_height: 'float' = <factory>, hand_interp_steps: 'int' = <factory>, pre_grasp_distance: 'float' = <factory>, approach_direction: 'torch.Tensor' = <factory>) |
|
PlaceActionCfg(name: 'str' = <factory>, control_part: 'str' = <factory>, interpolation_type: 'str' = <factory>, velocity_limit: 'Optional[float]' = <factory>, acceleration_limit: 'Optional[float]' = <factory>, sample_interval: 'int' = <factory>, hand_open_qpos: 'torch.Tensor | None' = <factory>, hand_close_qpos: 'torch.Tensor | None' = <factory>, hand_control_part: 'str' = <factory>, lift_height: 'float' = <factory>, hand_interp_steps: 'int' = <factory>) |
|
Central engine for managing and executing atomic actions. |
Core#
- class embodichain.lab.sim.atomic_actions.Affordance[source]#
Bases:
objectBase class for affordance data.
Affordance represents interaction possibilities for an object. This is the base class for specific affordance types.
Methods:
__init__([object_label, geometry, custom_config])Return the batch size of this affordance data.
get_custom_config(key[, default])Get a custom affordance configuration value.
set_custom_config(key, value)Set a custom affordance configuration value.
Attributes:
User-defined configuration payload for affordance creation and usage.
Geometry dictionary shared with ObjectSemantics.
Get mesh triangles from geometry.
Get mesh vertices from geometry.
Label of the object this affordance belongs to.
- __init__(object_label='', geometry=<factory>, custom_config=<factory>)#
-
custom_config:
Dict[str,Any]# User-defined configuration payload for affordance creation and usage.
-
geometry:
Dict[str,Any]# Geometry dictionary shared with ObjectSemantics.
The mesh payload is expected to be stored in: -
mesh_vertices: torch.Tensor with shape [N, 3] -mesh_triangles: torch.Tensor with shape [M, 3]
- get_custom_config(key, default=None)[source]#
Get a custom affordance configuration value.
- Return type:
Any
- property mesh_triangles: Tensor | None#
Get mesh triangles from geometry.
- Returns:
Mesh triangle index tensor [M, 3], or None if unavailable.
- Raises:
TypeError – If
mesh_trianglesexists but is not a torch tensor.
- property mesh_vertices: Tensor | None#
Get mesh vertices from geometry.
- Returns:
Mesh vertices tensor [N, 3], or None if unavailable.
- Raises:
TypeError – If
mesh_verticesexists but is not a torch tensor.
-
object_label:
str= ''# Label of the object this affordance belongs to.
- class embodichain.lab.sim.atomic_actions.InteractionPoints[source]#
Bases:
AffordanceInteraction points affordance containing a batch of 3D positions.
Interaction points define specific locations on an object surface that can be used for contact-based interactions (pushing, poking, touching) rather than full grasping.
Methods:
__init__([object_label, geometry, ...])get_approach_direction(point_idx)Get recommended approach direction for a given point.
Return the number of interaction points in this affordance.
get_points_by_type(point_type)Get points by their interaction type.
Attributes:
Optional surface normals at each interaction point with shape [B, 3].
Optional labels for each point's interaction type.
Batch of 3D interaction points with shape [B, 3].
- __init__(object_label='', geometry=<factory>, custom_config=<factory>, points=<factory>, normals=None, point_types=<factory>)#
-
custom_config:
Dict[str,Any]# User-defined configuration payload for affordance creation and usage.
-
geometry:
Dict[str,Any]# Geometry dictionary shared with ObjectSemantics.
The mesh payload is expected to be stored in: -
mesh_vertices: torch.Tensor with shape [N, 3] -mesh_triangles: torch.Tensor with shape [M, 3]
- get_approach_direction(point_idx)[source]#
Get recommended approach direction for a given point.
- Parameters:
point_idx (
int) – Index of the point- Return type:
Tensor- Returns:
3D approach direction vector (normalized)
- get_batch_size()[source]#
Return the number of interaction points in this affordance.
- Return type:
int
- get_points_by_type(point_type)[source]#
Get points by their interaction type.
- Parameters:
point_type (
str) – Type of interaction (e.g., “push”, “poke”)- Return type:
Tensor|None- Returns:
Tensor of points if found, None otherwise
-
normals:
Tensor|None= None# Optional surface normals at each interaction point with shape [B, 3].
Normals indicate the surface orientation at each point, useful for determining approach directions.
-
point_types:
List[str]# Optional labels for each point’s interaction type.
Examples: “push”, “poke”, “touch”, “pinch”
-
points:
Tensor# Batch of 3D interaction points with shape [B, 3].
Each point is a 3D coordinate in the object’s local coordinate frame.
- class embodichain.lab.sim.atomic_actions.ObjectSemantics[source]#
Bases:
objectSemantic information about interaction target.
This class encapsulates all semantic and geometric information about an object needed for intelligent interaction planning.
Methods:
__init__(affordance, geometry[, properties, ...])Attributes:
Affordance data (GraspPose, InteractionPoints, etc.).
Optional reference to the underlying simulation entity representing this object.
Geometric information including bounding box, mesh data.
Object category label (e.g., 'apple', 'bottle').
mass, friction, etc.
- __init__(affordance, geometry, properties=<factory>, label='none', entity=None)#
-
affordance:
Affordance# Affordance data (GraspPose, InteractionPoints, etc.).
-
entity:
BatchEntity|None= None# Optional reference to the underlying simulation entity representing this object.
-
geometry:
Dict[str,Any]# Geometric information including bounding box, mesh data.
-
label:
str= 'none'# Object category label (e.g., ‘apple’, ‘bottle’).
-
properties:
Dict[str,Any]# mass, friction, etc.
- Type:
Physical properties
- class embodichain.lab.sim.atomic_actions.ActionCfg[source]#
Configuration for atomic actions.
Attributes:
Optional acceleration limit for the motion.
Control part name for the action.
'linear', 'cubic'.
Name of the action, used for identification and logging.
Optional velocity limit for the motion.
-
acceleration_limit:
Optional[float]# Optional acceleration limit for the motion.
-
control_part:
str# Control part name for the action.
-
interpolation_type:
str# ‘linear’, ‘cubic’.
- Type:
Interpolation type
-
name:
str# Name of the action, used for identification and logging.
-
velocity_limit:
Optional[float]# Optional velocity limit for the motion.
-
acceleration_limit:
- class embodichain.lab.sim.atomic_actions.AtomicAction[source]#
Bases:
ABCAbstract base class for atomic actions.
All atomic actions use PlanResult from embodichain.lab.sim.planners as the return type for execute() method, ensuring consistency with the existing motion planning infrastructure.
Methods:
__init__(motion_generator[, cfg])Initialize the atomic action.
execute(target[, start_qpos])execute pick up action
plan_trajectory(target_states[, options])Plan trajectory using motion generator.
validate(target[, start_qpos])Validate if the action is feasible without executing.
- __init__(motion_generator, cfg=ActionCfg(name='default', control_part='arm', interpolation_type='linear', velocity_limit=None, acceleration_limit=None))[source]#
Initialize the atomic action. :type motion_generator:
MotionGenerator:param motion_generator: The motion generator instance to use for planning. :type cfg:ActionCfg:param cfg: Configuration for the action.
- abstract execute(target, start_qpos=None, **kwargs)[source]#
execute pick up action
- Parameters:
target (ObjectSemantics) – object semantics containing grasp affordance and entity information
start_qpos (Optional[torch.Tensor], optional) – Planning start qpos. Defaults to None.
- Returns:
is_success, trajectory of shape (n_envs, n_waypoints, dof), joint_ids corresponding to trajectory
- Return type:
tuple[bool, torch.Tensor, list[float]]
Actions#
- class embodichain.lab.sim.atomic_actions.MoveActionCfg[source]#
Bases:
ActionCfgMoveActionCfg(name: ‘str’ = <factory>, control_part: ‘str’ = <factory>, interpolation_type: ‘str’ = <factory>, velocity_limit: ‘Optional[float]’ = <factory>, acceleration_limit: ‘Optional[float]’ = <factory>, sample_interval: ‘int’ = <factory>)
Attributes:
Optional acceleration limit for the motion.
Control part name for the action.
'linear', 'cubic'.
Name of the action, used for identification and logging.
Number of waypoints to sample for the motion trajectory.
Optional velocity limit for the motion.
-
acceleration_limit:
Optional[float]# Optional acceleration limit for the motion.
-
control_part:
str# Control part name for the action.
-
interpolation_type:
str# ‘linear’, ‘cubic’.
- Type:
Interpolation type
-
name:
str# Name of the action, used for identification and logging.
-
sample_interval:
int# Number of waypoints to sample for the motion trajectory. Should be large enough to ensure smooth motion, but not too large to cause unnecessary computation overhead.
-
velocity_limit:
Optional[float]# Optional velocity limit for the motion.
-
acceleration_limit:
- class embodichain.lab.sim.atomic_actions.MoveAction[source]#
Bases:
AtomicActionMethods:
__init__(motion_generator[, cfg])Initialize the atomic action.
execute(target[, start_qpos])execute pick up action
validate(target[, start_qpos])Validate if the action is feasible without executing.
- __init__(motion_generator, cfg=None)[source]#
Initialize the atomic action. :type motion_generator:
MotionGenerator:param motion_generator: The motion generator instance to use for planning. :type cfg:Optional[MoveActionCfg] :param cfg: Configuration for the action.
- execute(target, start_qpos=None, **kwargs)[source]#
execute pick up action
- Parameters:
target (ObjectSemantics) – object semantics containing grasp affordance and entity information
start_qpos (Optional[torch.Tensor], optional) – Planning start qpos. Defaults to None.
- Returns:
is_success, trajectory of shape (n_envs, n_waypoints, dof), joint_ids corresponding to trajectory
- Return type:
tuple[bool, torch.Tensor, list[float]]
- class embodichain.lab.sim.atomic_actions.PickUpActionCfg[source]#
Bases:
GraspActionCfgPickUpActionCfg(name: ‘str’ = <factory>, control_part: ‘str’ = <factory>, interpolation_type: ‘str’ = <factory>, velocity_limit: ‘Optional[float]’ = <factory>, acceleration_limit: ‘Optional[float]’ = <factory>, sample_interval: ‘int’ = <factory>, hand_open_qpos: ‘torch.Tensor | None’ = <factory>, hand_close_qpos: ‘torch.Tensor | None’ = <factory>, hand_control_part: ‘str’ = <factory>, lift_height: ‘float’ = <factory>, hand_interp_steps: ‘int’ = <factory>, pre_grasp_distance: ‘float’ = <factory>, approach_direction: ‘torch.Tensor’ = <factory>)
Attributes:
Optional acceleration limit for the motion.
Direction from which the gripper approaches the object for grasping, expressed in the object local frame.
Control part name for the action.
[hand_dof,] of float.
Name of the robot part that controls the hand joints.
Number of waypoints for the gripper open/close interpolation phase.
[hand_dof,] of float.
'linear', 'cubic'.
Height (m) to lift the end-effector after the gripper phase.
Name of the action, used for identification and logging.
Distance to offset back from the grasp pose along the approach direction to get the pre-grasp pose.
Number of waypoints for the full trajectory (approach + hand + lift/back).
Optional velocity limit for the motion.
-
acceleration_limit:
Optional[float]# Optional acceleration limit for the motion.
-
approach_direction:
Tensor# Direction from which the gripper approaches the object for grasping, expressed in the object local frame. Default [0, 0, -1] means approaching from above.
-
control_part:
str# Control part name for the action.
-
hand_close_qpos:
Tensor|None# [hand_dof,] of float. Joint positions for closed hand state.
-
hand_control_part:
str# Name of the robot part that controls the hand joints.
-
hand_interp_steps:
int# Number of waypoints for the gripper open/close interpolation phase.
-
hand_open_qpos:
Tensor|None# [hand_dof,] of float. Joint positions for open hand state.
-
interpolation_type:
str# ‘linear’, ‘cubic’.
- Type:
Interpolation type
-
lift_height:
float# Height (m) to lift the end-effector after the gripper phase.
-
name:
str# Name of the action, used for identification and logging.
-
pre_grasp_distance:
float# Distance to offset back from the grasp pose along the approach direction to get the pre-grasp pose. Should be large enough to avoid collision during approach.
-
sample_interval:
int# Number of waypoints for the full trajectory (approach + hand + lift/back).
-
velocity_limit:
Optional[float]# Optional velocity limit for the motion.
-
acceleration_limit:
- class embodichain.lab.sim.atomic_actions.PickUpAction[source]#
Bases:
MoveActionMethods:
__init__(motion_generator[, cfg])Initialize the atomic action.
execute(target[, start_qpos])execute pick up action
validate(target[, start_qpos])Validate if the action is feasible without executing.
- __init__(motion_generator, cfg=None)[source]#
Initialize the atomic action. :type motion_generator:
MotionGenerator:param motion_generator: The motion generator instance to use for planning. :type cfg:Optional[PickUpActionCfg] :param cfg: Configuration for the action.
- execute(target, start_qpos=None, **kwargs)[source]#
execute pick up action
- Parameters:
target (Union[ObjectSemantics, torch.Tensor]) – target object semantics or target pose for grasping
start_qpos (Optional[torch.Tensor], optional) – Planning start qpos. Defaults to None.
- Returns:
is_success, trajectory of shape (n_envs, n_waypoints, dof), joint_ids corresponding to trajectory
- Return type:
tuple[bool, torch.Tensor, list[float]]
- class embodichain.lab.sim.atomic_actions.PlaceActionCfg[source]#
Bases:
GraspActionCfgPlaceActionCfg(name: ‘str’ = <factory>, control_part: ‘str’ = <factory>, interpolation_type: ‘str’ = <factory>, velocity_limit: ‘Optional[float]’ = <factory>, acceleration_limit: ‘Optional[float]’ = <factory>, sample_interval: ‘int’ = <factory>, hand_open_qpos: ‘torch.Tensor | None’ = <factory>, hand_close_qpos: ‘torch.Tensor | None’ = <factory>, hand_control_part: ‘str’ = <factory>, lift_height: ‘float’ = <factory>, hand_interp_steps: ‘int’ = <factory>)
Attributes:
Optional acceleration limit for the motion.
Control part name for the action.
[hand_dof,] of float.
Name of the robot part that controls the hand joints.
Number of waypoints for the gripper open/close interpolation phase.
[hand_dof,] of float.
'linear', 'cubic'.
Height (m) to lift the end-effector after the gripper phase.
Name of the action, used for identification and logging.
Number of waypoints for the full trajectory (approach + hand + lift/back).
Optional velocity limit for the motion.
-
acceleration_limit:
Optional[float]# Optional acceleration limit for the motion.
-
control_part:
str# Control part name for the action.
-
hand_close_qpos:
Tensor|None# [hand_dof,] of float. Joint positions for closed hand state.
-
hand_control_part:
str# Name of the robot part that controls the hand joints.
-
hand_interp_steps:
int# Number of waypoints for the gripper open/close interpolation phase.
-
hand_open_qpos:
Tensor|None# [hand_dof,] of float. Joint positions for open hand state.
-
interpolation_type:
str# ‘linear’, ‘cubic’.
- Type:
Interpolation type
-
lift_height:
float# Height (m) to lift the end-effector after the gripper phase.
-
name:
str# Name of the action, used for identification and logging.
-
sample_interval:
int# Number of waypoints for the full trajectory (approach + hand + lift/back).
-
velocity_limit:
Optional[float]# Optional velocity limit for the motion.
-
acceleration_limit:
- class embodichain.lab.sim.atomic_actions.PlaceAction[source]#
Bases:
MoveActionMethods:
__init__(motion_generator[, cfg])Initialize the atomic action.
execute(target[, start_qpos])execute pick up action
validate(target[, start_qpos])Validate if the action is feasible without executing.
- __init__(motion_generator, cfg=None)[source]#
Initialize the atomic action. :type motion_generator:
MotionGenerator:param motion_generator: The motion generator instance to use for planning. :type cfg:Optional[PlaceActionCfg] :param cfg: Configuration for the action.
- execute(target, start_qpos=None, **kwargs)[source]#
execute pick up action
- Parameters:
target (ObjectSemantics) – object semantics containing grasp affordance and entity information
start_qpos (Optional[torch.Tensor], optional) – Planning start qpos. Defaults to None.
- Returns:
is_success, trajectory of shape (n_envs, n_waypoints, dof), joint_ids corresponding to trajectory
- Return type:
tuple[bool, torch.Tensor, list[float]]
Engine & Registry#
- class embodichain.lab.sim.atomic_actions.AtomicActionEngine[source]#
Bases:
objectCentral engine for managing and executing atomic actions.
Methods:
__init__(motion_generator[, actions_cfg_list])execute_static(target_list)Execute a sequence of actions to target poses.
Get the semantic analyzer for object understanding.
set_semantic_analyzer(analyzer)Set a custom semantic analyzer.
validate(action_name, target, **kwargs)Validate if a named action is feasible without executing.
- execute_static(target_list)[source]#
Execute a sequence of actions to target poses.
Each element in
target_listcorresponds to an action in the order they were registered viaactions_cfg_list.- Return type:
tuple[bool,Tensor]
- embodichain.lab.sim.atomic_actions.register_action(name, action_class, config_class=None)[source]#
Register a custom atomic action class globally.
This function allows registration of custom action types that can then be instantiated by the AtomicActionEngine.
- Parameters:
name (
str) – Unique identifier for the action typeaction_class (
Type[AtomicAction]) – The AtomicAction subclass to registerconfig_class (
Optional[Type[ActionCfg]]) – Optional configuration class for the action
- Return type:
None
Example
>>> class MyCustomAction(AtomicAction): ... def execute(self, target, **kwargs): ... # Implementation ... pass ... def validate(self, target, **kwargs): ... return True >>> register_action("my_custom", MyCustomAction)
- embodichain.lab.sim.atomic_actions.unregister_action(name)[source]#
Unregister an action type.
- Parameters:
name (
str) – The action type identifier to remove- Return type:
None
- embodichain.lab.sim.atomic_actions.get_registered_actions()[source]#
Get all registered action types.
- Return type:
Dict[str,Type[AtomicAction]]- Returns:
Dictionary mapping action names to their classes