Termination Terms¶
Termination terms return a boolean per env; any true term ends the episode. A term configured with time_out=True
marks a truncation rather than a failure. The
rewards and terminations guide explains both; the
term catalog lists every parameter.
from eden import terminations
from eden.terms import DoneTerm
DoneTerm.configure(func=terminations.time_out, time_out=True)
The base classes TerminationTerm and TerminationTermFuncWrapper are on the
managers page.
Common¶
Time-out, metric success and failure, illegal contact and limit violations.
Common termination terms (timeout, success/failure, illegal contact, limits).
Attributes¶
Classes¶
OnMetricSuccess
¶
OnMetricSuccess(env: EnvBase, options: _TermOptionsT)
Bases: TerminationTerm
Terminate the envs in which the named metric term reports success this step.
:meth:build runs the manager's own current-step success check once, so a missing metric
manager, an unset or unknown metric_name (the error lists the active metrics), a
non-INTERVAL metric and a contributes_to_success=False metric all raise at env
construction. To end the episode on a metric that defines no success, use :class:MetricAbove.
Source code in eden/managers/base.py
MetricAbove
¶
MetricAbove(env: EnvBase, options: _TermOptionsT)
Bases: TerminationTerm
Terminate the envs in which the named metric's cached value is strictly above threshold.
Reads metric_manager.get_value(metric_name): the current-step value, or — for a metric
declared is_cumulative=True — the running episode sum (reset per-env on episode reset),
so on a cumulative metric threshold bounds the episode total, not one step's value.
Unlike on_metric_success this never consults the metric's success check, so it accepts
a metric with contributes_to_success=False — e.g. an arm–table collision metric that
must end the episode without being part of the task's success accounting.
A missing metric manager or an unset or unknown metric_name (the error lists the active
metrics) raises in :meth:build, i.e. at env construction.
Source code in eden/managers/base.py
IllegalLinkContact
¶
IllegalLinkContact(env: EnvBase, options: _TermOptionsT)
Bases: TerminationTerm
Terminate when any of the named links carries a net contact force above force_threshold.
The link-level sibling of :func:illegal_contact, and the reason both exist: that term asks
which entities touched, this one asks which links of one entity took load, and how hard. The
knee-and-torso fall detector every locomotion task wants is this one — the entity-level term
cannot express it, because a walking robot's feet are in contact with exactly the same entity
(the ground or the terrain) as its knees. It mirrors Isaac Lab / mjlab's
mdp.illegal_contact(body_names, threshold), minus their force history: Eden reads the net
force from the most recent scene.step(), so a contact shorter than one control step can slip
between two reads.
Same reading as :class:~eden.managers.terms.rewards.common.UndesiredContacts — that term
counts the offending links so a weight can price them, this one ends the episode on the first —
and the two resolve links_name identically, so a config can penalise and terminate on one
link set without the two drifting apart.
| PARAMETER | DESCRIPTION |
|---|---|
entity_name
|
Entity whose links are checked. Must be a rigid entity (
|
links_name
|
:func:
|
force_threshold
|
Net contact-force magnitude, in newtons, above which a link counts as illegally touching.
The default of
|
Source code in eden/managers/base.py
Attributes¶
Methods:¶
build
¶
Source code in eden/managers/terms/terminations/common.py
compute
¶
Source code in eden/managers/terms/terminations/common.py
Functions:¶
illegal_contact
¶
illegal_contact(env: RLEnvBase, *, entity_name: str, illegal_contact_entity_names: list[str]) -> Tensor
Source code in eden/managers/terms/terminations/common.py
dofs_pos_limit_exceeded
¶
Terminate when any DOF position is outside the entity's soft position limits.
probability gates the termination globally per call (one Bernoulli draw),
leaving probabilistic slack for policies that occasionally bump the limits.
Set to 1.0 for hard termination.
Source code in eden/managers/terms/terminations/common.py
dofs_vel_limit_exceeded
¶
dofs_vel_limit_exceeded(env: RLEnvBase, *, entity_name: str, max_vel: float, probability: float = 1.0) -> Tensor
Terminate when any DOF velocity exceeds max_vel in magnitude.
probability gates the termination globally per call. Set to 1.0 for hard
termination.
Source code in eden/managers/terms/terminations/common.py
cumulative_reward_below_threshold
¶
cumulative_reward_below_threshold(env: RLEnvBase, *, reward_term: str, per_step_threshold: float, grace_steps: int = 0, check_interval: int = 1) -> Tensor
Terminate envs whose running raw reward for reward_term falls below a threshold.
The threshold is per_step_threshold * env.dt * completed_steps.
Mirrors dexmachina's early-reset curriculum trigger
(dexmachina/envs/base_env.py:712-750). Reads the weight-free,
dt-scaled accumulation via :meth:RewardManager.get_episode_sum so the
threshold stays stable when reward curricula mutate term.weight at
runtime.
Mental model: average reward per completed step ≈
cum / (dt * (episode_length_buf - 1)). The term fires when that
ratio drops below per_step_threshold, optionally rounded down to
multiples of check_interval steps.
| PARAMETER | DESCRIPTION |
|---|---|
env
|
The environment instance.
TYPE:
|
reward_term
|
Name of a term registered with the reward manager. Raises
TYPE:
|
per_step_threshold
|
Floor on raw per-step reward (unweighted
TYPE:
|
grace_steps
|
Suppress the gate while
TYPE:
|
check_interval
|
TYPE:
|
Source code in eden/managers/terms/terminations/common.py
dofs_torque_limit_exceeded
¶
dofs_torque_limit_exceeded(env: RLEnvBase, *, entity_name: str, soft_ratio: float = 1.0, probability: float = 1.0) -> Tensor
Terminate when any applied DOF torque exceeds soft_ratio * default_dofs_force_limits.
Uses the entity's per-DOF effort limit (the configured default_dofs_force_limits, else actuator-spec
EFFORT_LIMIT, else the asset's force range) and triggers when |tau| > soft_ratio * limit for any
joint. probability gates the termination globally per call.
Source code in eden/managers/terms/terminations/common.py
Locomotion¶
Locomotion termination terms (base orientation thresholds, base height floor).
Attributes¶
Classes¶
Functions:¶
base_orientation_roll_greater_than
¶
Terminate when the base roll exceeds threshold degrees.
Source code in eden/managers/terms/terminations/locomotion.py
base_orientation_pitch_greater_than
¶
Terminate when the base pitch exceeds threshold degrees.
Source code in eden/managers/terms/terminations/locomotion.py
root_height_below_minimum
¶
root_height_below_minimum(env: EnvBase, *, entity_name: str, minimum_height: float, terrain_entity_name: str | None = None, relative: bool = False) -> Tensor
Terminate when the entity's base sinks below minimum_height above the ground.
The height floor half of a fall detector, complementing
:func:~eden.managers.terms.terminations.velocity_tracking.fell_over (which watches the
lean angle): a robot that collapses onto its belly while staying upright trips this one and not
that one. Shares :func:~eden.managers.terms.utils.base_height_above_ground with the
:func:~eden.managers.terms.observations.locomotion.base_height observation, so a policy that
sees its height and an episode that ends on it agree on the number.
| PARAMETER | DESCRIPTION |
|---|---|
env
|
The environment instance.
TYPE:
|
entity_name
|
Entity whose base height is checked.
TYPE:
|
minimum_height
|
Floor, in metres. The term fires while
TYPE:
|
terrain_entity_name
|
Terrain entity to measure against.
TYPE:
|
relative
|
Frame the base pose is read in — see
:func:
TYPE:
|
Source code in eden/managers/terms/terminations/locomotion.py
Velocity tracking¶
Termination terms for humanoid velocity tracking tasks.
Attributes¶
Classes¶
Functions:¶
fell_over
¶
Terminate when the robot leans too far from vertical.
Uses projected gravity to determine the lean angle. The robot is considered
fallen when the angle between the gravity vector in body frame and the
world z-axis exceeds limit_angle (in radians).
Source code in eden/managers/terms/terminations/velocity_tracking.py
Manipulation¶
Manipulation termination terms (object out of reach).
Attributes¶
Classes¶
Functions:¶
object_out_of_reach
¶
object_out_of_reach(env: EnvBase, *, entity_name: str, object_entity_name: str, object_link_name: str | None = None, max_dist: float)
Terminate when the base is over max_dist from the object in xy.
Source code in eden/managers/terms/terminations/manipulation.py
Motion tracking¶
Termination terms that gate episodes on robot-vs-motion-ref tracking error.
Two families:
- Direct world-frame gates (function-style, registry keys
motion_{base,link,dofs}_*_tracking_error_above): hard> thresholdtests on raw distances. Symmetric with :mod:eden.managers.terms.rewards.tracking. The dexmachina ManipTrans curriculum kills envs whose pos / rot / per-link error exceed aneps; these terms supply the gates (decaying the eps is a curriculum's job). - Anchor-yaw-warped gates (
bad_anchor_*,BadMotionLinkPosZOnly): compare robot state against the yaw-warped motion target so the gate doesn't fire just because the robot drifted in heading.
Also exposes :func:motion_ends, which fires when the motion buffer for
the entity runs out of frames.
Reduction conventions for multi-link / multi-DOF terms:
"max"(default) — strict per-element gate; any link/DOF beyond threshold triggers. Matches ManipTrans semantics."mean"— averaged-error gate; lenient.
Attributes¶
Classes¶
BadMotionLinkPosZOnly
¶
BadMotionLinkPosZOnly(env: EnvBase, options: _TermOptionsT)
Bases: TerminationTerm
Terminate when any tracked link's |z| error vs the motion ref exceeds threshold.
threshold_adaptive=True switches to an adaptive schedule —
the threshold grows linearly when the motion's anchor z drops below
root_height_threshold (default 0.5 m). At the floor the
threshold becomes threshold * (1 + down_threshold) so the gate is
more lenient for crawl / kneel clips, while staying tight for upright
walks. With threshold_adaptive=False (default) the static
threshold is used.
Source code in eden/managers/base.py
Attributes¶
Methods:¶
build
¶
Source code in eden/managers/terms/terminations/tracking.py
compute
¶
Source code in eden/managers/terms/terminations/tracking.py
MotionBasePoseTrackingBreak
¶
MotionBasePoseTrackingBreak(env: EnvBase, options: _TermOptionsT)
Bases: TerminationTerm
Base-pose deviation gate vs the current motion frame.
Terminates when the entity's world-frame base position error exceeds
pos_threshold (m) OR its orientation error exceeds rot_threshold
(radians). ConTrack's object pose-break termination.
pos_threshold / rot_threshold are where the gate starts, and assigning
either after build raises. The gate reads its thresholds from the device
(:attr:thresholds), so a curriculum can tighten them online with
:meth:set_thresholds, which writes them in place without a host round trip: pair with
:class:~eden.managers.terms.curricula.motion.MotionBasePoseThresholdCurriculum
to get ConTrack's success-driven threshold schedule (which is where that
state belongs — it is then logged under Curriculum/* and frozen at
eval). On its own this term is a static gate.
Source code in eden/managers/base.py
Attributes¶
thresholds
property
¶
thresholds: tuple[Tensor, Tensor]
The gate's current (pos_threshold, rot_threshold), as the 0-dim device tensors it compares against.
Methods:¶
build
¶
Source code in eden/managers/terms/terminations/tracking.py
set_thresholds
¶
Move the gate to (pos_threshold, rot_threshold), in place (a 0-dim device tensor never syncs).
Source code in eden/managers/terms/terminations/tracking.py
compute
¶
Source code in eden/managers/terms/terminations/tracking.py
Functions:¶
motion_base_position_tracking_error_above
¶
motion_base_position_tracking_error_above(env: MimicRLEnvBase, *, entity_name: str, threshold: float) -> Tensor
Terminate when world-frame base-position L2 error exceeds threshold.
Source code in eden/managers/terms/terminations/tracking.py
motion_base_orientation_tracking_error_above
¶
motion_base_orientation_tracking_error_above(env: MimicRLEnvBase, *, entity_name: str, threshold: float) -> Tensor
Terminate when base quat-error magnitude (wxyz) exceeds threshold.
Source code in eden/managers/terms/terminations/tracking.py
motion_link_position_tracking_error_above
¶
motion_link_position_tracking_error_above(env: MimicRLEnvBase, *, entity_name: str, links_name: list[str], threshold: float, reduction: Literal['mean', 'max'] = 'max') -> Tensor
Terminate when link-position L2 error reduction exceeds threshold.
Source code in eden/managers/terms/terminations/tracking.py
motion_link_orientation_tracking_error_above
¶
motion_link_orientation_tracking_error_above(env: MimicRLEnvBase, *, entity_name: str, links_name: list[str], threshold: float, reduction: Literal['mean', 'max'] = 'max') -> Tensor
Terminate when link quat-error reduction exceeds threshold.
Source code in eden/managers/terms/terminations/tracking.py
motion_dofs_pos_tracking_error_above
¶
motion_dofs_pos_tracking_error_above(env: MimicRLEnvBase, *, entity_name: str, threshold: float, dofs_name: list[str] | None = None, reduction: Literal['mean', 'max'] = 'max') -> Tensor
Terminate when per-DOF |q − q_ref| reduction exceeds threshold.
Source code in eden/managers/terms/terminations/tracking.py
bad_anchor_pos_z_only
¶
bad_anchor_pos_z_only(env: MimicRLEnvBase, *, entity_name: str = 'robot', anchor_link_name: str = 'torso_link', threshold: float = 0.01, threshold_adaptive: bool = False, down_threshold: float = 0.0, root_height_threshold: float = 0.5) -> Tensor
Terminate when anchor link's |z| error vs motion ref exceeds threshold.
Asserts both links_pos_w and links_quat_w because
:func:get_anchor_state reads both regardless of which we consume here.
threshold_adaptive=True switches to an adaptive schedule —
the threshold grows linearly when the motion's anchor z drops below
root_height_threshold (default 0.5 m). At the floor the
threshold becomes threshold * (1 + down_threshold) so the gate is
more lenient for crawl / kneel clips, while staying tight for upright
walks. With threshold_adaptive=False (default) the static
threshold is used.
Source code in eden/managers/terms/terminations/tracking.py
bad_anchor_ori
¶
bad_anchor_ori(env: MimicRLEnvBase, *, entity_name: str = 'robot', anchor_link_name: str = 'torso_link', threshold: float = 0.01) -> Tensor
Terminate when the anchor's projected-gravity z diverges from the motion ref's.
Fires when the difference exceeds threshold (a pitch/roll-only check on the unit gravity direction, so
an Isaac Lab threshold ports unchanged).
Asserts both links_pos_w and links_quat_w because
:func:get_anchor_state reads both regardless of which we consume here.
Source code in eden/managers/terms/terminations/tracking.py
bad_base_ori
¶
bad_base_ori(env: MimicRLEnvBase, *, entity_name: str, threshold: float) -> Tensor
Terminate when a free base's projected-gravity z diverges from the motion ref's by more than threshold.
The base-pose counterpart of :func:bad_anchor_ori — a tilt-only check that ignores yaw, for an entity with no
anchor link of its own to read: a tracked object that has been knocked over, while spinning it about the vertical
is left to the orientation reward. Reads get_quat() (build the object with align=False so that is the
authored body frame the reference records).
Source code in eden/managers/terms/terminations/tracking.py
motion_ends
¶
motion_ends(env: MimicRLEnvBase, *, entity_name: str) -> Tensor
Terminate when the motion buffer's current lookahead frame is invalid.
Reads :attr:MotionReferenceData.validity at index [:, 0] for
entity_name. Note: with the default
MotionManagerOptions.data_start_from="one_frame_interval", frame 0
is the next frame to be played, not the current one — so this term
fires one step before the policy actually sees the missing frame. With
data_start_from="current_time" it fires on the current frame.