To run the conditionals test suite:
python examples/test_conditionals.py --headlessThe test will use the following test scene:
See robolab/robolab/core/task/conditionals.py for implementation details.
Spatial conditions (object_right_of, object_left_of, object_in_front_of, object_behind) support different frame of reference modes:
frame_of_reference="robot"(default): Uses the robot's egocentric perspective- X-axis: robot's forward direction
- Y-axis: robot's left direction
frame_of_reference="world": Uses global world coordinates
The mirrored=False (default) uses the robot's natural perspective. Set mirrored=True for a flipped XY perspective, as if viewing the scene from across the robot.
The object_on_top conditional uses physics-based contact force analysis to determine if an object is stably supported on a surface.
Let
For
-
Cone axis:
$\hat{n} = [0, 0, 1]^\top$ (upward direction) -
Cone half-angle:
$\theta_{\max}$ (default 45°)
Conditions for stable support:
The cone constraint (3) can be derived from the dot product:
| Function | Method | Use Case |
|---|---|---|
object_on_top |
Contact force cone | Stable resting detection (terminations) |
object_above |
Bounding box geometry | Position-based checks (lifted above surface) |
# Check if orange is stably resting on plate
object_on_top(env, object="orange", reference_object="plate", require_gripper_detached=True)
# Geometric check (e.g., for lifted detection)
object_above(env, object="orange", reference_object="table", z_margin=0.05)For functions that support logicals, the available logicals are:
any: if at least 1 object satisfies the conditionall: All objects need to satisfy the conditionchoose: Given the set ofobjectswith sizeN, exactlyKobjects must satisfy the condition.
Base functions; can be used for task Terminations as well as subtasks.
These expand into multiple atomic subtasks. These cannot be used for Terminations.
pick_and_place(object, container, logical): Picks up objects and places them in a container- Automatically creates the sequence: grab → move above → drop → verify in container
- Supports multiple objects with "all" or "any" completion logic

