Skip to content

Feat/guardrail dict api#2

Merged
ez945y merged 3 commits into
mainfrom
feat/guardrail-dict-api
Jun 15, 2026
Merged

Feat/guardrail dict api#2
ez945y merged 3 commits into
mainfrom
feat/guardrail-dict-api

Conversation

@ez945y

@ez945y ez945y commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

Briefly describe the changes and the problem they solve.

Linked Issues

Fixes # (issue number)

Testing

  • Unit tests
  • Simulation/Hardware tests
  • Other:

Checklist

  • I have self-reviewed my changes
  • I have updated the documentation
  • I have added tests for my changes

ez945y and others added 3 commits June 14, 2026 20:04
Redesign the no-hardware filter API around a single keyed dict aligned with
the runtime's step(): the reserved `action` key is the command to validate,
every other key is an observation group injected into callbacks by name. This
removes the old `guard(action, obs)` two-flat-vector shape that forced
different-space embodiments (a mobile base observing [x,y,yaw] but commanding
[v,omega]) to pack everything into one vector and slice it positionally.

API (no compat shim):
- SafetyGuard -> Guardrail, safe() -> guardrail(),
  SafetyProcessorStep -> GuardrailProcessorStep
- Guardrail prints its obs/action contract on construction and fails fast when
  an input dict omits a required obs group or shadows a reserved runtime key
- safe_action on reject: explicit vector / "hold" (arm default) / "zero"

Mechanics:
- Observation.channels + images are flattened into the runtime pool so a
  callback can declare `base_pose`/`current` and receive it directly
- Observation.joint_positions defaults to an empty array (a mobile base has none)
- ActionProposal duck-types as its command vector (__array__/__iter__/...) so
  callbacks can write `v, omega = action` while builtins keep .target_joint_positions
- @dam.callback gains `layer=`, setting _cb_layer so custom filter callbacks are
  dispatched by the matching L-guard

Also folds in the 0.7.0 semantics cleanup: remove JointLayout/chains (action_layout
is the single named-segment contract), drop the fallback `type` field, replace
register_solver_factory with the @dam.solver_factory decorator + keyword injection,
and bump to 0.7.0.

New example mobile_base_guardrail.py (~55 lines) replaces a 180-line wrapper.
Docs + release notes updated; 721 unit tests pass, mypy + docs-check clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ez945y ez945y merged commit e3fca29 into main Jun 15, 2026
1 check passed
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant