Configured assembly components#

Peg insertion, gear meshing and nut threading register the common EmbodiedEnv. Its optional scene_preparation declaration receives an owned environment configuration before World creation; resource_export receives the live environment, frozen configuration and checkpoint directory. Explicit configuration takes precedence over registration defaults.

Preparation expands pinned geometry into standard entities and binds native event, action, observation, reward and termination components. A startup event initializes shared state. Success conditions advance state at most once per new control transition; observations and rewards reuse its measurements. Selected-row reset does not advance physics or another row’s history. Mating and grasp contact sensors sample physical substeps. Task acceptance and timeout handling follow the common TerminationManager contract.

The seven arm policy inputs retain encoder-relative position semantics and the configured warmup mask. The exclusive assembly action also owns encoder gravity feedforward and the held gripper target; additional action terms are rejected to avoid conflicting robot commands.

Preparation and saved resources#

embodichain.extensions.tasks.manipulation.assembly.preparation.prepare_assembly_scene(cfg)[source]#

Expand configured assets and sensors before World creation.

Parameters:

cfg (EmbodiedEnvCfg) – Owned configuration with explicit assembly, manager and RL declarations.

Return type:

EmbodiedEnvCfg

Returns:

Configuration with generated native entities and contact sensors.

embodichain.extensions.tasks.manipulation.assembly.resources.export_assembly_resources(env, config, config_dir)[source]#

Freeze generated geometry and the prepared robot into the RUN.

Relative resource references are resolved by the ordinary Gym loader. Replay therefore uses this exact model preparation and needs neither mjfit nor the source-model cache. The bundle records its engineering fidelity and never upgrades the nominal model’s qualification.

Parameters:
  • env (Any) – Common environment containing the initialized assembly state.

  • config (dict[str, Any]) – Owned, component-resolved Gym configuration to freeze.

  • config_dir (Path) – Destination run configuration directory.

Return type:

dict[str, Any]

Returns:

Configuration using relative references to the bundled resources.

Termination conditions#

embodichain.extensions.tasks.manipulation.assembly.functors.assembly_success(env)[source]#

Read physical success from the configured interval measurement snapshot.

Parameters:

env (EmbodiedEnv) – Environment with startup-bound assembly state.

Return type:

ConditionResult

Returns:

Physical success, validity and shared geometric diagnostics.

embodichain.extensions.tasks.manipulation.assembly.functors.assembly_failure(env)[source]#

Read failure from the snapshot consumed by success and rewards.

Parameters:

env (EmbodiedEnv) – Environment with startup-bound assembly state.

Return type:

ConditionResult

Returns:

Failure and measurement-validity masks.

Task observation, reset and reward components#

The task package owns proprioceptive feature construction, contact labels, selected-row grasp resets and assembly milestone rewards. Configuration binds these functors to the common environment managers.

class embodichain.extensions.tasks.manipulation.assembly.functors.AssemblyProprioception[source]#

Build per-environment proprioceptive history for a blind assembly actor.

Current comes first, followed by chronological history including current. A selective reset reinitializes only the requested rows.

Parameters:
  • cfg (FunctorCfg) – Functor configuration containing the history length and layout.

  • env (EmbodiedEnv) – Assembly environment supplying joint features and actions.

Methods:

__init__(cfg, env)

Initialize the functor.

reset([env_ids])

Mark selected histories for reinitialization on the next observation.

__init__(cfg, env)[source]#

Initialize the functor.

Parameters:
reset(env_ids=None)[source]#

Mark selected histories for reinitialization on the next observation.

Parameters:

env_ids (Any) – Environment indices to reset, or None for every row.

Return type:

None

embodichain.extensions.tasks.manipulation.assembly.functors.assembly_privileged_state(env, obs)[source]#

Build privileged mating features intended for the training critic.

The policy configuration must keep this observation out of the actor group.

Parameters:
  • env (EmbodiedEnv) – Assembly environment containing the task state and geometry.

  • obs (Any) – Existing observations, unused by this functor.

Return type:

Tensor

Returns:

Flattened batched pose, geometry and contact-class features.

embodichain.extensions.tasks.manipulation.assembly.functors.assembly_contact_labels(env, obs)[source]#

Return pre-action mating-feature class labels for auxiliary training.

Parameters:
  • env (EmbodiedEnv) – Assembly environment containing current feature labels.

  • obs (Any) – Existing observations, unused by this functor.

Return type:

Tensor

Returns:

Independent batched integer labels for the mating features.

embodichain.extensions.tasks.manipulation.assembly.functors.reset_assembly(env, env_ids)[source]#

Initialize selected physical grasps without stepping other arenas.

Return type:

None

embodichain.extensions.tasks.manipulation.assembly.functors.assembly_milestone_reward(env, obs, action, info, weights)[source]#

Weight the newly reached milestones in this control transition.

Parameters:
  • env (EmbodiedEnv) – Host containing the shared assembly measurement state.

  • obs (Any) – Current manager observations.

  • action (Tensor) – Policy action for this transition.

  • info (dict[str, Any]) – Current environment outcomes.

  • weights (list[float]) – Four finite capture/depth/success/reserved milestone weights.

Return type:

Tensor

Returns:

Batched reward; the state records each milestone once per episode.