embodichain.lab.sim.motion.execution#
Fixed-cadence execution of timed joint trajectories in simulation.
Standalone playback retimes planner output onto a fixed command period while
leaving the simulation physics period unchanged. The command period must be an
integer multiple of physics_dt; position-plus-velocity targets are opt-in
and velocities are recomputed on the executed grid.
Fixed-cadence standalone simulation playback settings. |
|
Play a timed joint path without changing the simulation physics period. |
|
Restore and verify one candidate's complete initial state. |
|
Plan-check and execute one prepared candidate. |
|
Persist one accepted episode and return its final receipt. |
|
Adapt fixed-scene restore/verify methods to |
|
Result of one coordinator-driven physical candidate attempt. |
|
Drive one candidate through host restore, execution, and persistence. |
|
Assign queued candidates to compatible slots around a single host runner. |
- class embodichain.lab.sim.motion.execution.JointTrajectoryPlaybackCfg[source]#
Fixed-cadence standalone simulation playback settings.
- Parameters:
control_dt (
float|None) – Command period, orNonefor one physics period.joint_command_mode (
Literal['position','position_velocity']) – Whether to write qpos alone or qpos and qvel.preserve_source_grid (
bool) – Preserve already aligned samples and their source indices instead of resampling; required for source callbacks and holds.
Attributes:
Command period, or
Noneto use the simulation physics period.Whether playback writes qpos alone or qpos and qvel targets.
Execute already aligned samples and zero-time joins without resampling.
-
control_dt:
float|None# Command period, or
Noneto use the simulation physics period.
-
joint_command_mode:
Literal['position','position_velocity']# Whether playback writes qpos alone or qpos and qvel targets.
-
preserve_source_grid:
bool# Execute already aligned samples and zero-time joins without resampling.
- embodichain.lab.sim.motion.execution.play_joint_trajectory(sim, robot, *, positions, dt, joint_ids, cfg=None, on_step=None, hold_durations=None)[source]#
Play a timed joint path without changing the simulation physics period.
Planner timing is first quantized to the configured fixed command period. Every command interval advances an integer number of unchanged physics substeps. Velocity targets use that executed grid and preserve each row’s initial/terminal rest and explicit holds.
- Parameters:
sim (
SimulationManager) – Simulation manager in explicit-update mode.robot (
Robot) – Robot receiving joint targets.positions (
Tensor) – Source positions with shape(B, N, D).dt (
Tensor) – Source arrival intervals with shape(B, N).joint_ids (
Sequence[int]) – Full-robot joint columns addressed bypositions.cfg (
JointTrajectoryPlaybackCfg|None) – Playback settings. Defaults to position-only atphysics_dt.on_step (
Optional[Callable[[int,int],None]]) – Callback after each source command and its following interval.hold_durations (
Optional[Mapping[int,float]]) – Explicit additional holds after source command indices, in seconds. Each hold must align with the physics period. Source-index callbacks and holds requirecfg.preserve_source_grid=True.
- Return type:
- Returns:
Executed positions, velocities and arrival intervals, including holds. The final hold, when present, appears as a repeated terminal sample.
Expansion host integration#
The single-slot runner coordinates injected restore, measured-execution, and
persistence ports. Candidate identity, budgets, coverage, and receipts remain
owned by embodichain.lab.sim.motion.expansion.ExpansionSession.
MultiSlotRunner adds generic compatible-slot reservation and exact release
around the existing runner; its current drain policy is synchronous FIFO.
- class embodichain.lab.sim.motion.execution.InitialStatePort[source]#
Restore and verify one candidate’s complete initial state.
Methods:
__init__(*args, **kwargs)restore(item, *[, slot_id])Restore a candidate and return an opaque prepared binding.
- __init__(*args, **kwargs)#
- class embodichain.lab.sim.motion.execution.MeasuredExecutor[source]#
Plan-check and execute one prepared candidate.
Methods:
__init__(*args, **kwargs)execute(item, prepared, *, episode_id, ...)Execute and report the first actual command through the callback.
validate_plan(item)Return host-owned planning/path validation evidence.
- __init__(*args, **kwargs)#
- execute(item, prepared, *, episode_id, commit_id, on_rollout_started, slot_id=None)[source]#
Execute and report the first actual command through the callback.
- Return type:
- class embodichain.lab.sim.motion.execution.EpisodeSink[source]#
Persist one accepted episode and return its final receipt.
Methods:
__init__(*args, **kwargs)submit(episode, *, submission_id)Persist and confirm one episode synchronously or through a bounded sink.
- __init__(*args, **kwargs)#
- class embodichain.lab.sim.motion.execution.FixedSceneInitialStatePort[source]#
Adapt fixed-scene restore/verify methods to
InitialStatePort.Methods:
- class embodichain.lab.sim.motion.execution.SingleSlotOutcome[source]#
Result of one coordinator-driven physical candidate attempt.
Methods:
__init__(status[, candidate_id, receipt, ...])- __init__(status, candidate_id=None, receipt=None, reason=None, episode_id=None, commit_id=None, submission_id=None)#
- class embodichain.lab.sim.motion.execution.SingleSlotRunner[source]#
Drive one candidate through host restore, execution, and persistence.
Methods:
__init__(coordinator, restorer, executor, ...)run_next(*[, slot_id])Execute the next FIFO candidate, or report an empty queue.
run_until_empty(*[, max_attempts])Consume the current bounded queue through the same single slot.
Attributes:
Return the coordinator owned by this runner.
- property coordinator: CandidateCoordinator#
Return the coordinator owned by this runner.
- run_next(*, slot_id=None)[source]#
Execute the next FIFO candidate, or report an empty queue.
- Return type:
- run_until_empty(*, max_attempts=None)[source]#
Consume the current bounded queue through the same single slot.
- Return type:
tuple[SingleSlotOutcome,...]
- class embodichain.lab.sim.motion.execution.MultiSlotRunner[source]#
Assign queued candidates to compatible slots around a single host runner.
The current implementation drains FIFO synchronously; the slot pool and exact reservation lifecycle are independent of that execution policy, so a host can replace the inner runner with a concurrent implementation later.
Methods:
__init__(runner, slot_pool)run_next()Reserve a compatible slot, run one candidate, and release it.
run_until_empty(*[, max_attempts])Drain FIFO candidates while respecting the optional attempt bound.
Attributes:
Return the host-owned physical slot pool.
- run_until_empty(*, max_attempts=None)[source]#
Drain FIFO candidates while respecting the optional attempt bound.
- Return type:
tuple[SingleSlotOutcome,...]
- property slot_pool: PhysicalSlotPool#
Return the host-owned physical slot pool.