Learned policies for Beam Bots. bb_policy
lets robots execute neural-network behaviours that map observations to actions —
train a policy from demonstrations or simulation, export it to ONNX, and deploy
it on real hardware with full safety-system integration.
A policy is a function π: observation → action. Given what the robot perceives
(joint positions, velocities, camera frames, forces), the policy outputs what it
should do (target positions, velocities, gripper commands). Inference runs on the
BEAM, in the same runtime as control — so a crashed or slow policy can't take the
robot down with it.
🚧 Early scaffold. The BB.Policy behaviour and project conventions are in
place; implementations are landing in phases. See
PROJECT_PLAN.md
for the roadmap and the design decisions behind it.
def deps do
[
{:bb_policy, "~> 0.1"},
# ONNX inference is optional — add ortex when you deploy a real model:
{:ortex, "~> 0.1"}
]
end{:ok, result} =
BB.Policy.run(MyRobot, BB.Policy.ONNX, %{task: :pick_mug},
policy_opts: [
model: "priv/models/pick_mug.onnx",
normalizer: "priv/models/pick_mug.json",
observation: [positions: [:shoulder, :elbow, :wrist]],
action: [{[:shoulder, :elbow, :wrist], :position}]
],
rate_hz: 20,
timeout: :timer.seconds(30)
)| Concern | Where it lives |
|---|---|
| Map observation → action | BB.Policy behaviour |
| Fixed-rate control loop | BB.Policy.Runner |
| Input/output scaling | BB.Policy.Normalizer |
| ONNX model loading & inference | BB.Policy.ONNX (via Ortex) |
| Safety | BB.Safety — the runner only applies commands while armed |
| Observability | [:bb, :policy, …] telemetry events |
Generated docs live at https://hexdocs.pm/bb_policy. Architecture, decisions,
and the phased roadmap are in
PROJECT_PLAN.md;
contributor conventions are in
AGENTS.md.
Apache-2.0. See LICENSES/
and the SPDX headers on each file (REUSE-compliant).